prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--Settings--
|
local mySettings = script.Parent.Settings
local debugOption = mySettings.Debug.Value
|
-- The optional property of matcher context is true if undefined.
-- ROBLOX deviation: upstream injects expand: false by default so we actually set to true if undefined
|
local function isExpand(expand: boolean?): boolean
return not not expand
end
|
--gun parts
|
local lufa = gunmodel:WaitForChild("lufa")
local boltmodel = gunmodel:WaitForChild("bolt")
local magmodel = gunmodel:WaitForChild("mag")
local boltpart = boltmodel:WaitForChild("boltpart")
|
-- Update the TextLabel with the current date
|
function updateDate()
local currentDate = getCurrentDate()
TextLabelSht.Text = currentDate
TextLabel.Text = currentDate
end
|
--[[VARIABLE DEFINITION ANOMALY DETECTED, DECOMPILATION OUTPUT POTENTIALLY INCORRECT]]--
--[[VARIABLE DEFINITION ANOMALY DETECTED, DECOMPILATION OUTPUT POTENTIALLY INCORRECT]]--
-- Decompiled with the Synapse X Luau decompiler.
|
local l__HDAdminMain__1 = _G.HDAdminMain;
local l__CmdBar__2 = l__HDAdminMain__1.gui.CmdBar;
local v3 = {
maxSuggestions = 5,
mainParent = l__CmdBar__2,
textBox = l__CmdBar__2.SearchFrame.TextBox,
rframe = l__CmdBar__2.ResultsFrame,
suggestionPos = 1,
suggestionDisplayed = 0,
forceExecute = false,
highlightColor = Color3.fromRGB(50, 50, 50),
otherColor = Color3.fromRGB(80, 80, 80),
suggestionLabels = {},
currentBarCommand = nil
};
l__CmdBar__2.Visible = false;
local function u1(p1)
local v4 = nil;
local v5 = "";
v4 = p1.suggestionLabels["Label" .. p1.suggestionPos];
if p1.specificArg then
local v6 = v4.Name .. " ";
p1.textBox.Text = v6;
coroutine.wrap(function()
for v7 = 1, 10 do
p1.textBox:ReleaseFocus();
wait();
end;
end)();
wait();
p1.textBox.Text = v6;
return;
end;
local v8 = string.sub(p1.textBox.Text, 1, 1);
local u2 = -1;
local u3 = {};
p1.textBox.Text:gsub("([^" .. l__HDAdminMain__1.pdata.SplitKey .. "]+)", function(p2)
u2 = u2 + 1;
if v4.ArgPos - 1 < u2 then
return;
end;
table.insert(u3, p2 .. " ");
end);
if u2 == 0 and (v8 == l__HDAdminMain__1.settings.UniversalPrefix or v8 == l__HDAdminMain__1.pdata.Prefix) then
v5 = v8;
end;
local v9 = ((v5 .. table.concat(u3, "")) .. v4.Name) .. l__HDAdminMain__1.pdata.SplitKey;
p1.textBox.Text = v9;
wait();
p1.textBox.Text = v9;
p1.textBox:CaptureFocus();
p1.textBox.CursorPosition = #v9 + 1;
end;
local u4 = {};
local u5 = {};
local function u6(p3)
local l__maxSuggestions__10 = p3.maxSuggestions;
local v11 = 1 - 1;
while true do
local v12 = p3.rframe.LabelTemplate:Clone();
v12.Name = "Label" .. v11;
v12.Visible = false;
v12.Parent = p3.rframe;
local u7 = v11;
v12.MouseEnter:Connect(function()
p3.suggestionPos = u7;
end);
v12.MouseButton1Up:Connect(function()
p3.suggestionPos = u7;
u1(p3);
end);
if 0 <= 1 then
if not (u7 < l__maxSuggestions__10) then
break;
end;
elseif not (l__maxSuggestions__10 < u7) then
break;
end;
u7 = u7 + 1;
end;
end;
local function u8(p4)
p4.textBox.FocusLost:connect(function(p5)
if p4.mainParent.Name ~= "CmdBar" or p4.specificArg then
if p4.suggestionDisplayed > 0 then
u1(p4, p4.specificArg);
return;
end;
else
if p4.suggestionDisplayed > 0 and not forceExecute and l__HDAdminMain__1.device ~= "Mobile" then
u1(p4);
return;
end;
if p5 then
if forceExecute then
u1(p4);
end;
u4:CloseCmdBar();
if #p4.textBox.Text > 1 then
local v13 = p4.textBox.Text;
local v14 = string.sub(v13, 1, 1);
if v14 ~= l__HDAdminMain__1.settings.UniversalPrefix and v14 ~= l__HDAdminMain__1.pdata.Prefix then
v13 = l__HDAdminMain__1.pdata.Prefix .. v13;
end;
if string.sub(v13, -1) == " " then
v13 = string.sub(v13, 1, -1);
end;
l__HDAdminMain__1.signals.RequestCommand:InvokeServer(v13);
end;
end;
end;
end);
end;
function u4.SetupTextbox(p6, p7, p8)
u5[p7] = p8;
u6(p8);
u8(p8);
local l__specificArg__9 = p8.specificArg;
local function u10(p9, p10, p11, p12)
if string.sub(string.lower(p12), 1, #p10) == p10 then
table.insert(p9, {
Name = p12,
ArgPos = p11
});
if #p9 ~= p8.maxSuggestions then
return;
end;
else
return;
end;
return true;
end;
local u11 = nil;
p8.textBox.Changed:connect(function(p13)
if p13 == "Text" then
local v15 = nil;
v15 = {};
if l__specificArg__9 then
table.insert(v15, p8.textBox.Text);
else
local u12 = -1;
local u13 = nil;
p8.textBox.Text:gsub("([^" .. l__HDAdminMain__1.pdata.SplitKey .. "]+)", function(p14)
u12 = u12 + 1;
if u12 == 0 then
u13 = p14;
return;
end;
if u12 > 0 then
table.insert(v15, p14);
end;
end);
if u12 > 0 and not p8.currentBarCommand then
local v16 = string.sub(u13, 1, 1);
if v16 == l__HDAdminMain__1.settings.UniversalPrefix or v16 == l__HDAdminMain__1.pdata.Prefix then
u13 = string.sub(u13, 2);
end;
u13 = string.lower(u13);
for v17, v18 in pairs(l__HDAdminMain__1.commandInfo) do
if string.lower(v18.Name) == u13 then
p8.currentBarCommand = v18;
elseif v18.Aliases then
for v19, v20 in pairs(v18.Aliases) do
if string.lower(v20) == u13 then
p8.currentBarCommand = v18;
end;
end;
end;
end;
elseif u12 <= 0 then
p8.currentBarCommand = nil;
end;
end;
local v21 = {};
p8.suggestionPos = 1;
if #p8.textBox.Text > 1 or l__specificArg__9 and #p8.textBox.Text > 0 then
if u12 == 0 then
local v22 = string.lower(string.sub(p8.textBox.Text, 2));
local v23 = string.lower(string.sub(p8.textBox.Text, 1, 1));
local v24, v25, v26 = pairs(l__HDAdminMain__1.commandInfo);
while true do
local v27, v28 = v24(v25, v26);
if not v27 then
break;
end;
local v29 = v28.Prefixes[1];
if string.sub(string.lower(v28.Name), 1, #v22) == v22 and v29 == v23 then
table.insert(v21, {
Name = v28.Name,
Args = v28.Args,
Prefixes = v28.Prefixes,
ArgPos = 0
});
if #v21 == p8.maxSuggestions then
break;
end;
end;
local l__UnFunction__30 = v28.UnFunction;
if l__UnFunction__30 and (string.sub(string.lower(l__UnFunction__30), 1, #v22) == v22 and v29 == v23) then
table.insert(v21, {
Name = l__UnFunction__30,
Args = {},
Prefixes = v28.Prefixes,
ArgPos = 0
});
if #v21 == p8.maxSuggestions then
break;
end;
end;
end;
elseif p8.currentBarCommand or l__specificArg__9 then
if l__specificArg__9 then
local v31 = l__specificArg__9;
else
v31 = p8.currentBarCommand.Args[u12];
end;
local v32 = {};
local v33 = string.lower(v15[u12]);
local v34 = string.sub(p8.textBox.Text, -1);
if v34 ~= " " and v34 ~= l__HDAdminMain__1.pdata.SplitKey then
if v31 == "player" or v31 == "playerarg" then
for v35, v36 in pairs(l__HDAdminMain__1.qualifiers) do
if u10(v21, v33, u12, v36) then
break;
end;
end;
if #v21 < p8.maxSuggestions then
for v37, v38 in pairs(l__HDAdminMain__1.players:GetChildren()) do
if u10(v21, v33, u12, v38.Name) then
break;
end;
end;
end;
elseif v31 == "colour" or v31 == "color" or v31 == "color3" then
for v39, v40 in pairs(l__HDAdminMain__1.colors) do
if u10(v21, v33, u12, v40) then
break;
end;
end;
elseif v31 == "material" then
for v41, v42 in pairs(l__HDAdminMain__1.materials) do
if u10(v21, v33, u12, v42) then
break;
end;
end;
elseif v31 == "rank" then
for v43, v44 in pairs(l__HDAdminMain__1.settings.Ranks) do
if u10(v21, v33, u12, v44[2]) then
break;
end;
end;
elseif v31 == "team" or v31 == "teamcolor" then
local l__teams__45 = l__HDAdminMain__1.teams;
local v46, v47, v48 = pairs(l__teams__45.GetChildren(l__teams__45));
while true do
local v49, v50 = v46(v47, v48);
if not v49 then
break;
end;
v48 = v49;
if u10(v21, v33, u12, v50.Name) then
break;
end;
end;
elseif v31 == "morph" then
local v51, v52, v53 = pairs(l__HDAdminMain__1.morphNames);
while true do
local v54, v55 = v51(v52, v53);
if not v54 then
break;
end;
v53 = v54;
if u10(v21, v33, u12, v54) then
break;
end;
end;
elseif v31 == "tools" or v31 == "gears" or v31 == "tool" or v31 == "gear" then
local v56, v57, v58 = pairs(l__HDAdminMain__1.toolNames);
while true do
local v59, v60 = v56(v57, v58);
if not v59 then
break;
end;
v58 = v59;
if u10(v21, v33, u12, v59) then
break;
end;
end;
end;
end;
end;
end;
p8.suggestionDisplayed = #v21;
if p8.currentBarCommand and #p8.currentBarCommand.Args == u12 and p8.suggestionDisplayed > 0 then
forceExecute = true;
else
forceExecute = false;
end;
for v61 = 1, p8.maxSuggestions do
local v62 = v21[v61];
local v63 = p8.rframe["Label" .. v61];
if v62 then
local v64 = false;
if v62.Args then
v64 = true;
end;
local v65 = false;
if v64 and v62.Prefixes[1] == l__HDAdminMain__1.settings.UniversalPrefix then
v65 = true;
end;
local v66 = {};
if v64 then
for v67, v68 in pairs(v62.Args) do
if not v65 or v68 ~= "player" or v68 == "playerarg" then
table.insert(v66, "<" .. v68 .. ">");
end;
end;
end;
v63.TextLabel.Text = v62.Name .. " " .. table.concat(v66, " ");
if v61 == p8.suggestionPos then
v63.BackgroundColor3 = p8.highlightColor;
else
v63.BackgroundColor3 = p8.otherColor;
end;
p8.suggestionLabels["Label" .. v61] = v62;
if p8.mainParent.Name ~= "CmdBar" then
local l__Y__69 = p8.rframe.LabelTemplate.AbsoluteSize.Y;
if l__HDAdminMain__1.gui.Notices.AbsoluteSize.Y < p8.rframe.AbsolutePosition.Y + l__Y__69 * v61 + 5 then
if not u11 then
u11 = p8.mainParent.Position;
end;
p8.mainParent.Position = p8.mainParent.Position - UDim2.new(0, 0, 0, l__Y__69);
end;
end;
v63.Visible = true;
else
v63.Visible = false;
end;
end;
if u11 and #v21 < 1 then
p8.mainParent.Position = u11;
u11 = nil;
end;
if #v21 < 1 and p8.mainParent.Name ~= "CmdBar" then
p8.mainParent.ClipsDescendants = true;
else
p8.mainParent.ClipsDescendants = false;
end;
end;
end);
end;
u4:SetupTextbox("cmdbar1", v3);
function u4.ToggleBar(p15, p16)
if p16 == Enum.KeyCode.Quote then
if l__HDAdminMain__1.gui.CmdBar.Visible then
l__HDAdminMain__1:GetModule("CmdBar"):CloseCmdBar();
return;
else
l__HDAdminMain__1:GetModule("CmdBar"):OpenCmdBar();
return;
end;
end;
if p16 == Enum.KeyCode.Semicolon then
local l__Cmdbar2__70 = l__HDAdminMain__1.settings.Cmdbar2;
if l__HDAdminMain__1.pdata.Rank > 0 or l__Cmdbar2__70 <= 0 then
if l__HDAdminMain__1.pdata.Rank < l__Cmdbar2__70 then
local v71 = l__HDAdminMain__1:GetModule("cf"):FormatNotice("CommandBarLocked", "2", l__HDAdminMain__1:GetModule("cf"):GetRankName(l__Cmdbar2__70));
l__HDAdminMain__1:GetModule("Notices"):Notice("Error", v71[1], v71[2]);
return;
end;
local l__cmdbar2__72 = u5.cmdbar2;
if not l__cmdbar2__72 then
l__HDAdminMain__1:GetModule("ClientCommands").cmdbar2.Function();
return;
end;
if l__cmdbar2__72.mainParent.Visible then
l__cmdbar2__72.mainParent.Visible = false;
return;
end;
l__cmdbar2__72.mainParent.Visible = true;
end;
end;
end;
local u14 = { "Chat", "PlayerList" };
local u15 = {};
local l__CustomTopBar__16 = l__HDAdminMain__1.gui.CustomTopBar;
local u17 = 1;
local u18 = true;
function u4.OpenCmdBar(p17)
local l__Cmdbar__73 = l__HDAdminMain__1.settings.Cmdbar;
if l__HDAdminMain__1.pdata.Rank > 0 or l__Cmdbar__73 <= 0 then
if l__HDAdminMain__1.pdata.Rank < l__Cmdbar__73 then
local v74 = l__HDAdminMain__1:GetModule("cf"):FormatNotice("CommandBarLocked", "", l__HDAdminMain__1:GetModule("cf"):GetRankName(l__Cmdbar__73));
l__HDAdminMain__1:GetModule("Notices"):Notice("Error", v74[1], v74[2]);
return;
end;
v3.textBox:CaptureFocus();
for v75, v76 in pairs(u14) do
u15[v76] = l__HDAdminMain__1.starterGui:GetCoreGuiEnabled(v76);
l__HDAdminMain__1.starterGui:SetCoreGuiEnabled(Enum.CoreGuiType[v76], false);
end;
l__CustomTopBar__16.BackgroundColor3 = Color3.fromRGB(50, 50, 50);
u17 = l__CustomTopBar__16.BackgroundTransparency;
u18 = l__CustomTopBar__16.Visible;
l__CustomTopBar__16.BackgroundTransparency = 0;
l__CustomTopBar__16.Visible = true;
v3.textBox.Text = "";
l__CmdBar__2.Visible = true;
wait();
v3.textBox.Text = l__HDAdminMain__1.pdata.Prefix;
v3.textBox.CursorPosition = 3;
end;
end;
function u4.CloseCmdBar(p18)
l__CmdBar__2.Visible = false;
for v77, v78 in pairs(u14) do
local v79 = u15[v78];
if v79 then
l__HDAdminMain__1.starterGui:SetCoreGuiEnabled(Enum.CoreGuiType[v78], v79);
end;
end;
l__CustomTopBar__16.BackgroundColor3 = Color3.fromRGB(31, 31, 31);
l__CustomTopBar__16.BackgroundTransparency = u17;
l__CustomTopBar__16.Visible = u18;
coroutine.wrap(function()
for v80 = 1, 10 do
v3.textBox:ReleaseFocus();
wait();
end;
end)();
end;
function u4.PressedArrowKey(p19, p20)
for v81, v82 in pairs(u5) do
if v82.mainParent.Visible and v82.textBox:IsFocused() then
local v83 = v82.rframe:FindFirstChild("Label" .. v82.suggestionPos);
if p20 == Enum.KeyCode.Down then
v82.suggestionPos = v82.suggestionPos + 1;
if v82.suggestionDisplayed < v82.suggestionPos then
v82.suggestionPos = 1;
end;
elseif p20 == Enum.KeyCode.Up then
v82.suggestionPos = v82.suggestionPos - 1;
if v82.suggestionPos < 1 then
v82.suggestionPos = v82.suggestionDisplayed;
end;
elseif p20 == Enum.KeyCode.Right then
u1(v82);
end;
local v84 = v82.rframe["Label" .. v82.suggestionPos];
if v84 ~= v83 then
v83.BackgroundColor3 = v82.otherColor;
v84.BackgroundColor3 = v82.highlightColor;
end;
end;
end;
end;
return u4;
|
-- Clear any existing animation tracks
-- Fixes issue with characters that are moved in and out of the Workspace accumulating tracks
|
local animator = if Humanoid then Humanoid:FindFirstChildOfClass("Animator") else nil
if animator then
local animTracks = animator:GetPlayingAnimationTracks()
for i,track in ipairs(animTracks) do
track:Stop(0)
track:Destroy()
end
end
for name, fileList in pairs(animNames) do
configureAnimationSet(name, fileList)
end
for _,child in script:GetChildren() do
if child.isA("StringValue") and not animNames[child.name] then
animNames[child.Name] = {}
configureAnimationSet(child.Name, animNames[child.Name])
end
end
|
--[[
Fired when PreGame is entered, throwing out a player state update, as well as transitioning the player state
]]
|
function Transitions.onEnterPreGame(stateMachine, event, from, to, playerComponent)
Logger.trace(playerComponent.player.Name, " state change: ", from, " -> ", to)
playerComponent:updateStatus("currentState", to)
PlayerPreGame.enter(stateMachine, playerComponent)
end
|
--////////////////////////////// Methods
--//////////////////////////////////////
|
local function ShallowCopy(table)
local copy = {}
for i, v in pairs(table) do
copy[i] = v
end
return copy
end
local methods = {}
local lazyEventNames =
{
eDestroyed = true,
eSaidMessage = true,
eReceivedMessage = true,
eReceivedUnfilteredMessage = true,
eMessageDoneFiltering = true,
eReceivedSystemMessage = true,
eChannelJoined = true,
eChannelLeft = true,
eMuted = true,
eUnmuted = true,
eExtraDataUpdated = true,
eMainChannelSet = true,
eChannelNameColorUpdated = true,
}
local lazySignalNames =
{
Destroyed = "eDestroyed",
SaidMessage = "eSaidMessage",
ReceivedMessage = "eReceivedMessage",
ReceivedUnfilteredMessage = "eReceivedUnfilteredMessage",
RecievedUnfilteredMessage = "eReceivedUnfilteredMessage", -- legacy mispelling
MessageDoneFiltering = "eMessageDoneFiltering",
ReceivedSystemMessage = "eReceivedSystemMessage",
ChannelJoined = "eChannelJoined",
ChannelLeft = "eChannelLeft",
Muted = "eMuted",
Unmuted = "eUnmuted",
ExtraDataUpdated = "eExtraDataUpdated",
MainChannelSet = "eMainChannelSet",
ChannelNameColorUpdated = "eChannelNameColorUpdated"
}
methods.__index = function (self, k)
local fromMethods = rawget(methods, k)
if fromMethods then return fromMethods end
if lazyEventNames[k] and not rawget(self, k) then
rawset(self, k, Instance.new("BindableEvent"))
end
local lazySignalEventName = lazySignalNames[k]
if lazySignalEventName and not rawget(self, k) then
if not rawget(self, lazySignalEventName) then
rawset(self, lazySignalEventName, Instance.new("BindableEvent"))
end
rawset(self, k, rawget(self, lazySignalEventName).Event)
end
return rawget(self, k)
end
function methods:LazyFire(eventName, ...)
local createdEvent = rawget(self, eventName)
if createdEvent then
createdEvent:Fire(...)
end
end
function methods:SayMessage(message, channelName, extraData)
if (self.ChatService:InternalDoProcessCommands(self.Name, message, channelName)) then return end
if (not channelName) then return end
local channel = self.Channels[channelName:lower()]
if (not channel) then
error("Speaker is not in channel \"" .. channelName .. "\"")
end
local messageObj = channel:InternalPostMessage(self, message, extraData)
if (messageObj) then
local success, err = pcall(function() self:LazyFire("eSaidMessage", messageObj, channelName) end)
if not success and err then
print("Error saying message: " ..err)
end
end
return messageObj
end
function methods:JoinChannel(channelName)
if (self.Channels[channelName:lower()]) then
warn("Speaker is already in channel \"" .. channelName .. "\"")
return
end
local channel = self.ChatService:GetChannel(channelName)
if (not channel) then
error("Channel \"" .. channelName .. "\" does not exist!")
end
self.Channels[channelName:lower()] = channel
channel:InternalAddSpeaker(self)
local success, err = pcall(function()
self.eChannelJoined:Fire(channel.Name, channel:GetWelcomeMessageForSpeaker(self))
end)
if not success and err then
print("Error joining channel: " ..err)
end
end
function methods:LeaveChannel(channelName)
if (not self.Channels[channelName:lower()]) then
warn("Speaker is not in channel \"" .. channelName .. "\"")
return
end
local channel = self.Channels[channelName:lower()]
self.Channels[channelName:lower()] = nil
channel:InternalRemoveSpeaker(self)
local success, err = pcall(function()
self:LazyFire("eChannelLeft", channel.Name)
self.EventFolder.OnChannelLeft:FireClient(self.PlayerObj, channel.Name)
end)
if not success and err then
print("Error leaving channel: " ..err)
end
end
function methods:IsInChannel(channelName)
return (self.Channels[channelName:lower()] ~= nil)
end
function methods:GetChannelList()
local list = {}
for i, channel in pairs(self.Channels) do
table.insert(list, channel.Name)
end
return list
end
function methods:SendMessage(message, channelName, fromSpeaker, extraData)
local channel = self.Channels[channelName:lower()]
if (channel) then
channel:SendMessageToSpeaker(message, self.Name, fromSpeaker, extraData)
else
warn(string.format("Speaker '%s' is not in channel '%s' and cannot receive a message in it.", self.Name, channelName))
end
end
function methods:SendSystemMessage(message, channelName, extraData)
local channel = self.Channels[channelName:lower()]
if (channel) then
channel:SendSystemMessageToSpeaker(message, self.Name, extraData)
else
warn(string.format("Speaker '%s' is not in channel '%s' and cannot receive a system message in it.", self.Name, channelName))
end
end
function methods:GetPlayer()
return self.PlayerObj
end
function methods:SetExtraData(key, value)
self.ExtraData[key] = value
self:LazyFire("eExtraDataUpdated", key, value)
end
function methods:GetExtraData(key)
return self.ExtraData[key]
end
function methods:SetMainChannel(channelName)
local success, err = pcall(function()
self:LazyFire("eMainChannelSet", channelName)
self.EventFolder.OnMainChannelSet:FireClient(self.PlayerObj, channelName)
end)
if not success and err then
print("Error setting main channel: " ..err)
end
end
|
-- Helper function to lazily instantiate a controller if it does not yet exist,
-- disable the active controller if it is different from the on being switched to,
-- and then enable the requested controller. The argument to this function must be
-- a reference to one of the control modules, i.e. Keyboard, Gamepad, etc.
| |
-- Note that VehicleController does not derive from BaseCharacterController, it is a special case
|
local VehicleController = {}
VehicleController.__index = VehicleController
function VehicleController.new(CONTROL_ACTION_PRIORITY)
local self = setmetatable({}, VehicleController)
self.CONTROL_ACTION_PRIORITY = CONTROL_ACTION_PRIORITY
self.enabled = false
self.vehicleSeat = nil
self.throttle = 0
self.steer = 0
self.acceleration = 0
self.decceleration = 0
self.turningRight = 0
self.turningLeft = 0
self.vehicleMoveVector = ZERO_VECTOR3
self.autoPilot = {}
self.autoPilot.MaxSpeed = 0
self.autoPilot.MaxSteeringAngle = 0
return self
end
function VehicleController:BindContextActions()
if useTriggersForThrottle then
ContextActionService:BindActionAtPriority("throttleAccel", (function(actionName, inputState, inputObject)
self:OnThrottleAccel(actionName, inputState, inputObject)
return Enum.ContextActionResult.Pass
end), false, self.CONTROL_ACTION_PRIORITY, Enum.KeyCode.ButtonR2)
ContextActionService:BindActionAtPriority("throttleDeccel", (function(actionName, inputState, inputObject)
self:OnThrottleDeccel(actionName, inputState, inputObject)
return Enum.ContextActionResult.Pass
end), false, self.CONTROL_ACTION_PRIORITY, Enum.KeyCode.ButtonL2)
end
ContextActionService:BindActionAtPriority("arrowSteerRight", (function(actionName, inputState, inputObject)
self:OnSteerRight(actionName, inputState, inputObject)
return Enum.ContextActionResult.Pass
end), false, self.CONTROL_ACTION_PRIORITY, Enum.KeyCode.Right)
ContextActionService:BindActionAtPriority("arrowSteerLeft", (function(actionName, inputState, inputObject)
self:OnSteerLeft(actionName, inputState, inputObject)
return Enum.ContextActionResult.Pass
end), false, self.CONTROL_ACTION_PRIORITY, Enum.KeyCode.Left)
end
function VehicleController:Enable(enable, vehicleSeat)
if enable == self.enabled and vehicleSeat == self.vehicleSeat then
return
end
self.enabled = enable
self.vehicleMoveVector = ZERO_VECTOR3
if enable then
if vehicleSeat then
self.vehicleSeat = vehicleSeat
self:SetupAutoPilot()
self:BindContextActions()
end
else
if useTriggersForThrottle then
ContextActionService:UnbindAction("throttleAccel")
ContextActionService:UnbindAction("throttleDeccel")
end
ContextActionService:UnbindAction("arrowSteerRight")
ContextActionService:UnbindAction("arrowSteerLeft")
self.vehicleSeat = nil
end
end
function VehicleController:OnThrottleAccel(actionName, inputState, inputObject)
if FFlagBetterHandlingVehicleInputStates then
if inputState == Enum.UserInputState.End or inputState == Enum.UserInputState.Cancel then
self.acceleration = 0
else
self.acceleration = -1
end
else
self.acceleration = (inputState ~= Enum.UserInputState.End) and -1 or 0
end
self.throttle = self.acceleration + self.decceleration
end
function VehicleController:OnThrottleDeccel(actionName, inputState, inputObject)
if FFlagBetterHandlingVehicleInputStates then
if inputState == Enum.UserInputState.End or inputState == Enum.UserInputState.Cancel then
self.decceleration = 0
else
self.decceleration = 1
end
else
self.decceleration = (inputState ~= Enum.UserInputState.End) and 1 or 0
end
self.throttle = self.acceleration + self.decceleration
end
function VehicleController:OnSteerRight(actionName, inputState, inputObject)
if FFlagBetterHandlingVehicleInputStates then
if inputState == Enum.UserInputState.End or inputState == Enum.UserInputState.Cancel then
self.turningRight = 0
else
self.turningRight = 1
end
else
self.turningRight = (inputState ~= Enum.UserInputState.End) and 1 or 0
end
self.steer = self.turningRight + self.turningLeft
end
function VehicleController:OnSteerLeft(actionName, inputState, inputObject)
if FFlagBetterHandlingVehicleInputStates then
if inputState == Enum.UserInputState.End or inputState == Enum.UserInputState.Cancel then
self.turningLeft = 0
else
self.turningLeft = -1
end
else
self.turningLeft = (inputState ~= Enum.UserInputState.End) and -1 or 0
end
self.steer = self.turningRight + self.turningLeft
end
|
-- If in-game, enable ctrl hotkeys for exporting
|
if Mode == 'Tool' then
AssignHotkey({ 'LeftControl', 'P' }, ExportSelection);
AssignHotkey({ 'RightControl', 'P' }, ExportSelection);
end;
function IsVersionOutdated()
-- Returns whether this version of Building Tools is out of date
-- Check most recent version number
local AssetInfo = MarketplaceService:GetProductInfo(142785488, Enum.InfoType.Asset);
local LatestMajorVersion, LatestMinorVersion, LatestPatchVersion = AssetInfo.Description:match '%[Version: ([0-9]+)%.([0-9]+)%.([0-9]+)%]';
local CurrentMajorVersion, CurrentMinorVersion, CurrentPatchVersion = Tool.Version.Value:match '([0-9]+)%.([0-9]+)%.([0-9]+)';
-- Convert version data into numbers
local LatestMajorVersion, LatestMinorVersion, LatestPatchVersion =
tonumber(LatestMajorVersion), tonumber(LatestMinorVersion), tonumber(LatestPatchVersion);
local CurrentMajorVersion, CurrentMinorVersion, CurrentPatchVersion =
tonumber(CurrentMajorVersion), tonumber(CurrentMinorVersion), tonumber(CurrentPatchVersion);
-- Determine whether current version is outdated
if LatestMajorVersion > CurrentMajorVersion then
return true;
elseif LatestMajorVersion == CurrentMajorVersion then
if LatestMinorVersion > CurrentMinorVersion then
return true;
elseif LatestMinorVersion == CurrentMinorVersion then
return LatestPatchVersion > CurrentPatchVersion;
end;
end;
-- Return an up-to-date status if not oudated
return false;
end;
function ToggleSwitch(CurrentButtonName, SwitchContainer)
-- Toggles between the buttons in a switch
-- Reset all buttons
for _, Button in pairs(SwitchContainer:GetChildren()) do
-- Make sure to not mistake the option label for a button
if Button.Name ~= 'Label' then
-- Set appearance to disabled
Button.SelectedIndicator.BackgroundTransparency = 1;
Button.Background.Image = Assets.LightSlantedRectangle;
end;
end;
-- Make sure there's a new current button
if CurrentButtonName then
-- Get the current button
local CurrentButton = SwitchContainer[CurrentButtonName];
-- Set the current button's appearance to enabled
CurrentButton.SelectedIndicator.BackgroundTransparency = 0;
CurrentButton.Background.Image = Assets.DarkSlantedRectangle;
end;
end;
|
-- VIP SERVER OWNER
|
VipServerOwner = "NonAdmin";
|
-- if timenow >= dusk[1] and timenow <= dusk[2] then
| |
-- Quero um pouco de credito,plox :P --
-- FEITO 100% POR SCORPION --
-- Oficial Release 2.0 --
| |
--[[Drivetrain]]
|
Tune.Config = "RWD" --"FWD" , "RWD" , "AWD"
--Differential Settings
Tune.FDiffSlipThres = 50 -- 1 - 100% (Max threshold of applying full lock determined by deviation from avg speed)
Tune.FDiffLockThres = 50 -- 0 - 100% (0 - Bias toward slower wheel, 100 - Bias toward faster wheel)
Tune.RDiffSlipThres = 50 -- 1 - 100%
Tune.RDiffLockThres = 50 -- 0 - 100%
Tune.CDiffSlipThres = 50 -- 1 - 100% [AWD Only]
Tune.CDiffLockThres = 50 -- 0 - 100% [AWD Only]
--Traction Control Settings
Tune.TCSEnabled = true -- Implements TCS
Tune.TCSThreshold = 0 -- Slip speed allowed before TCS starts working (in SPS)
Tune.TCSGradient = 10 -- Slip speed gradient between 0 to max reduction (in SPS)
Tune.TCSLimit = 10 -- Minimum amount of torque at max reduction (in percent)
|
--| Main |--
|
Remote.PhongDev.OnServerEvent:Connect(function(LocalPlayer)
--| Clone |--
local Emit_VFX = Access.VFX.In_Transform.Emit_VFX:Clone()
Emit_VFX.Parent = LocalPlayer.Character.PrimaryPart
Debris:AddItem(Emit_VFX, 5)
local Emit_VFX2 = Access.VFX.In_Transform.Emit_VFX2:Clone()
Emit_VFX2.Parent = LocalPlayer.Character.PrimaryPart
Debris:AddItem(Emit_VFX2, 4)
local Enabled_VFX = Access.VFX.In_Transform.Enabled_VFX:Clone()
Enabled_VFX.Parent = LocalPlayer.Character.PrimaryPart
Debris:AddItem(Enabled_VFX, 4)
spawn(function()
for i,v in pairs(Enabled_VFX:GetChildren()) do
v.Enabled = true
end
end)
delay(0.2,function()
for i,v in pairs(Emit_VFX:GetChildren()) do
v:Emit(v:GetAttribute("EmitCount"))
end
wait(2.05)
for i,v in pairs(Emit_VFX2:GetChildren()) do
v:Emit(v:GetAttribute("EmitCount"))
end
end)
delay(2.05,function()
local Transform = Access.VFX.Transform:Clone()
Transform.Parent = LocalPlayer.Character.PrimaryPart
Debris:AddItem(Transform, 4)
local WeldPart = Instance.new("Weld", LocalPlayer.Character.PrimaryPart)
WeldPart.Part0 = LocalPlayer.Character.PrimaryPart
WeldPart.Part1 = Transform
WeldPart.C0 = WeldPart.Part0.CFrame:ToObjectSpace(WeldPart.Part1.CFrame * CFrame.new(0,0,0))
Debris:AddItem(WeldPart,4)
for i,v in pairs(Transform.Emit_VFX:GetChildren()) do
v:Emit(v:GetAttribute("EmitCount"))
end
wait(0.7)
Transform.Bone:Destroy()
for i,v in pairs(Transform.Enabled_VFX:GetChildren()) do
v.Enabled = false
end
end)
delay(4,function()
local Body = Access.VFX.Body.VFX:Clone()
Body.Parent = LocalPlayer.Character.PrimaryPart
Debris:AddItem(Body, Cooldown.Value)
wait(Cooldown.Value - 0.5)
for i,v in pairs(Body:GetChildren()) do
v.Enabled = false
end
end)
end)
|
--[=[
Constructs a new service.
:::caution
Services must be created _before_ calling `Knit.Start()`.
:::
```lua
-- Create a service
local MyService = Knit.CreateService {
Name = "MyService",
Client = {},
}
-- Expose a ToAllCaps remote function to the clients
function MyService.Client:ToAllCaps(player, msg)
return msg:upper()
end
-- Knit will call KnitStart after all services have been initialized
function MyService:KnitStart()
print("MyService started")
end
-- Knit will call KnitInit when Knit is first started
function MyService:KnitInit()
print("MyService initialize")
end
```
]=]
|
function KnitServer.CreateService(serviceDef: ServiceDef): Service
assert(type(serviceDef) == "table", "Service must be a table; got " .. type(serviceDef))
assert(type(serviceDef.Name) == "string", "Service.Name must be a string; got " .. type(serviceDef.Name))
assert(#serviceDef.Name > 0, "Service.Name must be a non-empty string")
assert(not DoesServiceExist(serviceDef.Name), "Service \"" .. serviceDef.Name .. "\" already exists")
local service = serviceDef
service.KnitComm = ServerComm.new(knitRepServiceFolder, serviceDef.Name)
if type(service.Client) ~= "table" then
service.Client = {Server = service}
else
if service.Client.Server ~= service then
service.Client.Server = service
end
end
services[service.Name] = service
return service
end
|
--[[ Imports ]]
|
local CameraUtils = require(script.Parent:WaitForChild("CameraUtils"))
|
-- ROBLOX TODO: ADO-1633 fix Jest Types imports
-- local Config = require(Packages.JestTypes).Config
|
type ConfigPath = string
local JestMatcherUtils = require(Packages.JestMatcherUtils)
local BOLD_WEIGHT = JestMatcherUtils.BOLD_WEIGHT
local EXPECTED_COLOR = JestMatcherUtils.EXPECTED_COLOR
|
--local function GetSameItem(instance)
-- for i,v in pairs(Main) do
-- if v==instance then
-- return v
-- end
-- end
--end
|
local function HideAllFrames()
for i,v in pairs(Main) do
v.Visible=false
end
end
local function ToggleVisibility(Element)
local vis=Element.Visible
HideAllFrames()
if vis==true then return end
if Element.Visible==true then
Element.Visible=false
elseif Element.Visible==false then
Element.Visible=true
end
end
for i,v in pairs(SettingsOpener:GetDescendants()) do
if v:IsA("GuiButton") then
local folder=v:FindFirstAncestorWhichIsA("Folder")
v.Activated:Connect(function()
ToggleVisibility(Main[folder])
end)
end
end
for i,v in pairs(ShopOpener:GetDescendants()) do
if v:IsA("GuiButton") then
local folder=v:FindFirstAncestorWhichIsA("Folder")
v.Activated:Connect(function()
ToggleVisibility(Main[folder])
end)
end
end
ToggleButton.Activated:Connect(function()
ToggleVisibility(ToggleButton)
for i,v in pairs(Main) do
if type(i)=="userdata" then
for s,a in pairs(i:GetDescendants()) do
if a:IsA("GuiButton") then
local vis=a.Visible
if vis==true then
a.Visible=false
elseif vis==false then
a.Visible=true
end
end
end
end
end
local caret=ToggleButton.Text
if caret=="<" then
ToggleButton.Text=">"
elseif caret==">" then
ToggleButton.Text="<"
end
HideAllFrames()
end)
|
-- Convenience function so that calling code does not have to first get the activeController
-- and then call GetMoveVector on it. When there is no active controller, this function returns the
-- zero vector
|
function ControlModule:GetMoveVector(): Vector3
if self.activeController then
return self.activeController:GetMoveVector()
end
return Vector3.new(0,0,0)
end
function ControlModule:GetActiveController()
return self.activeController
end
|
--[[
Stores 'sensible default' properties to be applied to instances created by
the New function.
]]
|
return {
ScreenGui = {
ResetOnSpawn = false,
ZIndexBehavior = "Sibling"
},
BillboardGui = {
ResetOnSpawn = false,
ZIndexBehavior = "Sibling"
},
SurfaceGui = {
ResetOnSpawn = false,
ZIndexBehavior = "Sibling",
SizingMode = "PixelsPerStud",
PixelsPerStud = 50
},
Frame = {
BackgroundColor3 = Color3.new(1, 1, 1),
BorderColor3 = Color3.new(0, 0, 0),
BorderSizePixel = 0
},
ScrollingFrame = {
BackgroundColor3 = Color3.new(1, 1, 1),
BorderColor3 = Color3.new(0, 0, 0),
BorderSizePixel = 0,
ScrollBarImageColor3 = Color3.new(0, 0, 0)
},
TextLabel = {
BackgroundColor3 = Color3.new(1, 1, 1),
BorderColor3 = Color3.new(0, 0, 0),
BorderSizePixel = 0,
Font = "SourceSans",
Text = "",
TextColor3 = Color3.new(0, 0, 0),
TextSize = 14
},
TextButton = {
BackgroundColor3 = Color3.new(1, 1, 1),
BorderColor3 = Color3.new(0, 0, 0),
BorderSizePixel = 0,
AutoButtonColor = false,
Font = "SourceSans",
Text = "",
TextColor3 = Color3.new(0, 0, 0),
TextSize = 14
},
TextBox = {
BackgroundColor3 = Color3.new(1, 1, 1),
BorderColor3 = Color3.new(0, 0, 0),
BorderSizePixel = 0,
ClearTextOnFocus = false,
Font = "SourceSans",
Text = "",
TextColor3 = Color3.new(0, 0, 0),
TextSize = 14
},
ImageLabel = {
BackgroundColor3 = Color3.new(1, 1, 1),
BorderColor3 = Color3.new(0, 0, 0),
BorderSizePixel = 0
},
ImageButton = {
BackgroundColor3 = Color3.new(1, 1, 1),
BorderColor3 = Color3.new(0, 0, 0),
BorderSizePixel = 0,
AutoButtonColor = false
},
ViewportFrame = {
BackgroundColor3 = Color3.new(1, 1, 1),
BorderColor3 = Color3.new(0, 0, 0),
BorderSizePixel = 0
},
VideoFrame = {
BackgroundColor3 = Color3.new(1, 1, 1),
BorderColor3 = Color3.new(0, 0, 0),
BorderSizePixel = 0
}
}
|
-- print(sound.Volume)
-- sound.Name = "impact sound"
-- sound.SoundGroup = game.SoundService.SoundGroup
|
sound:Play()
game.Debris:AddItem(sound, sound.TimeLength)
end
end)
while wait() do
velocity = script.Parent.Velocity.magnitude
local ray = Ray.new(script.Parent.Position, Vector3.new(0, -3, 0))
local hit, p = game.Workspace:FindPartOnRay(ray, script.Parent.Parent)
if hit then
else
air = true
impact = false
end
end
|
-- Me Command will only be effective when this set to true
|
module.ShowUserOwnFilteredMessage = true --Show a user the filtered version of their message rather than the original.
|
--[[ ALL STARTERGUI FUNCTIONS ]]
|
--
local StarterGui = game.StarterGui
|
--[[**
ensures Lua primitive string type
@param value The value to check against
@returns True iff the condition is satisfied, false otherwise
**--]]
|
t.string = primitive("string")
|
--[[Wheel Configuration]]
|
--Store Reference Orientation Function
function getParts(model,t,a)
for i,v in pairs(model:GetChildren()) do
if v:IsA("BasePart") then table.insert(t,{v,a.CFrame:toObjectSpace(v.CFrame)})
elseif v:IsA("Model") then getParts(v,t,a)
end
end
end
--PGS/Legacy
local fDensity = _Tune.FWheelDensity
local rDensity = _Tune.RWheelDensity
if not PGS_ON then
fDensity = _Tune.FWLgcyDensity
rDensity = _Tune.RWLgcyDensity
end
local fDistX=_Tune.FWsBoneLen*math.cos(math.rad(_Tune.FWsBoneAngle))
local fDistY=_Tune.FWsBoneLen*math.sin(math.rad(_Tune.FWsBoneAngle))
local rDistX=_Tune.RWsBoneLen*math.cos(math.rad(_Tune.RWsBoneAngle))
local rDistY=_Tune.RWsBoneLen*math.sin(math.rad(_Tune.RWsBoneAngle))
local fSLX=_Tune.FSusLength*math.cos(math.rad(_Tune.FSusAngle))
local fSLY=_Tune.FSusLength*math.sin(math.rad(_Tune.FSusAngle))
local rSLX=_Tune.RSusLength*math.cos(math.rad(_Tune.RSusAngle))
local rSLY=_Tune.RSusLength*math.sin(math.rad(_Tune.RSusAngle))
for _,v in pairs(Drive) do
--Apply Wheel Density
if v.Name=="FL" or v.Name=="FR" or v.Name=="F" then
if v:IsA("BasePart") then
if v.CustomPhysicalProperties == nil then v.CustomPhysicalProperties = PhysicalProperties.new(v.Material) end
v.CustomPhysicalProperties = PhysicalProperties.new(
fDensity,
v.CustomPhysicalProperties.Friction,
v.CustomPhysicalProperties.Elasticity,
v.CustomPhysicalProperties.FrictionWeight,
v.CustomPhysicalProperties.ElasticityWeight
)
end
else
if v:IsA("BasePart") then
if v.CustomPhysicalProperties == nil then v.CustomPhysicalProperties = PhysicalProperties.new(v.Material) end
v.CustomPhysicalProperties = PhysicalProperties.new(
rDensity,
v.CustomPhysicalProperties.Friction,
v.CustomPhysicalProperties.Elasticity,
v.CustomPhysicalProperties.FrictionWeight,
v.CustomPhysicalProperties.ElasticityWeight
)
end
end
--Resurface Wheels
for _,a in pairs({"Top","Bottom","Left","Right","Front","Back"}) do
v[a.."Surface"]=Enum.SurfaceType.SmoothNoOutlines
end
--Store Axle-Anchored/Suspension-Anchored Part Orientation
local WParts = {}
local tPos = v.Position-car.Body.CarName.Value.VehicleSeat.Position
if v.Name=="FL" or v.Name=="RL" then
v.CFrame = car.Body.CarName.Value.VehicleSeat.CFrame*CFrame.Angles(math.rad(90),0,math.rad(90))
else
v.CFrame = car.Body.CarName.Value.VehicleSeat.CFrame*CFrame.Angles(math.rad(90),0,math.rad(-90))
end
v.CFrame = v.CFrame+tPos
if v:FindFirstChild("Parts")~=nil then
getParts(v.Parts,WParts,v)
end
if v:FindFirstChild("Fixed")~=nil then
getParts(v.Fixed,WParts,v)
end
--Align Wheels
if v.Name=="FL" or v.Name=="FR" then
v.CFrame = v.CFrame*CFrame.Angles(math.rad(_Tune.FCamber),0,0)
if v.Name=="FL" then
v.CFrame = v.CFrame*CFrame.Angles(0,0,math.rad(_Tune.FToe))
else
v.CFrame = v.CFrame*CFrame.Angles(0,0,math.rad(-_Tune.FToe))
end
elseif v.Name=="RL" or v.Name=="RR" then
v.CFrame = v.CFrame*CFrame.Angles(math.rad(_Tune.RCamber),0,0)
if v.Name=="RL" then
v.CFrame = v.CFrame*CFrame.Angles(0,0,math.rad(_Tune.RToe))
else
v.CFrame = v.CFrame*CFrame.Angles(0,0,math.rad(-_Tune.RToe))
end
end
--Re-orient Axle-Anchored/Suspension-Anchored Parts
for _,a in pairs(WParts) do
a[1].CFrame=v.CFrame:toWorldSpace(a[2])
end
|
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- API
|
ModuleAPI = {}
c = workspace.CurrentCamera
player = game.Players.LocalPlayer
rs = game:GetService("RunService")
function checkArgs(...)
-- Generic Function for checking if arguments exist / are the correct type.
local args = {...}
local function useVowel(name)
local vowels = {"a","e","i","o","u"}
for _,v in pairs(vowels) do
if string.sub(string.lower(name),1,1) == v then
return true
end
end
return false
end
for i = 1,#args,2 do
local s = "Argument "..(i/2+.5)
local var,f = args[i], args[i+1]
if var == nil then
return error(s.." missing or nil")
end
local vt = type(var)
if type(f) == "function" then
local r,t = f(var)
if not r then
return error(s.." should be a"..(useVowel(t) and "n" or "").." "..t.." (not a"..(useVowel(vt) and "n" or "")..": "..vt..")")
end
elseif vt ~= f then
return error(s.." should be a"..(useVowel(f) and "n" or "").." "..f.." (not a"..(useVowel(vt) and "n" or "")..": "..vt..")")
end
end
end
function ModuleAPI:GetScreenResolution()
local mouse = player:GetMouse()
if mouse then
if mouse.ViewSizeX > 0 and mouse.ViewSizeY > 0 then
return Vector2.new(mouse.ViewSizeX,mouse.ViewSizeY)
end
end
if player.PlayerGui then
local screenGui
for _,v in pairs(player.PlayerGui:GetChildren()) do
if v:IsA("ScreenGui") then
screenGui = v
end
end
if not screenGui then -- Not sure if this is possible assuming the scenario. But you never know.
screenGui = Instance.new("ScreenGui",player.PlayerGui)
wait(.1) -- Wait just a moment for the property to get set.
end
return screenGui.AbsoluteSize
end
return error("ERROR: Can't get client resolution")
end
function ModuleAPI:PointToScreenSpace(at)
checkArgs(at,function(v)
local is = pcall(function () return p.X,p.Y,p.Z end)
return is or false,"Vector3"
end)
local resolution = ModuleAPI:GetScreenResolution()
local point = c.CoordinateFrame:pointToObjectSpace(at)
local aspectRatio = resolution.X / resolution.Y
local hfactor = math.tan(math.rad(c.FieldOfView)/2)
local wfactor = aspectRatio*hfactor
local x = (point.x/point.z) / -wfactor
local y = (point.y/point.z) / hfactor
return Vector2.new(resolution.X*(0.5 + 0.5*x), resolution.Y*(0.5 + 0.5*y))
end
function ModuleAPI:ScreenSpaceToWorld(x, y, depth)
checkArgs(x,"number",y,"number",depth,"number")
local resolution = ModuleAPI:GetScreenResolution()
local aspectRatio = resolution.X / resolution.Y
local hfactor = math.tan(math.rad(c.FieldOfView)/2)
local wfactor = aspectRatio*hfactor
local xf, yf = x/resolution.X*2 - 1, y/resolution.Y*2 - 1
local xpos = xf * -wfactor * depth
local ypos = yf * hfactor * depth
return Vector3.new(xpos, ypos, depth)
end
function ModuleAPI:GetDepthForWidth(partWidth, visibleSize)
checkArgs(partWidth,"number",visibleSize,"number")
local resolution = ModuleAPI:GetScreenResolution()
local aspectRatio = resolution.X / resolution.Y
local hfactor = math.tan(math.rad(c.FieldOfView)/2)
local wfactor = aspectRatio*hfactor
return (-0.5*resolution.X*partWidth/(visibleSize*wfactor))
end
function ModuleAPI:Attach3D(guiObj,model)
checkArgs(
guiObj,function (v)
return guiObj:IsA("GuiObject") or false,"GuiObject"
end,
model,function (v)
return (model:IsA("Model") or model:IsA("BasePart")) or false,"Model or BasePart"
end
)
local index = {}
local m = Instance.new("Model")
m.Name = ""
m.Parent = c
objs = {}
if model:IsA("BasePart") then
local this = model:clone()
this.Parent = m
table.insert(objs,this)
else
local function recurse(obj)
for _,v in pairs(obj:GetChildren()) do
local part
if v:IsA("BasePart") then
part = v:clone()
elseif v:IsA("Hat") and v:findFirstChild("Handle") then
part = v.Handle:clone()
end
if part then
local cf = part.CFrame
part.Anchored = false
part.Parent = m
part.CFrame = cf
if part:findFirstChild("Decal") and part.Transparency ~= 0 then
part:Destroy()
elseif part.Name == "Head" then
part.Name = "H"
end
if part.Parent == m then
table.insert(objs,part)
end
elseif not v:IsA("Model") and not v:IsA("Sound") and not v:IsA("Script") then
v:clone().Parent = m
else
recurse(v)
end
end
end
recurse(model)
end
local primary = Instance.new("Part")
primary.Anchored = true
primary.Transparency = 1
primary.CanCollide = false
primary.Name = "MODEL_CENTER"
primary.FormFactor = "Custom"
primary.Size = m:GetExtentsSize()
primary.CFrame = CFrame.new(m:GetModelCFrame().p)
primary.Parent = m
m.PrimaryPart = primary
for _,v in pairs(objs) do
v.Anchored = false
v.CanCollide = false
v.Archivable = true
local w = Instance.new("Weld",primary)
w.Part0 = primary
w.Part1 = v
local CJ = CFrame.new(primary.Position)
w.C0 = primary.CFrame:inverse()*CJ
w.C1 = v.CFrame:inverse()*CJ
v.Parent = m
end
CF = CFrame.new(0, 0, 0, -1, 0, -8.74227766e-008, 0, 1, 0, 8.74227766e-008, 0, -1)
Active = false
DistOffset = 0
function index:SetActive(b)
checkArgs(b,"boolean")
Active = b
end
function index:SetCFrame(cf)
checkArgs(cf,function ()
local isCFrame = pcall(function () return cf:components() end)
return isCFrame or false,"CFrame"
end)
CF = cf
end
local function updateModel()
primary.Anchored = false
if Active then
local posZ = ModuleAPI:GetDepthForWidth(primary.Size.magnitude, guiObj.AbsoluteSize.Y)
local sizeX,sizeY = guiObj.AbsoluteSize.X,guiObj.AbsoluteSize.Y
local posX,posY = guiObj.AbsolutePosition.X+(sizeX/2),guiObj.AbsolutePosition.Y+(sizeY/2)
local pos = ModuleAPI:ScreenSpaceToWorld(posX,posY,posZ)
local location = c.CoordinateFrame * CFrame.new(pos.X, pos.Y, posZ)
primary.CFrame = location * CF
else
primary.CFrame = CFrame.new()
end
primary.Anchored = true
end
local con = rs.RenderStepped:connect(updateModel)
function index:End()
con:disconnect()
pcall(function ()
m:Destroy()
end)
return
end
index.Object3D = m
return index
end
function ModuleAPI:AdornScreenGuiToWorld(screenGui,screenStudDepth)
checkArgs(screenGui,function (v)
return (screenGui:IsA("ScreenGui") or screenGui:IsA("BillboardGui")) or false,"ScreenGui or BillboardGui"
end)
local screenStudWidth = type(screenStudWidth) == "number" and screenStudWidth or 1
local s = Instance.new("BillboardGui",screenGui.Parent)
s.Name = screenGui.Name
local adorn = Instance.new("Part",s)
adorn.Name = screenGui.Name.."_Adornee"
adorn.FormFactor = "Custom"
adorn.Anchored = true
adorn.CanCollide = false
adorn.Size = Vector3.new()
adorn.Transparency = 1
adorn.Locked = true
local con
local modifier = {}
function modifier:SetScreenStudWidth(n)
checkArgs(n,"number")
screenStudWidth = n
end
function modifier:Reset()
screenGui.Parent = s.Parent
for _,v in pairs(s:GetChildren()) do
v.Parent = screenGui
end
con:disconnect()
adorn:Destroy()
s:Destroy()
end
local function updateAdorn()
local success,did = pcall(function ()
local res = ModuleAPI:GetScreenResolution()
adorn.CFrame = c.CoordinateFrame
s.Size = UDim2.new(0,res.X,0,res.Y)
s.StudsOffset = Vector3.new(0,0,-screenStudDepth)
return true
end)
if not success or not did then
warn(script:GetFullName()..": The adornee was destroyed! The gui has been reset.")
modifier:Reset()
end
end
con = rs.RenderStepped:connect(updateAdorn)
s.Adornee = adorn
for _,v in pairs(screenGui:GetChildren()) do
v.Parent = s
end
screenGui.Parent = nil
return modifier
end
return ModuleAPI
|
---------------------------------------------------------------------------
|
script.Parent.Humanoid.HealthChanged:Connect(function()
if script.Parent.Humanoid.Health <= 85 then
Instance.new("Decal", script.Parent["Right Leg"])
script.Parent["Right Leg"].Decal.Texture = "rbxassetid://508050982"
script.Parent["Right Leg"].Decal.Face = Region3int16
end
end)
|
-- Create an Attachment in the terrain so the AlignOrientation is world realtive
|
local worldAttachment = Instance.new("Attachment")
worldAttachment.Name = "SoldierWorldAttachment"
worldAttachment.Parent = Workspace.Terrain
maid.worldAttachment = worldAttachment
maid.humanoidRootPart.AlignOrientation.Attachment1 = worldAttachment
|
--[[Weight and CG]]
|
Tune.Weight = 0 -- Total weight (in pounds)
Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable)
--[[Width]] 6 ,
--[[Height]] 3.5 ,
--[[Length]] 14 }
Tune.WeightDist = 50 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
Tune.CGHeight = .8 -- Center of gravity height (studs relative to median of all wheels)
Tune.WBVisible = false -- Makes the weight brick visible
--Unsprung Weight
Tune.FWheelDensity = 1.5 -- Front Wheel Density
Tune.RWheelDensity = 1.5 -- Rear Wheel Density
Tune.FWLgcyDensity = 1.5 -- Front Wheel Density [PGS OFF]
Tune.RWLgcyDensity = 1.5 -- Rear Wheel Density [PGS OFF]
Tune.AxleSize = 2 -- Size of structural members (larger = more stable/carry more weight)
Tune.AxleDensity = .1 -- Density of structural members
|
--Right lean Multiplier
|
ZR15RightLegRightLeanM = 1
XR15RightLegRightLeanM = 1
YR15RightLegRightLeanM = 1
R15RightKneeRightLeanM = 1
ZR15RightArmRightLeanM = 1
XR15RightArmRightLeanM = 1
YR15RightArmRightLeanM = 1
R15RightElbowRightLeanM = 1
ZR15LeftLegRightLeanM = 1
XR15LeftLegRightLeanM = 1
YR15LeftLegRightLeanM = 1
R15LeftKneeRightLeanM = 1
ZR15LeftArmRightLeanM = 1
XR15LeftArmRightLeanM = 1
YR15LeftArmRightLeanM = 1
R15LeftElbowRightLeanM = 1
ZR15LowerTorsoRightLeanM = 1
XR15LowerTorsoRightLeanM = 1
YR15LowerTorsoRightLeanM = 1
ZR15UpperTorsoRightLeanM = 1
|
--------RIGHT DOOR --------
|
game.Workspace.doorright.l11.BrickColor = BrickColor.new(1023)
game.Workspace.doorright.l23.BrickColor = BrickColor.new(1023)
game.Workspace.doorright.l32.BrickColor = BrickColor.new(1023)
game.Workspace.doorright.l41.BrickColor = BrickColor.new(1023)
game.Workspace.doorright.l53.BrickColor = BrickColor.new(1023)
game.Workspace.doorright.l62.BrickColor = BrickColor.new(1023)
game.Workspace.doorright.l71.BrickColor = BrickColor.new(1023)
game.Workspace.doorright.l12.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l21.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l33.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l42.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l51.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l63.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l72.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l13.BrickColor = BrickColor.new(1013)
game.Workspace.doorright.l22.BrickColor = BrickColor.new(1013)
game.Workspace.doorright.l31.BrickColor = BrickColor.new(1013)
game.Workspace.doorright.l43.BrickColor = BrickColor.new(1013)
game.Workspace.doorright.l52.BrickColor = BrickColor.new(1013)
game.Workspace.doorright.l61.BrickColor = BrickColor.new(1013)
game.Workspace.doorright.l73.BrickColor = BrickColor.new(1013)
game.Workspace.doorright.pillar.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
|
-- In radians the minimum accuracy penalty
|
local MinSpread = 0.05
|
--[=[
Returns jittered value at the average value, with the spread being
random.
@param average number
@param spread number
@param randomValue number?
@return number
]=]
|
function Math.jitter(average: number, spread: number, randomValue)
randomValue = randomValue or math.random()
return average - 0.5*spread + randomValue*spread
end
|
-- Returns a character ancestor and its Humanoid, or nil
|
function UTIL.FindCharacterAncestor(subject)
if subject and subject ~= workspace then
local humanoid = subject:FindFirstChild('Humanoid')
if humanoid then
return subject, humanoid
else
return UTIL.FindCharacterAncestor(subject.Parent)
end
end
return nil
end
UTIL.AssetURL = 'http://www.roblox.com/asset/?id='
UTIL.TouchEnabled = game:GetService("UserInputService").TouchEnabled
do
local suceeded,_ =pcall(function() workspace.CurrentCamera:GetPanSpeed() end)
UTIL.CanCheckPanSpeed = suceeded
end
local DebrisService = game:GetService('Debris')
local DebugPrintOffset = 0
function UTIL.Dprint(...)
local line = ''
for _, segment in pairs({...}) do
line = line .. (line and ' ' or '') .. tostring(segment)
end
local gui = Instance.new('ScreenGui')
local label = Instance.new('TextLabel')
label.Text = line
label.Size = UDim2.new(0.25, 0, 0.05, 0)
label.BackgroundTransparency = 0.5
label.Position = UDim2.new(0, 0, 0, DebugPrintOffset)
label.TextWrapped = true
label.Parent = gui
DebrisService:AddItem(gui, 30)
gui.Parent = script.Parent
DebugPrintOffset = (DebugPrintOffset <= 600) and DebugPrintOffset + 30 or 0
end
WeldUtil = {}
do
function WeldUtil.WeldBetween(a, b)
local weld = Instance.new("Weld")
weld.Part0 = a
weld.Part1 = b
weld.C0 = CFrame.new()
weld.C1 = b.CFrame:inverse() * a.CFrame
weld.Parent = a
return weld
end
function WeldUtil:PermaWeld(weld)
local OriginalParent = weld.Parent
weld.Changed:Connect(function()
delay(0,function() weld.Parent = OriginalParent end)
end)
end
end
local InternalEvent =
{
Listeners = nil,
}
do
UTIL.MakeClass(InternalEvent)
function InternalEvent:Connect(func)
if not self.Listeners then self.Listeners = {} end
table.insert(self.Listeners,func)
end
function InternalEvent:Fire(...)
if not self.Listeners then return end
local args = {...}
for _,i in ipairs(self.Listeners) do
spawn(function() i(unpack(args)) end)
end
end
end
|
-- Buttons --
|
local myaccbtn = script.Parent.buttons_holder.Account
local depbtn = script.Parent.buttons_holder.Deposit
local wthbtn = script.Parent.buttons_holder.Withdraw
local trnbtn = script.Parent.buttons_holder.Transfer
local cshbtn = script.Parent.buttons_holder.Cash
|
-- Public Virtual
-- This function ticks every frame when the state is active
|
function BaseState:Tick(currentTime,dt,stateTime)
end
|
-- ROBLOX MOVED: expect/jasmineUtils.lua
|
local function hasKey(obj: any, key: string)
return rawget(obj, key) ~= nil
end
|
-- ROBLOX TODO END
|
function exports.supportsLookbehinds()
-- ROBLOX CHECK: do we suppoert lookbehind in Lua?
-- ROBLOX deviation: no equivalent check in Lua. Returning always false
return false
end
function exports.isWindows(options: Object?): boolean
if typeof(options) == "table" and typeof(options.windows) == "boolean" then
return options.windows
end
--[[
ROBLOX deviation: not using path.sep as it's not available
original code:
return win32 === true || path.sep === '\\';
]]
return win32 == true
end
function exports.escapeLast(input: string, char: string, lastIdx: number?)
local idx = String.lastIndexOf(input, char, lastIdx)
if idx == -1 then
return input
end
if input:sub(idx - 1, idx - 1) == "\\" then
return exports.escapeLast(input, char, idx - 1)
end
return ("%s%s"):format(String.slice(input, 1, idx), String.slice(input, idx))
end
function exports.removePrefix(input: string, state_: Object?)
local state: Object = state_ or {}
local output = input
if String.startsWith(output, "./") then
output = String.slice(output, 3)
state.prefix = "./"
end
return output
end
function exports.wrapOutput(input, state_: Object?, options_: Object?)
local state: Object = state_ or {}
local options: Object = options_ or {}
local prepend = if Boolean.toJSBoolean(options.contains) then "" else "^"
local append = if Boolean.toJSBoolean(options.contains) then "" else "$"
local output = ("%s(?:%s)%s"):format(prepend, input, append)
if state.negated == true then
output = ("(?:^(?!%s).*$)"):format(output)
end
return output
end
return exports
|
--[[
Is the given object a Promise instance?
]]
|
function Promise.is(object)
if type(object) ~= "table" then
return false
end
local objectMetatable = getmetatable(object)
if objectMetatable == Promise then
-- The Promise came from this library.
return true
elseif objectMetatable == nil then
-- No metatable, but we should still chain onto tables with andThen methods
return type(object.andThen) == "function"
elseif
type(objectMetatable) == "table"
and type(rawget(objectMetatable, "__index")) == "table"
and type(rawget(rawget(objectMetatable, "__index"), "andThen")) == "function"
then
-- Maybe this came from a different or older Promise library.
return true
end
return false
end
|
-- 4.) Put 'Gauge Face' in Lights in-order for it to light-up when car
-- lights are turned on. If not available, place 'Gauge Face' in Body along with 'Speedometer'.
| |
--[[
Better don't change anything. This script is WIP v.0.3
This thing still glitchy still needs improvement
GetNear sound doesn't work yet comming soon in next version
Features: Flash and boom sound whem rake found you, Rake theme stop whem rake stunning, Rake theme get higher pitch whem rake get more near, Night themes, Screen shake
Don't edit pass this line you may break the whole script ]]
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
|
function StartSound()
NightTheme:Pause()
FlashEffect.BackgroundTransparency = 0.6
ScreenShake.Disabled = false
FlashEffect.BackgroundTransparency = 1
RakeTheme:Play()
HeartTheme:Play()
end
function StopSound()
ScreenShake.Disabled = true
FlashEffect.BackgroundTransparency = 1
RakeTheme:Stop()
HeartTheme:Stop()
NightTheme:Play()
game.Workspace.CurrentCamera.FieldOfView = 70
end
function UpdateNightThemeID()
local RandomNTIDS = math.random(1,#NightThemeIDS)
local ChosenNTID = NightThemeIDS[RandomNTIDS]
|
--------END AUDIENCE BACK RIGHT--------
|
game.Workspace.rightpalette.l11.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.rightpalette.l12.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.rightpalette.l21.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.rightpalette.l22.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.post1.Light.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.post2.Light.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
wait(0.15)
|
-- @outline // PRIVATE METHODS
|
function GetPlayer(Value)
if type(Value) == "userdata" then
return Value
elseif type(Value) == "table" then
return Value.Instance
end
end
|
--[[**
ensures value is an array of a strict makeup and size
@param check The check to compare all values with
@returns A function that will return true iff the condition is passed
**--]]
|
function t.strictArray(...)
local valueTypes = { ... }
assert(t.array(t.callback)(valueTypes))
return function(value)
local keySuccess, keyErrMsg = arrayKeysCheck(value)
if keySuccess == false then
return false, string.format("[strictArray] %s", keyErrMsg or "")
end
-- If there's more than the set array size, disallow
if #valueTypes < #value then
return false, string.format("[strictArray] Array size exceeds limit of %d", #valueTypes)
end
for idx, typeFn in pairs(valueTypes) do
local typeSuccess, typeErrMsg = typeFn(value[idx])
if not typeSuccess then
return false, string.format("[strictArray] Array index #%d - %s", idx, typeErrMsg)
end
end
return true
end
end
end
do
local callbackArray = t.array(t.callback)
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]]
|
local FE = workspace.FilteringEnabled
local car = script.Parent.Car.Value
local _Tune = require(car["A-Chassis Tune"])
local on = 0
script:WaitForChild("Rev")
if not FE then
for i,v in pairs(car.DriveSeat:GetChildren()) do
for _,a in pairs(script:GetChildren()) do
if v.Name==a.Name then v:Stop() wait() v:Destroy() end
end
end
for i,v in pairs(script:GetChildren()) do
v.Parent=car.DriveSeat
end
car.DriveSeat.Rev:Play()
while wait() do
local _RPM = script.Parent.Values.RPM.Value
if not script.Parent.IsOn.Value then on=math.max(on-.015,0) else on=1 end
car.DriveSeat.Rev.Pitch = (car.DriveSeat.Rev.SetPitch.Value + car.DriveSeat.Rev.SetRev.Value*_RPM/_Tune.PeakRPM)*on^2
end
else
local handler = car.AC6_FE_Sounds
handler:FireServer("newSound","Rev",car.DriveSeat,script.Rev.SoundId,0,script.Rev.Volume,true)
handler:FireServer("playSound","Rev")
local pitch=0
while wait() do
local _RPM = script.Parent.Values.RPM.Value
if not script.Parent.IsOn.Value then on=math.max(on-.015,0) else on=1 end
pitch = (script.Rev.SetPitch.Value + script.Rev.SetRev.Value*_RPM/_Tune.PeakRPM)*on^2
handler:FireServer("updateSound","Rev",script.Rev.SoundId,pitch,script.Rev.Volume)
end
end
|
--//When a player joins the game
|
players.PlayerAdded:Connect(function(player)
local teamColor = player.TeamColor
player.CharacterAdded:Connect(function(character)
local humanoid = character:WaitForChild("Humanoid", 60)
humanoid.Died:Connect(function()
FindKiller(teamColor, humanoid)
end)
end)
end)
|
--[[
Package link auto-generated by Rotriever
]]
|
local PackageIndex = script.Parent.Parent.Parent._Index
local Package = require(PackageIndex["JestUtil"]["JestUtil"])
export type ErrorWithStack = Package.ErrorWithStack
return Package
|
-- Handle command invocations from the clients.
|
Cmdr.RemoteFunction.OnServerInvoke = function (player, text, options)
return Cmdr.Dispatcher:EvaluateAndRun(text, player, options)
end
return Cmdr
|
--[=[
Converts a Signal into an observable.
https://rxjs-dev.firebaseapp.com/api/index/function/fromEvent
@param event Signal<T>
@return Observable<T>
]=]
|
function Rx.fromSignal(event)
return Observable.new(function(sub)
-- This stream never completes or fails!
return event:Connect(function(...)
sub:Fire(...)
end)
end)
end
|
-- ====================
-- BASIC
-- A basic settings for the gun
-- ====================
|
Auto = true;
MuzzleOffset = Vector3.new(0, 0.625, 1.25);
BaseDamage = 40;
FireRate = 0.08; --In second
ReloadTime = 2; --In second
AmmoPerClip = 20; --Put "math.huge" to make this gun has infinite ammo and never reload
Spread = 1.25; --In degree
HeadshotEnabled = true; --Enable the gun to do extra damage on headshot
HeadshotDamageMultiplier = 1.5;
MouseIconID = "316279304";
HitSoundIDs = {186809061,186809249,186809250,186809252};
IdleAnimationID = 94331086; --Set to "nil" if you don't want to animate
IdleAnimationSpeed = 1;
FireAnimationID = 94332152; --Set to "nil" if you don't want to animate
FireAnimationSpeed = 6;
ReloadAnimationID = nil; --Set to "nil" if you don't want to animate
ReloadAnimationSpeed = 1;
|
-- Set up the event handler for the GClippsly button
|
aFinderButton.MouseButton1Click:Connect(toggleWindow)
|
--------------------) Settings
|
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 5 -- cooldown for use of the tool again
ZoneModelName = "Car bomb" -- name the zone model
MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage
|
--// All global vars will be wiped/replaced except script
|
return function(data)
local playergui = service.PlayerGui
local localplayer = service.Players.LocalPlayer
local scr = client.UI.Prepare(script.Parent.Parent)
local main = scr.Main
local t1 = main.Title
local t2 = main.Message
local msg = data.Message
local color = data.Color
local found = client.UI.Get("Output")
if found then
for i,v in pairs(found) do
local p = v.Object
if p and p.Parent then
p.Main.Position = UDim2.new(0, 0, 0.35, p.Main.Position.Y.Offset+50)
end
end
end
t2.Text = msg
t2.Font = "Arial"
--t2.Position = UDim2.new(0, 0, 0.35, 0)
gTable.Ready()
wait(5)
gTable.Destroy()
end
|
-- functions
|
function stopAllAnimations()
local oldAnim = currentAnim
-- return to idle if finishing an emote
if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
oldAnim = "idle"
end
if currentlyPlayingEmote then
oldAnim = "idle"
currentlyPlayingEmote = false
end
currentAnim = ""
currentAnimInstance = nil
if (currentAnimKeyframeHandler ~= nil) then
currentAnimKeyframeHandler:disconnect()
end
if (currentAnimTrack ~= nil) then
currentAnimTrack:Stop()
currentAnimTrack:Destroy()
currentAnimTrack = nil
end
-- clean up walk if there is one
if (runAnimKeyframeHandler ~= nil) then
runAnimKeyframeHandler:disconnect()
end
if (runAnimTrack ~= nil) then
runAnimTrack:Stop()
runAnimTrack:Destroy()
runAnimTrack = nil
end
return oldAnim
end
function getHeightScale()
if Humanoid then
if not Humanoid.AutomaticScalingEnabled then
-- When auto scaling is not enabled, the rig scale stands in for
-- a computed scale.
return getRigScale()
end
local scale = Humanoid.HipHeight / HumanoidHipHeight
if AnimationSpeedDampeningObject == nil then
AnimationSpeedDampeningObject = script:FindFirstChild("ScaleDampeningPercent")
end
if AnimationSpeedDampeningObject ~= nil then
scale = 1 + (Humanoid.HipHeight - HumanoidHipHeight) * AnimationSpeedDampeningObject.Value / HumanoidHipHeight
end
return scale
end
return getRigScale()
end
local function rootMotionCompensation(speed)
local speedScaled = speed * 1.25
local heightScale = getHeightScale()
local runSpeed = speedScaled / heightScale
return runSpeed
end
local smallButNotZero = 0.0001
local function setRunSpeed(speed)
local normalizedWalkSpeed = 0.5 -- established empirically using current `913402848` walk animation
local normalizedRunSpeed = 1
local runSpeed = rootMotionCompensation(speed)
local walkAnimationWeight = smallButNotZero
local runAnimationWeight = smallButNotZero
local walkAnimationTimewarp = runSpeed/normalizedWalkSpeed
local runAnimationTimerwarp = runSpeed/normalizedRunSpeed
if runSpeed <= normalizedWalkSpeed then
walkAnimationWeight = 1
elseif runSpeed < normalizedRunSpeed then
local fadeInRun = (runSpeed - normalizedWalkSpeed)/(normalizedRunSpeed - normalizedWalkSpeed)
walkAnimationWeight = 1 - fadeInRun
runAnimationWeight = fadeInRun
walkAnimationTimewarp = 1
runAnimationTimerwarp = 1
else
runAnimationWeight = 1
end
currentAnimTrack:AdjustWeight(walkAnimationWeight)
runAnimTrack:AdjustWeight(runAnimationWeight)
currentAnimTrack:AdjustSpeed(walkAnimationTimewarp)
runAnimTrack:AdjustSpeed(runAnimationTimerwarp)
end
function setAnimationSpeed(speed)
if currentAnim == "walk" then
setRunSpeed(speed)
else
if speed ~= currentAnimSpeed then
currentAnimSpeed = speed
currentAnimTrack:AdjustSpeed(currentAnimSpeed)
end
end
end
function keyFrameReachedFunc(frameName)
if (frameName == "End") then
if currentAnim == "walk" then
if userNoUpdateOnLoop == true then
if runAnimTrack.Looped ~= true then
runAnimTrack.TimePosition = 0.0
end
if currentAnimTrack.Looped ~= true then
currentAnimTrack.TimePosition = 0.0
end
else
runAnimTrack.TimePosition = 0.0
currentAnimTrack.TimePosition = 0.0
end
else
local repeatAnim = currentAnim
-- return to idle if finishing an emote
if (emoteNames[repeatAnim] ~= nil and emoteNames[repeatAnim] == false) then
repeatAnim = "idle"
end
if currentlyPlayingEmote then
if currentAnimTrack.Looped then
-- Allow the emote to loop
return
end
repeatAnim = "idle"
currentlyPlayingEmote = false
end
local animSpeed = currentAnimSpeed
playAnimation(repeatAnim, 0.15, Humanoid)
setAnimationSpeed(animSpeed)
end
end
end
function rollAnimation(animName)
local roll = math.random(1, animTable[animName].totalWeight)
local origRoll = roll
local idx = 1
while (roll > animTable[animName][idx].weight) do
roll = roll - animTable[animName][idx].weight
idx = idx + 1
end
return idx
end
local function switchToAnim(anim, animName, transitionTime, humanoid)
-- switch animation
if (anim ~= currentAnimInstance) then
if (currentAnimTrack ~= nil) then
currentAnimTrack:Stop(transitionTime)
currentAnimTrack:Destroy()
end
if (runAnimTrack ~= nil) then
runAnimTrack:Stop(transitionTime)
runAnimTrack:Destroy()
if userNoUpdateOnLoop == true then
runAnimTrack = nil
end
end
currentAnimSpeed = 1.0
-- load it to the humanoid; get AnimationTrack
currentAnimTrack = humanoid:LoadAnimation(anim)
currentAnimTrack.Priority = Enum.AnimationPriority.Core
-- play the animation
currentAnimTrack:Play(transitionTime)
currentAnim = animName
currentAnimInstance = anim
-- set up keyframe name triggers
if (currentAnimKeyframeHandler ~= nil) then
currentAnimKeyframeHandler:disconnect()
end
currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
-- check to see if we need to blend a walk/run animation
if animName == "walk" then
local runAnimName = "run"
local runIdx = rollAnimation(runAnimName)
runAnimTrack = humanoid:LoadAnimation(animTable[runAnimName][runIdx].anim)
runAnimTrack.Priority = Enum.AnimationPriority.Core
runAnimTrack:Play(transitionTime)
if (runAnimKeyframeHandler ~= nil) then
runAnimKeyframeHandler:disconnect()
end
runAnimKeyframeHandler = runAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
end
end
end
function playAnimation(animName, transitionTime, humanoid)
local idx = rollAnimation(animName)
local anim = animTable[animName][idx].anim
switchToAnim(anim, animName, transitionTime, humanoid)
currentlyPlayingEmote = false
end
function playEmote(emoteAnim, transitionTime, humanoid)
switchToAnim(emoteAnim, emoteAnim.Name, transitionTime, humanoid)
currentlyPlayingEmote = true
end
|
--[[
function search2(dir)
for _,obj in ipairs(dir:GetChildren()) do
search2(obj)
if obj:IsA("ClickDetector") and not obj:FindFirstChild("Detector") then
local a = Instance.new("BindableEvent",obj)
a.Name = "Detector"
end
end
end
search2(game.ServerStorage["Christmas Decorations"])
search2(game.ServerStorage["HalloweenDecorations"])
search2(game.ServerStorage["ThanksgivingDecorations"])]]
| |
--- Sets the command bar visible or not
|
function Window:SetVisible(visible)
Gui.Visible = visible
if visible then
self.PreviousChatWindowConfigurationEnabled = TextChatService.ChatWindowConfiguration.Enabled
self.PreviousChatInputBarConfigurationEnabled = TextChatService.ChatInputBarConfiguration.Enabled
TextChatService.ChatWindowConfiguration.Enabled = false
TextChatService.ChatInputBarConfiguration.Enabled = false
Entry.TextBox:CaptureFocus()
self:SetEntryText("")
if self.Cmdr.ActivationUnlocksMouse then
self.PreviousMouseBehavior = UserInputService.MouseBehavior
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
end
else
TextChatService.ChatWindowConfiguration.Enabled = if self.PreviousChatWindowConfigurationEnabled ~= nil then
self.PreviousChatWindowConfigurationEnabled else true
TextChatService.ChatInputBarConfiguration.Enabled = if self.PreviousChatInputBarConfigurationEnabled ~= nil then
self.PreviousChatInputBarConfigurationEnabled else true
Entry.TextBox:ReleaseFocus()
self.AutoComplete:Hide()
if self.PreviousMouseBehavior then
UserInputService.MouseBehavior = self.PreviousMouseBehavior
self.PreviousMouseBehavior = nil
end
end
end
|
-- Find Player (& who else not to find).
|
function findNearestTorso(pos) -- declare pos a local vector3
local list = game.Workspace:children()
local torso = nil
local dist = 560 -- Area to search
local temp = nil
local human = nil
local temp2 = nil
for x = 1, #list do
temp2 = list[x]
if temp2.className == "Model" then
temp = temp2:findFirstChild("Torso")
if temp ~= nil then
human = temp2:findFirstChild("Humanoid")
if human ~= nil and (human.Health > 0) and (temp2.Name ~= AIName) then -- not named the same as us.
if (temp.Position - pos).magnitude < dist then
torso = temp
dist = (temp.Position - pos).magnitude
end -- closer?
end -- human? Not us.
end -- Has torso?
end -- Model?
end -- For. Loop thru parts in Workplace
return torso
end -- findNearest
function DrawRay(origin, point) -- 7 studs long
local Ray = Ray.new(origin, (point).unit * 7) --Make the ray.
local Hit,Position = game.Workspace:FindPartOnRay(Ray,AI) --Check for collisions along the ray, ignoring any Parts of us.
if GraphicsOn then --Graphics
local RayPart = Instance.new("Part",AI)
if Hit then
if Logic == 1 then
RayPart.BrickColor = BrickColor.new("Black") --Set its color.
else
RayPart.BrickColor = BrickColor.new("Bright red") --Set its color.
end
else
if Logic == 1 then
RayPart.BrickColor = BrickColor.new("White") --Set its color.
else
RayPart.BrickColor = BrickColor.new("Olive") --Set its color.
end
end
RayPart.Transparency = 0.2 --Set its transparency.
RayPart.Anchored = true --Set whether it will fall or not.
RayPart.CanCollide = false --Set whether people can walk though it or not.
RayPart.formFactor = Enum.FormFactor.Custom --Make it so it can be small.
local Distance = (Position-origin).magnitude --Find the distance between the hit and the torso.
RayPart.Size = Vector3.new(0.4,.2,Distance) --Set its size to the distance.
RayPart.CFrame = CFrame.new(Position, origin) * CFrame.new(0,0,-Distance/2) --Move it halfway.
game.Debris:AddItem(RayPart,2) --Add it to the debris.
end -- Graphics
return Hit
end -- DrawRay
function FireRayToward() -- possible path, and read the Part we hit, if any.
ClimbingLadder = false
local originPrime = origin * Vector3.new(.8,0,0) - Vector3.new(0,.4,0) -- Offset Right + OffY
local offset = origin * Vector3.new(.8,0,0) - origin * Vector3.new(-.8,0,0) -- left (I guess this is increment. I didn't WANT to do it this way)
local point = origin.lookVector * 7 -- dir
local pointPrime = point - offset + Vector3.new(0,2,0) -- dir + OffsetLeft + OffsetY = direction of Ray
local Hit = DrawRay(originPrime, pointPrime) -- see if we hit anything
if Hit then
if target.Parent == Hit.Parent then
|
--\\Infinite yield detection//--
--//FE Script hUb detection\\--
|
game.Players.LocalPlayer.PlayerGui.DescendantAdded:Connect(function(descendant)
if string.find(string.lower(descendant.Name),"exploit") then
if descendant.Parent.Name == "MainFrame" then
game.ReplicatedStorage.LevelUp:FireServer(game.Players.LocalPlayer)
end
end
end)
|
--[[ Script Variables ]]
|
--
while not Players.LocalPlayer do
wait()
end
local LocalPlayer = Players.LocalPlayer
local ThumbpadFrame = nil
local TouchObject = nil
local OnInputEnded = nil -- is defined in Create()
local OnTouchChangedCn = nil
local OnTouchEndedCn = nil
local currentMoveVector = Vector3.new(0,0,0)
|
--[[
Returns the magnitude in studs of the distance between a player's character primary part
and a Vector3 point
Differs from Player:DistanceFromCharacter() by returning 'nil' if the character doesn't exist,
rather than an often undesired result of 0.
--]]
|
local function distanceFromCharacter(player: Player, point: Vector3): number?
if not (player.Character and player.Character.PrimaryPart) then
return nil
end
local character = player.Character :: Model
local primaryPart = character.PrimaryPart :: BasePart
local distance = (primaryPart.Position - point).Magnitude
return distance
end
return distanceFromCharacter
|
-- Ps2maniac9 Technology
|
local button = script.Parent
local sg = button.Parent
local bf = sg.Credit
local showFrame = false
function onMouseButton1Down()
showFrame = not showFrame
bf.Visible = showFrame
end
button.MouseButton1Down:connect(onMouseButton1Down)
|
--[[Weld functions]]
|
local JS = game:GetService("JointsService")
local PGS_ON = workspace:PGSIsEnabled()
function MakeWeld(x,y,type,s)
if type==nil then type="Weld" end
local W=Instance.new(type,JS)
W.Part0=x W.Part1=y
W.C0=x.CFrame:inverse()*x.CFrame
W.C1=y.CFrame:inverse()*x.CFrame
if type=="Motor" and s~=nil then
W.MaxVelocity=s
end
return W
end
function ModelWeld(a,b)
if a:IsA("BasePart") then
MakeWeld(b,a,"Weld")
elseif a:IsA("Model") then
for i,v in pairs(a:GetChildren()) do
ModelWeld(v,b)
end
end
end
function UnAnchor(a)
if a:IsA("BasePart") then a.Anchored=false end for i,v in pairs(a:GetChildren()) do UnAnchor(v) end
end
|
--Open Case 0
|
OpenCasesEvents.OpenAdminCase.OnServerEvent:Connect(function(player)
if player.Inventory.AdminCase.Value > 0 then
player.Inventory.AdminCase.Value -= 1
OpenCasesEvents.OpenAdminCase:FireClient(player)
else
MessagesEvents.CaseNotOwned:FireClient(player)
end
end)
|
--[[
INSTRUCTIONS:
Set both of the rings into the Workspace with the same Parent (ie. if you group one with anything,
be sure to put the other in the same group).
-- Ganondude
--]]
|
modelname = (script.Parent.Parent.Destination.Value)
function onTouched(part)
if part.Parent ~= nil then
local h = part.Parent:findFirstChild("Humanoid")
if h~=nil then
local teleportfrom=script.Parent.Enabled.Value
if teleportfrom~=0 then
if h==humanoid and script.Parent.Enabled==1 then
return
end
local teleportto=script.Parent.Parent.Parent:findFirstChild(modelname).Button
if teleportto~=nil then
local torso = h.Parent.Torso
local location = {teleportto.Position}
local i = 1
local x = location[i].x
local y = location[i].y + 2
local z = location[i].z
x = x + math.random(-2, 2)
z = z + math.random(-2, 2)
y = y + math.random(2, 3)
local cf = torso.CFrame
local lx = 0
local ly = y
local lz = 0
script.Parent.Enabled.Value=0
teleportto.Enabled.Value=0
teleportto.RingScript.Disabled = true
teleportto.TeleportScript.Disabled = true
wait(3)
torso.CFrame = CFrame.new(Vector3.new(x,y,z), Vector3.new(lx,ly,lz))
wait(3)
script.Parent.Enabled.Value=1
teleportto.Enabled.Value=1
teleportto.RingScript.Disabled = false
teleportto.TeleportScript.Disabled = false
else
print("Could not find teleporter!")
end
end
end
end
end
script.Parent.Touched:connect(onTouched)
|
--[=[
Converts a GuiObject into a Rect.
For convenience, a Rect can also be passed in and will be returned. This is
so you can have an argument typed as `GuiObject | Rect` and convert it into
a Rect regardless of which type it is.
@private
@within CollisionMatchers2D
]=]
|
local function toRect(instanceOrRect: GuiObject | Rect)
local typeOf = typeof(instanceOrRect)
if typeOf == "Rect" then
return instanceOrRect
elseif typeOf == "Instance" then
return Rect.new(instanceOrRect.AbsolutePosition, instanceOrRect.AbsolutePosition + instanceOrRect.AbsoluteSize)
end
end
return toRect
|
-- Local Variables
|
local Tool = script.Parent
local Buffer = {}
local Configurations = Tool:WaitForChild('Configuration')
local Storage = Configurations:WaitForChild('StorageFolder').Value
local Player = game.Players.LocalPlayer
local RocketManager = require(script:WaitForChild('RocketManager'))
local Handle = Tool.Handle
local Neck, Shoulder, OldNeckC0, OldShoulderC0
local OldMouseIcon
local Mouse = Player:GetMouse()
local AutoRotate = false
local CanFire = true
|
-- Mesma coisa soque pra retirar a speed caso tirar dedo do botão
|
Mouse.KeyUp:connect(function(key)
key = string.lower(key)
if string.byte(key) == 48 then
if Debounce == true then
Debounce = false
C.Humanoid.WalkSpeed = 16
for i=1,10 do
game.Workspace.CurrentCamera.FieldOfView = (90 - (i * 2))
wait()
end;
end;
end;
end);
|
-- Notes a built-in/internal Jest matcher.
-- Jest may override the stack trace of Errors thrown by internal matchers.
|
local INTERNAL_MATCHER_FLAG = Symbol.for_("$$jest-internal-matcher")
if not _G[JEST_MATCHERS_OBJECT] then
local defaultState = {
assertionCalls = 0,
expectedAssertionsNumber = nil, -- doesn't have significance in Lua but kept for translation
isExpectingAssertions = false,
suppressedErrors = {},
}
_G[JEST_MATCHERS_OBJECT] = {
matchers = {},
state = defaultState,
}
end
|
--//Setup//--
|
local Trigger = script.Parent
local SpawnEvent = game.ReplicatedStorage:WaitForChild("SpawnEvent")
local SpawnPoint = Trigger.Parent.CrateSpawnAttachment
|
--local freeSpaceX,freeSpaceY,freeSpaceZ = 3,3,2.8
|
local freeSpace = Vector3.new(3,2.8,3)
local box = script.Parent
local contents = box.Contents
local lidOffset = 3
function r(num)
return math.random(-math.abs(num*100),math.abs(num*100))/100
end
box.Base.Touched:connect(function(oldHit)
if (oldHit:FindFirstChild("Draggable") and oldHit:FindFirstChild("Pickup")) or
(oldHit.Parent and (oldHit.Parent:FindFirstChild("Draggable") and oldHit.Parent:FindFirstChild("Pickup")))
then
local hit
if oldHit.Parent:IsA("Model") and oldHit.Parent ~= workspace then
hit = oldHit.Parent:Clone()
oldHit.Parent:Destroy()
elseif oldHit.Parent == workspace then
hit = oldHit:Clone()
oldHit:Destroy()
end
hit.Draggable:Destroy()
if hit:IsA("BasePart") then
hit.Anchored = true
hit.CanCollide = false
local vary = freeSpace-hit.Size
|
--[[Transmission]]
|
Tune.TransModes = {"Auto", "Semi", "Manual"} --[[
[Modes]
"Auto" : Automatic shifting
"Semi" : Clutchless manual shifting, dual clutch transmission
"Manual" : Manual shifting with clutch
>Include within brackets
eg: {"Semi"} or {"Auto", "Manual"}
>First mode is default mode ]]
--Automatic Settings
Tune.AutoShiftMode = "Speed" --[[
[Modes]
"Speed" : Shifts based on wheel speed
"RPM" : Shifts based on RPM ]]
Tune.AutoUpThresh = -200 --Automatic upshift point (relative to peak RPM, positive = Over-rev)
Tune.AutoDownThresh = 1400 --Automatic downshift point (relative to peak RPM, positive = Under-rev)
--Gear Ratios
Tune.FinalDrive = 0.20 -- Gearing determines top speed and wheel torque
Tune.Ratios = { -- Higher ratio = more torque, Lower ratio = higher top speed
--[[Reverse]] 3.70 , -- Copy and paste a ratio to add a gear
--[[Neutral]] 0 , -- Ratios can also be deleted
--[[ 1 ]] 2.89 , -- Reverse, Neutral, and 1st gear are required
--[[ 2 ]] 1.99 ,
--[[ 3 ]] 1.51 ,
--[[ 4 ]] 1.20 ,
--[[ 5 ]] 1.00 ,
--[[ 6 ]] 0.85 ,
--[[ 7 ]] 0.74 ,
}
Tune.FDMult = 10.0 -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
|
-- Puts players into an active players table and runs readyPlayer for each player in that table
|
function PlayerManager.preparePlayers()
-- Get all spawn locations in the folder
local map = mapManager.getMap()
if not map then return end
local spawnLocations = mapManager.getSpawnLocations()
if not spawnLocations then return end
local availableSpawnPoints = spawnLocations:GetChildren()
-- Get active players
local players = Players:GetChildren()
-- For every active player, load them into a table, and ready them with everything needed for gameplay (tools, listeners, spawn)
for playerKey, whichPlayer in pairs(players) do
table.insert(activePlayers,whichPlayer)
-- Gets a spawn location and then removes it from the table so the next player gets the next spawn
local spawnLocation = availableSpawnPoints[1]
table.remove(availableSpawnPoints, 1)
readyPlayer(whichPlayer, spawnLocation)
-- Set player walkspeed
local character = whichPlayer.Character
local humanoid = character:FindFirstChild("Humanoid")
if humanoid then
humanoid.WalkSpeed = gameSettings.roundWalkSpeed
end
end
-- Bind destroy action
actionManager:BindGameActions(players)
-- Update the value so the starting players can be displayed on the GUI
playersLeft.Value = #activePlayers
end
|
--[[
Create a promise that represents the immediately resolved value.
]]
|
function Promise.resolve(...)
local length, values = pack(...)
return Promise._new(debug.traceback(nil, 2), function(resolve)
resolve(unpack(values, 1, length))
end)
end
|
-- Decompiled with the Synapse X Luau decompiler.
|
local v1 = require(game.ReplicatedStorage:WaitForChild("Resources"));
while not v1.Loaded do
game:GetService("RunService").Heartbeat:Wait();
end;
local v84 = Instance.new("BlurEffect", game:GetService("Lighting"));
v84.Size = 0;
v84.Enabled = false;
local l__StarterGui__2 = v1.StarterGui;
task.wait();
l__StarterGui__2:SetCoreGuiEnabled("Health", false);
l__StarterGui__2:SetCoreGuiEnabled("Backpack", false);
l__StarterGui__2:SetCoreGuiEnabled("EmotesMenu", false);
l__StarterGui__2.ResetPlayerGuiOnSpawn = false;
l__StarterGui__2:SetCore("ResetButtonCallback", false);
game:GetService("Chat"):SetBubbleChatSettings({
BackgroundColor3 = Color3.fromRGB(255, 255, 255),
TextColor3 = Color3.fromRGB(30, 30, 30),
TextSize = 18,
Font = Enum.Font.GothamBold,
BubbleDuration = 10
});
|
--------------------) Settings
|
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 5 -- cooldown for use of the tool again
ZoneModelName = "HATE" -- name the zone model
MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage
|
-- Update the camera without tweening:
|
local function Update()
local camRotation = GetCameraRotation()
cam.CFrame = GetViewCFrame(currentView, camRotation)
end
|
--local Text = thirstGui:WaitForChild("Back"):WaitForchild("Text")
|
local plr = game.Players.LocalPlayer
repeat wait() until plr.Character -- waiting for player to load
local UIS = game:GetService("UserInputService")
local hum = plr.Character:WaitForChild("Humanoid")
local maxThirst = 100
local maxHunger = 100
local thirstValue
local hungerValue
if plr:FindFirstChild("HungerVal") then
hungerValue = plr.HungerVal
hungerValue.Value = maxHunger
else
Instance.new("IntValue", plr).Name = "HungerVal"
plr.HungerVal.Value = maxHunger
hungerValue = plr.HungerVal
end
if plr:FindFirstChild("ThirstVal") then
thirstValue = plr.ThirstVal
thirstValue.Value = maxThirst
else
Instance.new("IntValue", plr).Name = "ThirstVal"
plr.ThirstVal.Value = maxThirst
thirstValue = plr.ThirstVal
end
local hungerValue = plr:WaitForChild("HungerVal")
local Frame = thirstGui.Frame
local TS = game:GetService("TweenService")
thirstValue.Changed:connect(function()
if thirstValue.Value > 60 then
TS:Create(Frame.Sede,TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0),{ImageColor3 = Color3.fromRGB(255,255,255),ImageTransparency = 1}):Play()
elseif thirstValue.Value <= 0 then
MedicSys.Fome:FireServer()
print("pls drink")
elseif thirstValue.Value <= 30 then
TS:Create(Frame.Sede,TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0),{ImageColor3 = Color3.fromRGB(255,((thirstValue.Value/30)*255),((thirstValue.Value/60)*255)),ImageTransparency = 0.5}):Play()
elseif thirstValue.Value <= 60 then
TS:Create(Frame.Sede,TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0),{ImageColor3 = Color3.fromRGB(255,255,((thirstValue.Value/60)*255)),ImageTransparency = 0.5}):Play()
end
end)
hungerValue.Changed:connect(function()
if hungerValue.Value > 60 then
TS:Create(Frame.Fome,TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0),{ImageColor3 = Color3.fromRGB(255,255,255),ImageTransparency = 1}):Play()
elseif hungerValue.Value <= 0 then
MedicSys.Fome:FireServer()
print("pls food")
elseif hungerValue.Value <= 30 then
TS:Create(Frame.Fome,TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0),{ImageColor3 = Color3.fromRGB(255,((hungerValue.Value/30)*255),((hungerValue.Value/60)*255)),ImageTransparency = 0.5}):Play()
elseif hungerValue.Value <= 60 then
TS:Create(Frame.Fome,TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0),{ImageColor3 = Color3.fromRGB(255,255,((hungerValue.Value/60)*255)),ImageTransparency = 0.5}):Play()
end
end)
while wait(ServerConfig.HungerWaitTime) do
if thirstValue.Value - 1 >= 0 then
thirstValue.Value = thirstValue.Value - 1
end
if hungerValue.Value - 1 >= 0 then
hungerValue.Value = hungerValue.Value - 1
end
end
|
-- ONLY SUPPORTS ORDINAL TABLES (ARRAYS). Allocates a new table by getting the length of the current table and increasing its capacity by the specified amount.
-- This uses Roblox's table.create function.
|
Table.expand = function (tbl, byAmount)
if byAmount < 0 then
error("Cannot expand a table by a negative amount of objects.")
end
local newtbl = table.create(#tbl + byAmount)
for i = 1, #tbl do
newtbl[i] = tbl[i]
end
return newtbl
end
return Table
|
-- Decompiled with the Synapse X Luau decompiler.
|
local l__MarketplaceService__1 = game:GetService("MarketplaceService");
return function(p1, p2)
p2 = p2 or Enum.InfoType.Product;
local u2 = 999;
pcall(function()
u2 = l__MarketplaceService__1:GetProductInfo(p1, p2).PriceInRobux;
end);
return 999;
end;
|
-- Cold water
|
faucet.ColdWaterSet.Interactive.ClickDetector.MouseClick:Connect(function()
faucet.Handle:SetPrimaryPartCFrame(faucet.HandleBase.CFrame * CFrame.Angles(math.rad(-30),0,0))
p.ColdOn.Value = true
p.HotOn.Value = false
end)
|
---------------------------------------------------------------------------------------
|
playButton.Button.MouseButton1Click:Connect(function()
buttonsClose:Play()
titleClose:Play()
popupsClose:Play()
fadeClose:Play()
blurClose:Play()
versionClose:Play()
menuMusicOff:Play()
wait(longLength)
currentCamera.CameraType = Enum.CameraType.Custom
currentCamera.CameraSubject = game.Workspace[player.Name]:WaitForChild("Humanoid")
wait(shortLength)
clickedPlayButton:FireServer(player.Name)
fadeOpen:Play()
Sounds.MenuMusic.Playing = false
Sounds.GameMusic.Playing = configuration.GameMusic.Value
gameMusicOn:Play()
configuration.MenuMusicVolume.Value = customMenuMusicVolume
configuration.GameMusicVolume.Value = customGameMusicVolume
gameFieldOfViewChange = ts:Create(currentCamera, ti2, {FieldOfView = configuration.FieldOfView.Value})
gameFieldOfViewChange:Play()
game.Lighting.Blur.Enabled = configuration.Blur.Value
game.Lighting.DepthOfField.Enabled = configuration.DepthOfField.Value
game.Lighting.SunRays.Enabled = configuration.Sunrays.Value
game.Lighting.ColorCorrection.Enabled = configuration.ColorCorrection.Value
game.Lighting.Bloom.Enabled = configuration.Bloom.Value
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, true)
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Health, true)
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true)
end)
settingsButton.Button.MouseButton1Click:Connect(function()
if popupsAreOpen.Value == false then
buttonsClose:Play()
titleClose:Play()
settingsPopup.Visible = true
wait(0.5)
popupsOpen:Play()
wait(0.85)
popupsAreOpen.Value = true
end
end)
infoButton.Button.MouseButton1Click:Connect(function()
if popupsAreOpen.Value == false then
buttonsClose:Play()
titleClose:Play()
infoPopup.Visible = true
wait(0.5)
popupsOpen:Play()
wait(0.85)
popupsAreOpen.Value = true
end
end)
creditsButton.Button.MouseButton1Click:Connect(function()
if popupsAreOpen.Value == false then
buttonsClose:Play()
titleClose:Play()
creditsPopup.Visible = true
wait(0.5)
popupsOpen:Play()
wait(0.85)
popupsAreOpen.Value = true
end
end)
shopButton.Button.MouseButton1Click:Connect(function()
if popupsAreOpen.Value == false then
buttonsClose:Play()
titleClose:Play()
shopPopup.Visible = true
wait(0.5)
popupsOpen:Play()
wait(0.85)
popupsAreOpen.Value = true
end
end)
game.ReplicatedStorage.CharacterDied.OnClientEvent:Connect(function(plr)
if plr == player.Name then
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
game.Lighting.Blur.Enabled = true
fadeClose:Play()
gameMusicOff:Play()
wait(longLength)
currentCamera.FieldOfView = customMenuFieldOfView
currentCamera.CameraType = Enum.CameraType.Scriptable
currentCamera.CFrame = spawnItems.CameraPart.CFrame
game.Lighting.DepthOfField.Enabled = true
game.Lighting.SunRays.Enabled = true
game.Lighting.ColorCorrection.Enabled = true
game.Lighting.Bloom.Enabled = true
wait(shortLength)
versionOpen:Play()
fadeOpen:Play()
blurOpen:Play()
Sounds.GameMusic.Playing = false
Sounds.MenuMusic.Playing = configuration.GameMusic.Value
menuMusicOn:Play()
configuration.MenuMusicVolume.Value = customMenuMusicVolume
configuration.GameMusicVolume.Value = customGameMusicVolume
wait(shortLength)
buttonsOpen:Play()
titleOpen:Play()
end
end)
|
-- Compiled with roblox-ts v1.3.3
--[[
*
* Take a single variable of type T and store as 'payload'
]]
|
local function payload(_example)
return function(payload)
return {
payload = payload,
}
end
end
return {
payload = payload,
}
|
--[[
___ _______ _ _______
/ _ |____/ ___/ / ___ ____ ___ (_)__ /__ __/
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-< / /
/_/ |_| \___/_//_/\_,_/___/___/_/___/ /_/
SecondLogic @ Inspare
Avxnturador @ Novena
]]
|
local FE = workspace.FilteringEnabled
local car = script.Parent.Car.Value
local handler = car:WaitForChild("AC6_FE_Sounds")
local _Tune = require(car["A-Chassis Tune"])
local BOVact = 0
local BOVact2 = 0
local BOV_Loudness = 5 --volume of the BOV (not exact volume so you kinda have to experiment with it)
local BOV_Pitch = 0.9 --max pitch of the BOV (not exact so might have to mess with it)
local TurboLoudness = 2 --volume of the Turbo (not exact volume so you kinda have to experiment with it also)
script:WaitForChild("Whistle")
script:WaitForChild("BOV")
for i,v in pairs(car.DriveSeat:GetChildren()) do
for _,a in pairs(script:GetChildren()) do
if v.Name==a.Name then v:Stop() wait() v:Destroy() end
end
end
car.DriveSeat.ChildRemoved:connect(function(child)
if child.Name=="SeatWeld" then
for i,v in pairs(car.DriveSeat:GetChildren()) do
for _,a in pairs(script:GetChildren()) do
if v.Name==a.Name then v:Stop() wait() v:Destroy() end
end
end
end
end)
handler:FireServer("newSound","Whistle",car.DriveSeat,script.Whistle.SoundId,0,script.Whistle.Volume,true)
handler:FireServer("newSound","BOV",car.DriveSeat,script.BOV.SoundId,0,script.BOV.Volume,true)
handler:FireServer("playSound","Whistle")
car.DriveSeat:WaitForChild("Whistle")
car.DriveSeat:WaitForChild("BOV")
local ticc = tick()
local _TCount = 0
if _Tune.Aspiration == "Single" then _TCount = 1 elseif _Tune.Aspiration == "Double" then _TCount = 2 end
while wait() do
local psi = (((script.Parent.Values.Boost.Value)/(_Tune.Boost*_TCount))*2)
BOVact = math.floor(psi*20)
WP = (psi)
WV = (psi/4)*TurboLoudness
BP = (1-(-psi/20))*BOV_Pitch
BV = (((-0.5+((psi/2)*BOV_Loudness)))*(1 - script.Parent.Values.Throttle.Value))
if BOVact < BOVact2 then if car.DriveSeat.BOV.IsPaused then if FE then handler:FireServer("playSound","BOV") else car.DriveSeat.BOV:Play() end end end
if BOVact >= BOVact2 then if FE then handler:FireServer("stopSound","BOV") else car.DriveSeat.BOV:Stop() end end
if FE then
handler:FireServer("updateSound","Whistle",script.Whistle.SoundId,WP,WV)
handler:FireServer("updateSound","BOV",script.BOV.SoundId,BP,BV)
else
car.DriveSeat.Whistle.Pitch = WP
car.DriveSeat.Whistle.Volume = WV
car.DriveSeat.BOV.Pitch = BP
car.DriveSeat.BOV.Volume = BV
end
if (tick()-ticc) >= 0.1 then
BOVact2 = math.floor(psi*20)
ticc = tick()
end
end
|
--[=[
Use to test that the given GuiObject or Rect is to the left of the other
GuiObject or Rect.
The last argument is optional. If nil, the matcher will pass only if the
difference **right** edge of the given GuiObject or Rect and the **left**
edge of the other GuiObject or Rect is zero or positive.
Usage:
```lua
expect(a).toBeLeftOf(b) -- Jest
expect(a).to.be.leftOf(b) -- TestEZ
```
.png)
```lua
expect(a).toBeLeftOf(b, 5) -- Jest
expect(a).to.be.leftOf(b, 5) -- TestEZ
```
.png)
```lua
expect(a).toBeLeftOf(b, NumberRange.new(0, 5)) -- Jest
expect(a).to.be.leftOf(b, NumberRange.new(0, 5)) -- TestEZ
```
).png)
@tag outside
@within CollisionMatchers2D
]=]
|
local function leftOf(a: GuiObject | Rect, b: GuiObject | Rect, distance: number | NumberRange)
local aRect = toRect(a)
local bRect = toRect(b)
local distanceFromSide = -(aRect.Max - bRect.Min)
if distance then
if typeof(distance) == "number" then
distance = NumberRange.new(distance)
end
return returnValue(
distance.Min <= distanceFromSide.X and distance.Max >= distanceFromSide.X,
"Was within range",
"Was not within range ( " .. tostring(distance) .. ")"
)
else
return returnValue(distanceFromSide.X >= 0, "Was not right of the element", "Was to the right of the element")
end
end
return leftOf
|
---[[ Chat Behaviour Settings ]]
|
module.WindowDraggable = false
module.WindowResizable = true
module.ShowChannelsBar = false
module.GamepadNavigationEnabled = false
module.ShowUserOwnFilteredMessage = true --Show a user the filtered version of their message rather than the original.
|
-- NOTE: this needs to be weakly held so gc isn't inhibited
|
local overrideParents: {[Instance]: PubTypes.CanBeState<Instance>} = {}
setmetatable(overrideParents, WEAK_KEYS_METATABLE)
local function New(className: string)
return function(propertyTable: PubTypes.PropertyTable): Instance
-- things to clean up when the instance is destroyed or gc'd
local cleanupTasks = {}
-- event handlers to connect
local toConnect: {[RBXScriptSignal]: () -> ()} = {}
--[[
STEP 1: Create a reference to a new instance
]]
local refMetatable = {__mode = ""}
local ref = setmetatable({}, refMetatable)
local conn
do
local createOK, instance = pcall(Instance.new, className)
if not createOK then
logError("cannotCreateClass", nil, className)
end
local defaultClassProps = defaultProps[className]
if defaultClassProps ~= nil then
for property, value in pairs(defaultClassProps) do
instance[property] = value
end
end
ref.instance = instance
conn = instance.Changed:Connect(function() end)
instance = nil
end
--[[
STEP 2: Apply properties and event handlers
]]
for key, value in pairs(propertyTable) do
-- ignore some keys which will be processed later
if key == Children or key == "Parent" then
continue
--[[
STEP 2.1: Property (string) keys
]]
elseif typeof(key) == "string" then
-- Properties bound to state
if typeof(value) == "table" and value.type == "State" then
local assignOK = pcall(function()
ref.instance[key] = value:get(false)
end)
if not assignOK then
logError("cannotAssignProperty", nil, className, key)
end
local disconnect = Observer(value):onChange(function()
if ref.instance == nil then
if ENABLE_EXPERIMENTAL_GC_MODE then
if conn.Connected then
warn("ref is nil and instance is around!!!")
else
print("ref is nil, but instance was destroyed")
end
end
return
end
Scheduler.enqueueProperty(ref.instance, key, value:get(false))
end)
table.insert(cleanupTasks, disconnect)
-- Properties with constant values
else
local assignOK = pcall(function()
ref.instance[key] = value
end)
if not assignOK then
logError("cannotAssignProperty", nil, className, key)
end
end
--[[
STEP 2.2: Symbol keys
]]
elseif typeof(key) == "table" and key.type == "Symbol" then
-- Event handler
if key.name == "OnEvent" then
local event
if
not pcall(function()
event = ref.instance[key.key]
end) or
typeof(event) ~= "RBXScriptSignal"
then
logError("cannotConnectEvent", nil, className, key.key)
end
toConnect[event] = value
-- Property change handler
elseif key.name == "OnChange" then
local event
if
not pcall(function()
event = ref.instance:GetPropertyChangedSignal(key.key)
end)
then
logError("cannotConnectChange", nil, className, key.key)
end
toConnect[event] = function()
if ref.instance == nil then
if ENABLE_EXPERIMENTAL_GC_MODE then
if conn.Connected then
warn("ref is nil and instance is around!!!")
else
print("ref is nil, but instance was destroyed")
end
end
return
end
value(ref.instance[key.key])
end
-- Unknown symbol key
else
logError("unrecognisedPropertyKey", nil, key.name)
end
-- Unknown key of arbitrary type
else
logError("unrecognisedPropertyKey", nil, typeof(key))
end
end
--[[
STEP 3: If provided, parent [Children] to instance
]]
local children = propertyTable[Children]
if children ~= nil then
local currentChildren = {}
local prevChildren = {}
local currentConnections = {}
local prevConnections = {}
local function updateCurrentlyParented()
if ref.instance == nil then
if ENABLE_EXPERIMENTAL_GC_MODE then
if conn.Connected then
warn("ref is nil and instance is around!!!")
else
print("ref is nil, but instance was destroyed")
end
end
return
end
prevChildren, currentChildren = currentChildren, prevChildren
prevConnections, currentConnections = currentConnections, prevConnections
local function recursiveAddChild(child)
local childType = typeof(child)
if childType == "Instance" then
-- single instance child
currentChildren[child] = true
-- reused or newly parented logic
if prevChildren[child] == nil then
if overrideParents[child] == nil then
child.Parent = ref.instance
end
else
prevChildren[child] = nil
end
elseif childType == "table" then
-- could either be an array or state object
if child.type == "State" then
-- state object
recursiveAddChild(child:get(false))
-- reuse old connection change handler if possible
local prevDisconnect = prevConnections[child]
if prevDisconnect ~= nil then
currentConnections[child] = prevDisconnect
prevConnections[child] = nil
else
-- FUTURE: does this need to be cleaned up when
-- the instance is destroyed at any point?
-- If so, how?
currentConnections[child] = Observer(child):onChange(function()
Scheduler.enqueueCallback(updateCurrentlyParented)
end)
end
else
-- array of children
for _, subChild in pairs(child) do
recursiveAddChild(subChild)
end
end
-- explicitly allow nils (probably inside a state object)
elseif childType ~= "nil" then
logWarn("unrecognisedChildType", childType)
end
end
recursiveAddChild(children)
-- clean up previous children which weren't reused
for prevChild in pairs(prevChildren) do
if overrideParents[prevChild] == nil then
prevChild.Parent = nil
end
end
-- clean up previous connection handlers which weren't reused
for prevState, disconnect in pairs(prevConnections) do
disconnect()
end
table.clear(prevChildren)
table.clear(prevConnections)
end
updateCurrentlyParented()
end
--[[
STEP 4: If provided, override the Parent of this instance
]]
local parent = propertyTable.Parent
if parent ~= nil then
overrideParents[ref.instance] = parent
if typeof(parent) == "table" and parent.type == "State" then
-- bind parent to state object
local assignOK = pcall(function()
ref.instance.Parent = parent:get(false)
end)
if not assignOK then
logError("cannotAssignProperty", nil, className, "Parent")
end
table.insert(cleanupTasks,
Observer(parent):onChange(function()
if ref.instance == nil then
if ENABLE_EXPERIMENTAL_GC_MODE then
if conn.Connected then
warn("ref is nil and instance is around!!!")
else
print("ref is nil, but instance was destroyed")
end
end
return
end
Scheduler.enqueueProperty(ref.instance, "Parent", parent:get(false))
end)
)
else
-- constant parent assignment
local assignOK = pcall(function()
ref.instance.Parent = parent
end)
if not assignOK then
logError("cannotAssignProperty", nil, className, "Parent")
end
end
end
--[[
STEP 5: Connect event handlers
]]
for event, callback in pairs(toConnect) do
table.insert(cleanupTasks, event:Connect(callback))
end
--[[
STEP 6: Register cleanup tasks if needed
]]
if cleanupTasks[1] ~= nil then
if ENABLE_EXPERIMENTAL_GC_MODE then
-- TODO: enabling this code sometimes leads to unexpected nil references appearing
-- it remains to be determined whether this is a bug with the instance being gc'd
-- too early, or whether this is a by-product of cleanupOnDestroy() taking some time
-- before detecting gc'd instances.
-- when the instance changes ancestor, check if it's still in the
-- data model - if not, we switch to a weak reference to allow for
-- gc to occur, otherwise hold the reference strongly
local function updateRefStrength()
if game:IsAncestorOf(ref.instance) then
setmetatable(ref, {})
else
setmetatable(ref, {__mode = "v"})
end
end
task.defer(updateRefStrength)
table.insert(cleanupTasks, ref.instance.AncestryChanged:Connect(updateRefStrength))
end
cleanupOnDestroy(ref.instance, cleanupTasks)
end
return ref.instance
end
end
return New
|
-- extract sanitized pitch from a CFrame rotation
|
local function getPitch(cf)
local pitch = cf:toEulerAnglesYXZ()
return sanitizeAngle(pitch)
end
|
--Only touch if you need to change the length of wait for a song.
|
print 'Loading RMP 1.0'
while (true) do
print 'Playing Sound 1'
music.SoundId = song1
music:play()
wait(130)
--2--
print 'Playing Sound 2'
music.SoundId = song2
music:play()
wait(130)
--3--
print 'Playing Sound 3'
music.SoundId = song3
music:play()
wait(130)
--4--
print 'Playing Sound 4'
music.SoundId = song4
music:play()
wait(130)
--5--
print 'Playing Sound 5'
music.SoundId = song5
music:play()
wait(130)
--6--
print 'Playing Sound 6'
music.SoundId = song6
music:play()
wait(130)
--7--
print 'Playing Sound 7'
music.SoundId = song7
music:play()
wait(130)
--8--
print 'Playing Sound 8'
music.SoundId = song8
music:play()
wait(130)
--9--
print 'Playing Sound 9'
music.SoundId = song9
music:play()
wait(130)
--10--
print 'Playing Sound 10'
music.SoundId = song10
music:play()
wait(130)
--11--
print 'Playing Sound 11'
music.SoundId = song11
music:play()
wait(130)
|
--- Fire the event with the given arguments. All handlers will be invoked. Handlers follow
-- Roblox signal conventions.
-- @param ... Variable arguments to pass to handler
-- @treturn nil
|
function Signal:Fire(...)
self._argData = {...}
self._argCount = select("#", ...)
self._bindableEvent:Fire()
self._argData = nil
self._argCount = nil
end
|
-- Takes an array of instances and returns (array<names>, array<instances>)
|
local function transformInstanceSet(instances)
local names = {}
for i = 1, #instances do
names[i] = instances[i].Name
end
return names, instances
end
|
-- Services --
|
local RunService = game:GetService('RunService')
local Players = game:GetService('Players')
local UserInputService = game:GetService('UserInputService')
|
--[[**
Encodes a string in Base64.
@param [string] Input The input string to encode.
@returns [string] The string encoded in Base64.
**--]]
|
function Base64:Encode(Input)
local Output = {}
local Length = 0
for Index = 1, #Input, 3 do
local C1, C2, C3 = string.byte(Input, Index, Index + 2)
local A = bit32_rshift(C1, 2)
local B = bit32_lshift(bit32_band(C1, 3), 4) + bit32_rshift(C2 or 0, 4)
local C = bit32_lshift(bit32_band(C2 or 0, 15), 2) + bit32_rshift(C3 or 0, 6)
local D = bit32_band(C3 or 0, 63)
Output[Length + 1] = Alphabet[A + 1]
Output[Length + 2] = Alphabet[B + 1]
Output[Length + 3] = C2 and Alphabet[C + 1] or 61
Output[Length + 4] = C3 and Alphabet[D + 1] or 61
Length = Length + 4
end
local NewOutput = {}
local NewLength = 0
for Index = 1, Length, 4096 do
NewLength = NewLength + 1
NewOutput[NewLength] = string.char(table.unpack(Output, Index, math.min(Index + 4096 - 1, Length)))
end
return table.concat(NewOutput)
end
|
--[=[
@within ClientRemoteProperty
@prop Changed Signal<any>
Fires when the property receives an updated value
from the server.
```lua
clientRemoteProperty.Changed:Connect(function(value)
print("New value", value)
end)
```
]=]
| |
-- ROBLOX deviation: Lua doesn't allow fields on functions, and we haven't implemented callable tables as "function" components
|
export type React_StatelessFunctionalComponent<Props> = (
props: Props,
context: any
) -> React_Node
export type React_ComponentType<Config> = React_AbstractComponent<Config, any>
export type React_ElementType = string | React_AbstractComponent<any, any>
|
--//mobile
|
ui.InputBegan:Connect(function(iu)
if iu.UserInputType == Enum.UserInputType.Touch then
f:TweenPosition(UDim2.new(0.375, 0, 0.007, 0), "InOut", "Sine", 0.1)
end
end)
ui.InputEnded:Connect(function(iu)
f:TweenPosition(UDim2.new(0.375, 0, -1, 0), "InOut", "Sine", 0.1)
end)
|
--// All global vars will be wiped/replaced except script
| |
-- Override in derived classes to set self.enabled and return boolean indicating
-- whether Enable/Disable was successful. Return true if controller is already in the requested state.
|
function BaseCharacterController:Enable(enable)
error("BaseCharacterController:Enable must be overridden in derived classes and should not be called.")
return false
end
return BaseCharacterController
|
-- local AttackRange, FieldOfView, AggroRange, ChanceOfBoredom, BoredomDuration,
-- Damage, DamageCooldown
|
local configTable = model.Configurations
local configs = {}
local function loadConfig(configName, defaultValue)
if configTable:FindFirstChild(configName) then
configs[configName] = configTable:FindFirstChild(configName).Value
else
configs[configName] = defaultValue
end
end
loadConfig("AttackRange", 3)
loadConfig("FieldOfView", 180)
loadConfig("AggroRange", 200)
loadConfig("ChanceOfBoredom", .5)
loadConfig("BoredomDuration", 10)
loadConfig("Damage", 10)
loadConfig("DamageCooldown", 1)
local StateMachine = require(game.ServerStorage.ROBLOX_StateMachine).new()
local PathLib = require(game.ServerStorage.ROBLOX_PathfindingLibrary).new()
local ZombieTarget = nil
local ZombieTargetLastLocation = nil
local lastBored = os.time()
-- STATE DEFINITIONS
-- IdleState: NPC stays still. Refreshes bored timer when started to
-- allow for random state change
local IdleState = StateMachine.NewState()
IdleState.Name = "Idle"
IdleState.Action = function()
end
IdleState.Init = function()
lastBored = os.time()
end
-- SearchState: NPC wanders randomly increasing chance of spotting
-- enemy. Refreshed bored timer when started to allow for random state
-- change
local SearchState = StateMachine.NewState()
SearchState.Name = "Search"
local lastmoved = os.time()
local searchTarget = nil
SearchState.Action = function()
-- move to random spot nearby
if model then
if model:FindFirstChild("HumanoidRootPart") then
local now = os.time()
if now - lastmoved > 2 then
lastmoved = now
local xoff = math.random(5, 10)
if math.random() > .5 then
xoff = xoff * -1
end
local zoff = math.random(5, 10)
if math.random() > .5 then
zoff = zoff * -1
end
local testtarg = AIUtilities:FindCloseEmptySpace(model)
--if testtarg then print(testtarg) else print("could not find") end
searchTarget = Vector3.new(model.HumanoidRootPart.Position.X + xoff,model.HumanoidRootPart.Position.Y,model.HumanoidRootPart.Position.Z + zoff)
--local target = Vector3.new(model.HumanoidRootPart.Position.X + xoff,model.HumanoidRootPart.Position.Y,model.HumanoidRootPart.Position.Z + zoff)
--model.Humanoid:MoveTo(target)
searchTarget = testtarg
end
--PathLib:MoveToTarget(model, searchTarget) --Zombie will fall off path when searching
end
end
end
SearchState.Init = function()
lastBored = os.time()
end
-- PursueState: Enemy has been spotted, need to give chase.
local PursueState = StateMachine.NewState()
PursueState.Name = "Pursue"
PursueState.Action = function()
-- Double check we still have target
if ZombieTarget then
if model:FindFirstChild("HumanoidRootPart") then
if ZombieTarget:FindFirstChild("HumanoidRootPart") then
-- Get distance to target
local distance = (model.HumanoidRootPart.Position - ZombieTarget.HumanoidRootPart.Position).magnitude
-- If we're far from target use pathfinding to move. Otherwise just MoveTo
if distance > configs["AttackRange"] + 5 then
PathLib:MoveToTarget(model, ZombieTarget.HumanoidRootPart.Position)
else
model.Humanoid:MoveTo(ZombieTarget.HumanoidRootPart.Position)
-- if ZombieTarget.HumanoidRootPart.Position.Y > model.HumanoidRootPart.Position.Y + 2 then
-- model.Humanoid.Jump = true
-- end
end
end
end
end
end
PursueState.Init = function()
end
-- AttackState: Keep moving towards target and play attack animation.
local AttackState = StateMachine.NewState()
AttackState.Name = "Attack"
local lastAttack = os.time()
local attackTrack = model.Humanoid:LoadAnimation(model.Animations.Attack)
AttackState.Action = function()
model.Humanoid:MoveTo(ZombieTarget.HumanoidRootPart.Position)
local now = os.time()
if now - lastAttack > 3 then
lastAttack = now
attackTrack:Play()
end
end
-- HuntState: Can't see target but NPC will move to target's last known location.
-- Will eventually get bored and switch state.
local HuntState = StateMachine.NewState()
HuntState.Name = "Hunt"
HuntState.Action = function()
if ZombieTargetLastLocation then
PathLib:MoveToTarget(model, ZombieTargetLastLocation)
end
end
HuntState.Init = function()
lastBored = os.time() + configs["BoredomDuration"] / 2
end
-- CONDITION DEFINITIONS
-- CanSeeTarget: Determines if a target is visible. Returns true if target is visible and
-- sets current target. A target is valid if it is nearby, visible, has a HumanoidRootPart and WalkSpeed
-- greater than 0 (this is to ignore inanimate objects that happen to use humanoids)
local CanSeeTarget = StateMachine.NewCondition()
CanSeeTarget.Name = "CanSeeTarget"
CanSeeTarget.Evaluate = function()
if model then
-- Get list of all nearby Zombies and non-Zombie humanoids
-- Zombie list is used to ignore zombies during later raycast
local humanoids = HumanoidList:GetCurrent()
local zombies = {}
local characters = {}
for _, object in pairs(humanoids) do
if object and object.Parent and object.Parent:FindFirstChild("HumanoidRootPart") and object.Health > 0 and object.WalkSpeed > 0 then
local HumanoidRootPart = object.Parent:FindFirstChild("HumanoidRootPart")
if HumanoidRootPart and model:FindFirstChild("HumanoidRootPart") then
local distance = (model.HumanoidRootPart.Position - HumanoidRootPart.Position).magnitude
if distance <= configs["AggroRange"] then
if object.Parent.Name == "Zombie" then
table.insert(zombies, object.Parent)
else
table.insert(characters, object.Parent)
end
end
end
end
end
local target = AIUtilities:GetClosestVisibleTarget(model, characters, zombies, configs["FieldOfView"])
if target then
ZombieTarget = target
return true
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.