prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
-- print("Wha " .. pose)
|
stopAllAnimations()
amplitude = 0.1
frequency = 1
setAngles = true
end
if (setAngles) then
desiredAngle = amplitude * math.sin(time * frequency)
RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
RightHip:SetDesiredAngle(-desiredAngle)
LeftHip:SetDesiredAngle(-desiredAngle)
end
-- Tool Animation handling
local tool = getTool()
if tool and tool:FindFirstChild("Handle") then
animStringValueObject = getToolAnim(tool)
if animStringValueObject then
toolAnim = animStringValueObject.Value
-- message recieved, delete StringValue
animStringValueObject.Parent = nil
toolAnimTime = time + .3
end
if time > toolAnimTime then
toolAnimTime = 0
toolAnim = "None"
end
animateTool()
else
stopToolAnimations()
toolAnim = "None"
toolAnimInstance = nil
toolAnimTime = 0
end
end
|
-- Define the function to open or close the window with gene-alike effect
|
local function toggleWindow()
if window.Visible then
window.Visible = false
-- Close the window by tweening back to the button position and size
window:TweenSizeAndPosition(
UDim2.new(0, 0, 0, 0),
UDim2.new(0, aFinderButton.AbsolutePosition.X, 0, aFinderButton.AbsolutePosition.Y),
'Out',
'Quad',
0.5,
false,
function()
window.Visible = false
end
)
end
end
|
-- Finalize changes to parts when the handle is let go
|
Support.AddUserInputListener('Ended', 'MouseButton1', true, function (Input)
-- Ensure handle dragging is ongoing
if not HandleDragging then
return;
end;
-- Disable dragging
HandleDragging = false;
-- Clear this connection to prevent it from firing again
ClearConnection 'HandleRelease';
-- Make joints, restore original anchor and collision states
for Part, State in pairs(InitialState) do
Part:MakeJoints();
Core.RestoreJoints(State.Joints);
Part.CanCollide = State.CanCollide;
Part.Anchored = State.Anchored;
end;
-- Register the change
RegisterChange();
-- Resume normal bounding box updating
BoundingBox.RecalculateStaticExtents();
BoundingBox.ResumeMonitoring();
end);
function HideHandles()
-- Hides the resizing handles
-- Make sure handles exist and are visible
if not Handles or not Handles.Visible then
return;
end;
-- Hide the handles
Handles.Visible = false;
Handles.Parent = nil;
-- Disable handle autofocus
ClearConnection 'AutofocusHandle';
end;
function MovePartsAlongAxesByFace(Face, Distance, Axes, BasePart, InitialStates)
-- Moves the given parts in `InitialStates`, along the given axis mode, in the given face direction, by the given distance
-- Get the axis multiplier for this face
local AxisMultiplier = AxisMultipliers[Face];
-- Get starting state for `BasePart`
local InitialBasePartState = InitialStates[BasePart];
-- Move each part
for Part, InitialState in pairs(InitialStates) do
-- Move along standard axes
if Axes == 'Global' then
Part.CFrame = InitialState.CFrame + (Distance * AxisMultiplier);
-- Move along item's axes
elseif Axes == 'Local' then
Part.CFrame = InitialState.CFrame * CFrame.new(Distance * AxisMultiplier);
-- Move along focused part's axes
elseif Axes == 'Last' then
-- Calculate the focused part's position
local RelativeTo = InitialBasePartState.CFrame * CFrame.new(Distance * AxisMultiplier);
-- Calculate how far apart we should be from the focused part
local Offset = InitialBasePartState.CFrame:toObjectSpace(InitialState.CFrame);
-- Move relative to the focused part by this part's offset from it
Part.CFrame = RelativeTo * Offset;
end;
end;
end;
function BindShortcutKeys()
-- Enables useful shortcut keys for this tool
-- Track user input while this tool is equipped
table.insert(Connections, UserInputService.InputBegan:connect(function (InputInfo, GameProcessedEvent)
-- Make sure this is an intentional event
if GameProcessedEvent then
return;
end;
-- Make sure this input is a key press
if InputInfo.UserInputType ~= Enum.UserInputType.Keyboard then
return;
end;
-- Make sure it wasn't pressed while typing
if UserInputService:GetFocusedTextBox() then
return;
end;
-- Check if the enter key was pressed
if InputInfo.KeyCode == Enum.KeyCode.Return or InputInfo.KeyCode == Enum.KeyCode.KeypadEnter then
-- Toggle the current axis mode
if MoveTool.Axes == 'Global' then
SetAxes('Local');
elseif MoveTool.Axes == 'Local' then
SetAxes('Last');
elseif MoveTool.Axes == 'Last' then
SetAxes('Global');
end;
-- Check if the - key was pressed
elseif InputInfo.KeyCode == Enum.KeyCode.Minus or InputInfo.KeyCode == Enum.KeyCode.KeypadMinus then
-- Focus on the increment input
if MoveTool.UI then
MoveTool.UI.IncrementOption.Increment.TextBox:CaptureFocus();
end;
-- Check if the R key was pressed down, and it's not the selection clearing hotkey
elseif InputInfo.KeyCode == Enum.KeyCode.R and not Selection.Multiselecting then
-- Start tracking snap points nearest to the mouse
StartSnapping();
-- Nudge up if the 8 button on the keypad is pressed
elseif InputInfo.KeyCode == Enum.KeyCode.KeypadEight then
NudgeSelectionByFace(Enum.NormalId.Top);
-- Nudge down if the 2 button on the keypad is pressed
elseif InputInfo.KeyCode == Enum.KeyCode.KeypadTwo then
NudgeSelectionByFace(Enum.NormalId.Bottom);
-- Nudge forward if the 9 button on the keypad is pressed
elseif InputInfo.KeyCode == Enum.KeyCode.KeypadNine then
NudgeSelectionByFace(Enum.NormalId.Front);
-- Nudge backward if the 1 button on the keypad is pressed
elseif InputInfo.KeyCode == Enum.KeyCode.KeypadOne then
NudgeSelectionByFace(Enum.NormalId.Back);
-- Nudge left if the 4 button on the keypad is pressed
elseif InputInfo.KeyCode == Enum.KeyCode.KeypadFour then
NudgeSelectionByFace(Enum.NormalId.Left);
-- Nudge right if the 6 button on the keypad is pressed
elseif InputInfo.KeyCode == Enum.KeyCode.KeypadSix then
NudgeSelectionByFace(Enum.NormalId.Right);
-- Align the selection to the current target surface if T is pressed
elseif InputInfo.KeyCode == Enum.KeyCode.T then
AlignSelectionToTarget();
end;
end));
-- Track ending user input while this tool is equipped
table.insert(Connections, UserInputService.InputEnded:connect(function (InputInfo, GameProcessedEvent)
-- Make sure this is an intentional event
if GameProcessedEvent then
return;
end;
-- Make sure this is input from the keyboard
if InputInfo.UserInputType ~= Enum.UserInputType.Keyboard then
return;
end;
-- Check if the R key was let go
if InputInfo.KeyCode == Enum.KeyCode.R then
-- Make sure it wasn't pressed while typing
if UserInputService:GetFocusedTextBox() then
return;
end;
-- Reset handles if not dragging
if not Dragging then
SetAxes(MoveTool.Axes);
end;
-- Stop snapping point tracking if it was enabled
SnapTracking.StopTracking();
end;
end));
end;
|
--[=[
An object to represent runtime errors that occur during execution.
Promises that experience an error like this will be rejected with
an instance of this object.
@class Error
]=]
|
local Error
do
Error = {
Kind = makeEnum("Promise.Error.Kind", {
"ExecutionError",
"AlreadyCancelled",
"NotResolvedInTime",
"TimedOut",
}),
}
Error.__index = Error
function Error.new(options, parent)
options = options or {}
return setmetatable({
error = tostring(options.error) or "[This error has no error text.]",
trace = options.trace,
context = options.context,
kind = options.kind,
parent = parent,
createdTick = os.clock(),
createdTrace = debug.traceback(),
}, Error)
end
function Error.is(anything)
if type(anything) == "table" then
local metatable = getmetatable(anything)
if type(metatable) == "table" then
return rawget(anything, "error") ~= nil and type(rawget(metatable, "extend")) == "function"
end
end
return false
end
function Error.isKind(anything, kind)
assert(kind ~= nil, "Argument #2 to Promise.Error.isKind must not be nil")
return Error.is(anything) and anything.kind == kind
end
function Error:extend(options)
options = options or {}
options.kind = options.kind or self.kind
return Error.new(options, self)
end
function Error:getErrorChain()
local runtimeErrors = { self }
while runtimeErrors[#runtimeErrors].parent do
table.insert(runtimeErrors, runtimeErrors[#runtimeErrors].parent)
end
return runtimeErrors
end
function Error:__tostring()
local errorStrings = {
string.format("-- Promise.Error(%s) --", self.kind or "?"),
}
for _, runtimeError in ipairs(self:getErrorChain()) do
table.insert(
errorStrings,
table.concat({
runtimeError.trace or runtimeError.error,
runtimeError.context,
}, "\n")
)
end
return table.concat(errorStrings, "\n")
end
end
|
-- TYPE DEFINITION: Part Cache Instance
|
export type PartCache = {
Open: {[number]: BasePart},
InUse: {[number]: BasePart},
CurrentCacheParent: Instance,
Template: BasePart,
ExpansionSize: number
}
|
--Rear--
|
local RRAtt1 = Instance.new("Attachment", RRDisk)
RRAtt1.Position = Vector3.new(0,1,0)
local RRAtt2 = Instance.new("Attachment", RRDisk)
RRAtt2.Position = Vector3.new(0,-1,0)
local RLAtt1 = Instance.new("Attachment", RLDisk)
RLAtt1.Position = Vector3.new(0,1,0)
local RLAtt2 = Instance.new("Attachment", RLDisk)
RLAtt2.Position = Vector3.new(0,-1,0)
local RDIFF1 = Instance.new("SpringConstraint", diff)
RDIFF1.Name = "ControlX"
RDIFF1.Attachment0 = RRAtt1
RDIFF1.Attachment1 = RLAtt1
local RDIFF2 = Instance.new("SpringConstraint", diff)
RDIFF2.Name = "ControlY"
RDIFF2.Attachment0 = RRAtt2
RDIFF2.Attachment1 = RLAtt2
|
--edit the function below to return true when you want this response/prompt to be valid
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data
|
return function(player, dialogueFolder)
local plrData = require(game.ReplicatedStorage.Source.Modules.Util):GetPlayerData(player)
return plrData.Character.Purity.Value <=- 50
end
|
-- This is an overload function for TransparencyController:IsValidPartToModify(part)
-- You may call it directly if you'd like, as it does not have any external dependencies.
|
function FpsCamera:IsValidPartToModify(part)
if part:FindFirstAncestorOfClass("Tool") then
return false
end
if part:IsA("Decal") then
part = part.Parent
end
if part and part:IsA("BasePart") then
local accessory = part:FindFirstAncestorWhichIsA("Accoutrement")
if accessory then
if part.Name ~= "Handle" then
local handle = accessory:FindFirstChild("Handle", true)
if handle and handle:IsA("BasePart") then
part = handle
end
end
for _,child in pairs(part:GetChildren()) do
if child:IsA("Attachment") then
if self.HeadAttachments[child.Name] then
return true
end
end
end
elseif part.Name == "Head" then
local model = part.Parent
local camera = workspace.CurrentCamera
local humanoid = model and model:FindFirstChildOfClass("Humanoid")
if humanoid and camera.CameraSubject == humanoid then
return true
end
end
end
return false
end
|
-- Variables for Roblox services
|
local ServerStorage = game:GetService("ServerStorage")
|
--[=[
@tag Component Class
@return Component?
Gets an instance of a component class from the given Roblox
instance. Returns `nil` if not found.
```lua
local MyComponent = require(somewhere.MyComponent)
local myComponentInstance = MyComponent:FromInstance(workspace.SomeInstance)
```
]=]
|
function Component:FromInstance(instance: Instance)
return self[KEY_INST_TO_COMPONENTS][instance]
end
|
---Removing old core handler with new one
|
local coreHandler = script.Parent:WaitForChild("Core_Handler")
coreHandler:Destroy()
local coreHandlerNew = content:WaitForChild("Core_Handler_New")
local coreHandlerNewClone = coreHandlerNew:Clone()
coreHandlerNewClone.Parent = script.Parent
coreHandlerNewClone.Disabled = false
|
--Switch between brush and eraser using the B and E hotkeys
|
uis.InputBegan:Connect(function(inp, p)
if not p and cursor.Visible == true then
if inp.KeyCode == Enum.KeyCode.B then
erasing = false
brushSettings.BrushButton.BackgroundColor3 = Color3.fromRGB(200, 200, 200)
brushSettings.EraserButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
elseif inp.KeyCode == Enum.KeyCode.E then
erasing = true
brushSettings.EraserButton.BackgroundColor3 = Color3.fromRGB(200, 200, 200)
brushSettings.BrushButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
end
end
end)
|
------//Patrol Animations
|
self.RightPatrol = CFrame.new(-1, -.35, -1.5) * CFrame.Angles(math.rad(-80), math.rad(-80), math.rad(0));
self.LeftPatrol = CFrame.new(1,1.25,-.75) * CFrame.Angles(math.rad(-90),math.rad(-45),math.rad(-25));
|
--////////////////////////////// Methods
--//////////////////////////////////////
|
local methods = {}
methods.__index = methods
function methods:AddChannel(channelName, autoJoin)
if (self.ChatChannels[channelName:lower()]) then
error(string.format("Channel %q alrady exists.", channelName))
end
local function DefaultChannelCommands(fromSpeaker, message)
if (message:lower() == "/leave") then
local channel = self:GetChannel(channelName)
local speaker = self:GetSpeaker(fromSpeaker)
if (channel and speaker) then
if (channel.Leavable) then
speaker:LeaveChannel(channelName)
local msg = ChatLocalization:FormatMessageToSend(
"GameChat_ChatService_YouHaveLeftChannel",
string.format("You have left channel '%s'", channelName),
"RBX_NAME",
channelName)
speaker:SendSystemMessage(msg, "System")
else
speaker:SendSystemMessage(ChatLocalization:FormatMessageToSend("GameChat_ChatService_CannotLeaveChannel","You cannot leave this channel."), channelName)
end
end
return true
end
return false
end
local channel = ChatChannel.new(self, channelName)
self.ChatChannels[channelName:lower()] = channel
channel:RegisterProcessCommandsFunction("default_commands", DefaultChannelCommands, ChatConstants.HighPriority)
local success, err = pcall(function() self.eChannelAdded:Fire(channelName) end)
if not success and err then
print("Error addding channel: " ..err)
end
if autoJoin ~= nil then
channel.AutoJoin = autoJoin
if autoJoin then
for _, speaker in pairs(self.Speakers) do
speaker:JoinChannel(channelName)
end
end
end
return channel
end
function methods:RemoveChannel(channelName)
if (self.ChatChannels[channelName:lower()]) then
local n = self.ChatChannels[channelName:lower()].Name
self.ChatChannels[channelName:lower()]:InternalDestroy()
self.ChatChannels[channelName:lower()] = nil
local success, err = pcall(function() self.eChannelRemoved:Fire(n) end)
if not success and err then
print("Error removing channel: " ..err)
end
else
warn(string.format("Channel %q does not exist.", channelName))
end
end
function methods:GetChannel(channelName)
return self.ChatChannels[channelName:lower()]
end
function methods:AddSpeaker(speakerName)
if (self.Speakers[speakerName:lower()]) then
error("Speaker \"" .. speakerName .. "\" already exists!")
end
local speaker = Speaker.new(self, speakerName)
self.Speakers[speakerName:lower()] = speaker
local success, err = pcall(function() self.eSpeakerAdded:Fire(speakerName) end)
if not success and err then
print("Error adding speaker: " ..err)
end
return speaker
end
function methods:InternalUnmuteSpeaker(speakerName)
for channelName, channel in pairs(self.ChatChannels) do
if channel:IsSpeakerMuted(speakerName) then
channel:UnmuteSpeaker(speakerName)
end
end
end
function methods:RemoveSpeaker(speakerName)
if (self.Speakers[speakerName:lower()]) then
local n = self.Speakers[speakerName:lower()].Name
self:InternalUnmuteSpeaker(n)
self.Speakers[speakerName:lower()]:InternalDestroy()
self.Speakers[speakerName:lower()] = nil
local success, err = pcall(function() self.eSpeakerRemoved:Fire(n) end)
if not success and err then
print("Error removing speaker: " ..err)
end
else
warn("Speaker \"" .. speakerName .. "\" does not exist!")
end
end
function methods:GetSpeaker(speakerName)
return self.Speakers[speakerName:lower()]
end
function methods:GetSpeakerByUserOrDisplayName(speakerName)
local speakerByUserName = self.Speakers[speakerName:lower()]
if speakerByUserName then
return speakerByUserName
end
for _, potentialSpeaker in pairs(self.Speakers) do
local player = potentialSpeaker:GetPlayer()
if player and player.DisplayName:lower() == speakerName:lower() then
return potentialSpeaker
end
end
end
function methods:GetChannelList()
local list = {}
for i, channel in pairs(self.ChatChannels) do
if (not channel.Private) then
table.insert(list, channel.Name)
end
end
return list
end
function methods:GetAutoJoinChannelList()
local list = {}
for i, channel in pairs(self.ChatChannels) do
if channel.AutoJoin then
table.insert(list, channel)
end
end
return list
end
function methods:GetSpeakerList()
local list = {}
for i, speaker in pairs(self.Speakers) do
table.insert(list, speaker.Name)
end
return list
end
function methods:SendGlobalSystemMessage(message)
for i, speaker in pairs(self.Speakers) do
speaker:SendSystemMessage(message, "All")
end
end
function methods:RegisterFilterMessageFunction(funcId, func, priority)
if self.FilterMessageFunctions:HasFunction(funcId) then
error(string.format("FilterMessageFunction '%s' already exists", funcId))
end
self.FilterMessageFunctions:AddFunction(funcId, func, priority)
end
function methods:FilterMessageFunctionExists(funcId)
return self.FilterMessageFunctions:HasFunction(funcId)
end
function methods:UnregisterFilterMessageFunction(funcId)
if not self.FilterMessageFunctions:HasFunction(funcId) then
error(string.format("FilterMessageFunction '%s' does not exists", funcId))
end
self.FilterMessageFunctions:RemoveFunction(funcId)
end
function methods:RegisterProcessCommandsFunction(funcId, func, priority)
if self.ProcessCommandsFunctions:HasFunction(funcId) then
error(string.format("ProcessCommandsFunction '%s' already exists", funcId))
end
self.ProcessCommandsFunctions:AddFunction(funcId, func, priority)
end
function methods:ProcessCommandsFunctionExists(funcId)
return self.ProcessCommandsFunctions:HasFunction(funcId)
end
function methods:UnregisterProcessCommandsFunction(funcId)
if not self.ProcessCommandsFunctions:HasFunction(funcId) then
error(string.format("ProcessCommandsFunction '%s' does not exist", funcId))
end
self.ProcessCommandsFunctions:RemoveFunction(funcId)
end
local LastFilterNoficationTime = 0
local LastFilterIssueTime = 0
local FilterIssueCount = 0
function methods:InternalNotifyFilterIssue()
if (tick() - LastFilterIssueTime) > FILTER_THRESHOLD_TIME then
FilterIssueCount = 0
end
FilterIssueCount = FilterIssueCount + 1
LastFilterIssueTime = tick()
if FilterIssueCount >= FILTER_NOTIFCATION_THRESHOLD then
if (tick() - LastFilterNoficationTime) > FILTER_NOTIFCATION_INTERVAL then
LastFilterNoficationTime = tick()
local systemChannel = self:GetChannel("System")
if systemChannel then
systemChannel:SendSystemMessage(
ChatLocalization:FormatMessageToSend(
"GameChat_ChatService_ChatFilterIssues",
"The chat filter is currently experiencing issues and messages may be slow to appear."
),
errorExtraData
)
end
end
end
end
local StudioMessageFilteredCache = {}
|
--Put in ReplicatedFirst--
|
local StarterGui = game:GetService("StarterGui")
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.EmotesMenu, false)
|
-- FUNCTIONS --
|
humanoid:SetStateEnabled(Enum.HumanoidStateType.FallingDown, false)
humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, false)
local head = char:WaitForChild("Head")
head.Shape = Enum.PartType.Ball
head.Size = Vector3.new(1,1,1)
CS:GetInstanceAddedSignal("Ragdoll"):Connect(function(v)
if v == char then
humanoid:ChangeState(Enum.HumanoidStateType.Physics)
hrp:ApplyAngularImpulse(Vector3.new(-90, 0, 0))
end
end)
CS:GetInstanceRemovedSignal("Ragdoll"):Connect(function(v)
if v == char then
humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
end
end)
|
-- CreateFadeFunctions usage:
-- fadeObjects is a map of text labels and button to start and end values for a given property.
-- e.g {
-- NameButton = {
-- TextTransparency = {
-- FadedIn = 0.5,
-- FadedOut = 1,
-- }
-- },
-- ImageOne = {
-- ImageTransparency = {
-- FadedIn = 0,
-- FadedOut = 0.5,
-- }
-- }
-- }
|
function methods:CreateFadeFunctions(fadeObjects)
local AnimParams = {}
for object, properties in pairs(fadeObjects) do
AnimParams[object] = {}
for property, values in pairs(properties) do
AnimParams[object][property] = {
Target = values.FadedIn,
Current = object[property],
NormalizedExptValue = 1,
}
end
end
local function FadeInFunction(duration, CurveUtil)
for object, properties in pairs(AnimParams) do
for property, values in pairs(properties) do
values.Target = fadeObjects[object][property].FadedIn
values.NormalizedExptValue = CurveUtil:NormalizedDefaultExptValueInSeconds(duration)
end
end
end
local function FadeOutFunction(duration, CurveUtil)
for object, properties in pairs(AnimParams) do
for property, values in pairs(properties) do
values.Target = fadeObjects[object][property].FadedOut
values.NormalizedExptValue = CurveUtil:NormalizedDefaultExptValueInSeconds(duration)
end
end
end
local function AnimGuiObjects()
for object, properties in pairs(AnimParams) do
for property, values in pairs(properties) do
object[property] = values.Current
end
end
end
local function UpdateAnimFunction(dtScale, CurveUtil)
for object, properties in pairs(AnimParams) do
for property, values in pairs(properties) do
values.Current = CurveUtil:Expt(
values.Current,
values.Target,
values.NormalizedExptValue,
dtScale
)
end
end
AnimGuiObjects()
end
return FadeInFunction, FadeOutFunction, UpdateAnimFunction
end
function methods:NewBindableEvent(name)
local bindable = Instance.new("BindableEvent")
bindable.Name = name
return bindable
end
|
--[=[
Destroys the ClientRemoteSignal object.
]=]
|
function ClientRemoteSignal:Destroy()
if self._signal then
self._signal:Destroy()
end
end
return ClientRemoteSignal
|
--[[Engine]]
--Torque Curve
|
Tune.Horsepower = 370 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 6000 -- Use sliders to manipulate values
Tune.Redline = 6700 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
|
-- Load tool completely before proceeding
|
local Indicator = Tool:WaitForChild 'Loaded';
while not Indicator.Value do
Indicator.Changed:Wait();
end;
|
-------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------
|
function onRunning(speed)
if speed>0.01 then
if Figure and Humanoid and Humanoid.WalkSpeed<13 then
playAnimation("walk", 0.1, Humanoid);
elseif Figure and Humanoid and Humanoid.WalkSpeed>13 then
playAnimation("run", 0.1, Humanoid);
end;
if currentAnimInstance and currentAnimInstance.AnimationId == "http://www.roblox.com/asset/?id=180426354" then
setAnimationSpeed(speed / 14.5)
end
pose = "Running"
else
playAnimation("idle", 0.1, Humanoid)
pose = "Standing"
end
end
function onDied()
pose = "Dead"
end
function onJumping()
playAnimation("jump", 0.1, Humanoid)
jumpAnimTime = jumpAnimDuration
pose = "Jumping"
end
function onClimbing(speed)
playAnimation("climb", 0.1, Humanoid)
setAnimationSpeed(speed / 12.0)
pose = "Climbing"
end
function onGettingUp()
pose = "GettingUp"
end
function onFreeFall()
if (jumpAnimTime <= 0) then
playAnimation("fall", fallTransitionTime, Humanoid)
end
pose = "FreeFall"
end
function onFallingDown()
pose = "FallingDown"
end
function onSeated()
pose = "Seated"
end
function onPlatformStanding()
pose = "PlatformStanding"
end
function onSwimming(speed)
if speed>0 then
pose = "Running"
else
pose = "Standing"
end
end
function getTool()
for _, kid in ipairs(Figure:GetChildren()) do
if kid.className == "Tool" then return kid end
end
return nil
end
function getToolAnim(tool)
for _, c in ipairs(tool:GetChildren()) do
if c.Name == "toolanim" and c.className == "StringValue" then
return c
end
end
return nil
end
function animateTool()
if (toolAnim == "None") then
playToolAnimation("toolnone", toolTransitionTime, Humanoid)
return
end
if (toolAnim == "Slash") then
playToolAnimation("toolslash", 0, Humanoid)
return
end
if (toolAnim == "Lunge") then
playToolAnimation("toollunge", 0, Humanoid)
return
end
end
function moveSit()
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
RightShoulder:SetDesiredAngle(3.14 /2)
LeftShoulder:SetDesiredAngle(-3.14 /2)
RightHip:SetDesiredAngle(3.14 /2)
LeftHip:SetDesiredAngle(-3.14 /2)
end
local lastTick = 0
function move(time)
local amplitude = 1
local frequency = 1
local deltaTime = time - lastTick
lastTick = time
local climbFudge = 0
local setAngles = false
if (jumpAnimTime > 0) then
jumpAnimTime = jumpAnimTime - deltaTime
end
if (pose == "FreeFall" and jumpAnimTime <= 0) then
playAnimation("fall", fallTransitionTime, Humanoid)
elseif (pose == "Seated") then
playAnimation("sit", 0.5, Humanoid)
return
elseif (pose == "Running") then
if Figure and Humanoid and Humanoid.WalkSpeed<13 then
playAnimation("walk", 0.1, Humanoid);
elseif Figure and Humanoid and Humanoid.WalkSpeed>13 then
playAnimation("run", 0.1, Humanoid);
end;
elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
stopAllAnimations()
amplitude = 0.1
frequency = 1
setAngles = true
end
if (setAngles) then
local desiredAngle = amplitude * math.sin(time * frequency)
RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
RightHip:SetDesiredAngle(-desiredAngle)
LeftHip:SetDesiredAngle(-desiredAngle)
end
|
--SockPuppetCow
|
local prev
local parts = script.Parent:GetChildren()
for i = 1, #parts do
if parts[i]:IsA("BasePart") or parts[i]:IsA("Part")then
if prev ~= nil then
local w = Instance.new("Weld")
w.Part0 = prev
w.Part1 = parts[i]
w.C0 = prev.CFrame:inverse()
w.C1 = parts[i].CFrame:inverse()
w.Parent = prev
end
prev = parts[i]
end
end
|
--MESSAGE--LOCALS
|
local Message = Player.PlayerGui:WaitForChild("ScreenGui").Message
|
-- This screenGui exists so that the billboardGui is not deleted when the PlayerGui is reset.
|
local BubbleChatScreenGui = Instance.new("ScreenGui")
BubbleChatScreenGui.Name = "BubbleChat"
BubbleChatScreenGui.ResetOnSpawn = false
BubbleChatScreenGui.Parent = PlayerGui
|
-- Helpers
|
function Keymap.KeysForAction(actionName)
local keys = {}
for i, keyInfo in ipairs(Keymap[actionName]) do
keys[i] = keyInfo.KeyCode
end
return keys
end
function Keymap.allKeys()
local tbl = {}
for k, _ in pairs(_inputData) do
table.insert(tbl, k)
end
return tbl
end
function Keymap.getData(key)
return _inputData[key]
end
function Keymap.newInputTable()
local tbl = {}
for k, _ in pairs(_inputData) do
tbl[k] = 0
end
return tbl
end
|
-- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
|
local emoteNames = { wave = false, point = false, dance = true, dance2 = true, dance3 = true, laugh = false, cheer = false}
math.randomseed(tick())
function configureAnimationSet(name, fileList)
if (animTable[name] ~= nil) then
for _, connection in pairs(animTable[name].connections) do
connection:disconnect()
end
end
animTable[name] = {}
animTable[name].count = 0
animTable[name].totalWeight = 0
animTable[name].connections = {}
local allowCustomAnimations = true
local AllowDisableCustomAnimsUserFlag = false
local success, msg = pcall(function()
AllowDisableCustomAnimsUserFlag = UserSettings():IsUserFeatureEnabled("UserAllowDisableCustomAnims2")
end)
if (AllowDisableCustomAnimsUserFlag) then
local success, msg = pcall(function() allowCustomAnimations = game:GetService("StarterPlayer").AllowCustomAnimations end)
if not success then
allowCustomAnimations = true
end
end
-- check for config values
local config = script:FindFirstChild(name)
if (allowCustomAnimations and config ~= nil) then
table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end))
table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end))
local idx = 1
for _, childPart in pairs(config:GetChildren()) do
if (childPart:IsA("Animation")) then
table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end))
animTable[name][idx] = {}
animTable[name][idx].anim = childPart
local weightObject = childPart:FindFirstChild("Weight")
if (weightObject == nil) then
animTable[name][idx].weight = 1
else
animTable[name][idx].weight = weightObject.Value
end
animTable[name].count = animTable[name].count + 1
animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
idx = idx + 1
end
end
end
-- fallback to defaults
if (animTable[name].count <= 0) then
for idx, anim in pairs(fileList) do
animTable[name][idx] = {}
animTable[name][idx].anim = Instance.new("Animation")
animTable[name][idx].anim.Name = name
animTable[name][idx].anim.AnimationId = anim.id
animTable[name][idx].weight = anim.weight
animTable[name].count = animTable[name].count + 1
animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
|
-- Dropdowns
|
function Icon:setDropdown(arrayOfIcons)
-- Reset any previous icons
for i, otherIcon in pairs(self.dropdownIcons) do
otherIcon:leave()
end
-- Apply new icons
if type(arrayOfIcons) == "table" then
for i, otherIcon in pairs(arrayOfIcons) do
otherIcon:join(self, "dropdown", true)
end
end
-- Update dropdown
self:_updateDropdown()
return self
end
function Icon:_updateDropdown()
local values = {
maxIconsBeforeScroll = self:get("dropdownMaxIconsBeforeScroll") or "_NIL",
minWidth = self:get("dropdownMinWidth") or "_NIL",
padding = self:get("dropdownListPadding") or "_NIL",
dropdownAlignment = self:get("dropdownAlignment") or "_NIL",
iconAlignment = self:get("alignment") or "_NIL",
scrollBarThickness = self:get("dropdownScrollBarThickness") or "_NIL",
}
for k, v in pairs(values) do if v == "_NIL" then return end end
local YPadding = values.padding.Offset
local dropdownContainer = self.instances.dropdownContainer
local dropdownFrame = self.instances.dropdownFrame
local dropdownList = self.instances.dropdownList
local totalIcons = #self.dropdownIcons
local lastVisibleIconIndex = (totalIcons > values.maxIconsBeforeScroll and values.maxIconsBeforeScroll) or totalIcons
local newCanvasSizeY = -YPadding
local newFrameSizeY = 0
local newMinWidth = values.minWidth
table.sort(self.dropdownIcons, function(a,b) return a:get("order") < b:get("order") end)
for i = 1, totalIcons do
local otherIcon = self.dropdownIcons[i]
local _, otherIconSize = otherIcon:get("iconSize", nil, "beforeDropdown")
local increment = otherIconSize.Y.Offset + YPadding
if i <= lastVisibleIconIndex then
newFrameSizeY = newFrameSizeY + increment
end
if i == totalIcons then
newFrameSizeY = newFrameSizeY + increment/4
end
newCanvasSizeY = newCanvasSizeY + increment
local otherIconWidth = otherIconSize.X.Offset --+ 4 + 100 -- the +100 is to allow for notices
if otherIconWidth > newMinWidth then
newMinWidth = otherIconWidth
end
-- This ensures the dropdown is navigated fully and correctly with a controller
local prevIcon = (i == 1 and self) or self.dropdownIcons[i-1]
local nextIcon = self.dropdownIcons[i+1]
otherIcon.instances.iconButton.NextSelectionUp = prevIcon and prevIcon.instances.iconButton
otherIcon.instances.iconButton.NextSelectionDown = nextIcon and nextIcon.instances.iconButton
end
local finalCanvasSizeY = (lastVisibleIconIndex == totalIcons and 0) or newCanvasSizeY
self:set("dropdownCanvasSize", UDim2.new(0, 0, 0, finalCanvasSizeY))
self:set("dropdownSize", UDim2.new(0, (newMinWidth+4)*2, 0, newFrameSizeY))
-- Set alignment while considering screen bounds
local dropdownAlignment = values.dropdownAlignment:lower()
local alignmentDetails = {
left = {
AnchorPoint = Vector2.new(0, 0),
PositionXScale = 0,
ThicknessMultiplier = 0,
},
mid = {
AnchorPoint = Vector2.new(0.5, 0),
PositionXScale = 0.5,
ThicknessMultiplier = 0.5,
},
right = {
AnchorPoint = Vector2.new(0.5, 0),
PositionXScale = 1,
FrameAnchorPoint = Vector2.new(0, 0),
FramePositionXScale = 0,
ThicknessMultiplier = 1,
}
}
local alignmentDetail = alignmentDetails[dropdownAlignment]
if not alignmentDetail then
alignmentDetail = alignmentDetails[values.iconAlignment:lower()]
end
dropdownContainer.AnchorPoint = alignmentDetail.AnchorPoint
dropdownContainer.Position = UDim2.new(alignmentDetail.PositionXScale, 0, 1, YPadding+0)
local scrollbarThickness = values.scrollBarThickness
local newThickness = scrollbarThickness * alignmentDetail.ThicknessMultiplier
local additionalOffset = (dropdownFrame.VerticalScrollBarPosition == Enum.VerticalScrollBarPosition.Right and newThickness) or -newThickness
dropdownFrame.AnchorPoint = alignmentDetail.FrameAnchorPoint or alignmentDetail.AnchorPoint
dropdownFrame.Position = UDim2.new(alignmentDetail.FramePositionXScale or alignmentDetail.PositionXScale, additionalOffset, 0, 0)
self._dropdownCanvasPos = Vector2.new(0, 0)
end
function Icon:_dropdownIgnoreClipping()
self:_ignoreClipping("dropdown")
end
|
--!strict
|
local LuauPolyfill = script.Parent.Parent
local types = require(LuauPolyfill.types)
type Array<T> = types.Array<T>
type Object = types.Object
type callbackFn<T, U> = (element: T, index: number, array: Array<T>) -> U
type callbackFnWithThisArg<T, U, V> = (thisArg: V, element: T, index: number, array: Array<T>) -> U
|
--[[**
ensures Lua primitive userdata type
@param value The value to check against
@returns True iff the condition is satisfied, false otherwise
**--]]
|
t.userdata = primitive("userdata")
|
-------------------------- Custom Command Stuff --------------------------
--[[
Player = Returns a table of all the players it could find with your given command
String = Returns a string that you've given it
Number = Returns a given number
--]]
|
local Custom_Commands = {
|
-- Locals --
|
local workcam = workspace.CurrentCamera
local player = game.Players.LocalPlayer
local menCam = game.Workspace.MenuItems.CameraF
local focus = game.Workspace.MenuItems.Face
|
-- local throttleNeeded =
|
local stallLine = ((stallSpeed/math.floor(currentSpeed+0.5))*(stallSpeed/max))
stallLine = (stallLine > 1 and 1 or stallLine)
panel.Throttle.Bar.StallLine.Position = UDim2.new(stallLine,0,0,0)
panel.Throttle.Bar.StallLine.BackgroundColor3 = (stallLine > panel.Throttle.Bar.Amount.Size.X.Scale and Color3.new(1,0,0) or Color3.new(0,0,0))
if (change == 1) then
currentSpeed = (currentSpeed > desiredSpeed and desiredSpeed or currentSpeed) -- Reduce "glitchy" speed
else
currentSpeed = (currentSpeed < desiredSpeed and desiredSpeed or currentSpeed)
end
local tax,stl = taxi(),stall()
if ((lastStall) and (not stl) and (not tax)) then -- Recovering from a stall:
if ((realSpeed > -10000) and (realSpeed < 10000)) then
currentSpeed = realSpeed
else
currentSpeed = (stallSpeed+1)
end
end
lastStall = stl
move.velocity = (main.CFrame.lookVector*currentSpeed) -- Set speed to aircraft
local bank = ((((m.ViewSizeX/2)-m.X)/(m.ViewSizeX/2))*maxBank) -- My special equation to calculate the banking of the plane. It's pretty simple actually
bank = (bank < -maxBank and -maxBank or bank > maxBank and maxBank or bank)
if (tax) then
if (currentSpeed < 2) then -- Stop plane from moving/turning when idled on ground
move.maxForce = Vector3.new(0,0,0)
gyro.maxTorque = Vector3.new(0,0,0)
else
move.maxForce = Vector3.new(math.huge,0,math.huge) -- Taxi
gyro.maxTorque = Vector3.new(0,math.huge,0)
gyro.cframe = CFrame.new(main.Position,m.Hit.p)
end
elseif (stl) then
move.maxForce = Vector3.new(0,0,0) -- Stall
gyro.maxTorque = Vector3.new(math.huge,math.huge,math.huge)
gyro.cframe = (m.Hit*CFrame.Angles(0,0,math.rad(bank)))
else
move.maxForce = Vector3.new(math.huge,math.huge,math.huge) -- Fly
gyro.maxTorque = Vector3.new(math.huge,math.huge,math.huge)
gyro.cframe = (m.Hit*CFrame.Angles(0,0,math.rad(bank)))
end
if ((altRestrict) and (main.Position.y < altMin)) then -- If you have altitude restrictions and are below the minimun altitude, then make the plane explode
plane.AutoCrash.Value = true
end
updateGui(tax,stl) -- Keep the pilot informed!
wait()
end
end
script.Parent.Selected:connect(function(m) -- Initial setup
selected,script.Parent.CurrentSelect.Value = true,true
mouseSave = m
game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Attach
m.Icon = "http://www.roblox.com/asset/?id=48801855" -- Mouse icon used in Perilous Skies
gui.Parent = player.PlayerGui
delay(0,function() fly(m) end) -- Basically a coroutine
m.KeyDown:connect(function(k)
if (not flying) then return end
k = k:lower()
if (k == keys.engine.key) then
on = (not on)
if (not on) then throttle = 0 end
elseif (k == keys.landing.key) then
changeGear()
elseif (k:byte() == keys.spdup.byte) then
keys.spdup.down = true
delay(0,function()
while ((keys.spdup.down) and (on) and (flying)) do
throttle = (throttle+throttleInc)
throttle = (throttle > 1 and 1 or throttle)
wait()
end
end)
elseif (k:byte() == keys.spddwn.byte) then
keys.spddwn.down = true
delay(0,function()
while ((keys.spddwn.down) and (on) and (flying)) do
throttle = (throttle-throttleInc)
throttle = (throttle < 0 and 0 or throttle)
wait()
end
end)
end
end)
m.KeyUp:connect(function(k)
if (k:byte() == keys.spdup.byte) then
keys.spdup.down = false
elseif (k:byte() == keys.spddwn.byte) then
keys.spddwn.down = false
end
end)
end)
function deselected(forced)
selected,script.Parent.CurrentSelect.Value = false,false
game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
gui.Parent = nil
flying = false
pcall(function()
move.maxForce = Vector3.new(0,0,0)
if (taxi()) then
gyro.maxTorque = Vector3.new(0,0,0)
else
plane.Dead.Value = true
end
end)
if (forced) then
if (mouseSave) then
mouseSave.Icon = "rbxasset://textures\\ArrowCursor.png" -- If you remove a tool without the actual deselect event, the icon will not go back to normal. This helps simulate it at the least
wait()
end
script.Parent.Deselect1.Value = true -- When this is triggered, the Handling script knows it is safe to remove the tool from the player
end
end
script.Parent.Deselected:connect(deselected)
script.Parent.Deselect0.Changed:connect(function() -- When you get out of the seat while the tool is selected, Deselect0 is triggered to True
if (script.Parent.Deselect0.Value) then
deselected(true)
end
end)
|
--------SETTINGS--------
|
local ITEM_NAME = "SMG"
local ITEM_PRICE = 10
local CURRENCY_NAME = "Cash"
|
--[[
Defers and orders UI data binding updates.
]]
|
local RunService = game:GetService("RunService")
local Package = script.Parent.Parent
local Types = require(Package.Types)
local None = require(Package.Utility.None)
local Scheduler = {}
local willUpdate = false
local propertyChanges: {[Instance]: {[string]: any}} = {}
local callbacks: Types.Set<() -> ()> = {}
|
--// Remote
|
return function(Vargs, GetEnv)
local env = GetEnv(nil, {script = script})
setfenv(1, env)
local server = Vargs.Server;
local service = Vargs.Service;
local Functions, Admin, Anti, Core, HTTP, Logs, Remote, Process, Variables, Settings, Defaults, Commands
local function Init()
Functions = server.Functions;
Admin = server.Admin;
Anti = server.Anti;
Core = server.Core;
HTTP = server.HTTP;
Logs = server.Logs;
Remote = server.Remote;
Process = server.Process;
Variables = server.Variables;
Settings = server.Settings;
Defaults = server.Defaults;
Commands = server.Commands
Remote.Init = nil;
Logs:AddLog("Script", "Remote Module Initialized")
end;
local function RunAfterPlugins(data)
for com in Remote.Commands do
if string.len(com) > Remote.MaxLen then
Remote.MaxLen = string.len(com)
end
end
--// Start key check loop
service.StartLoop("ClientKeyCheck", 60, Remote.CheckKeys, true);
Remote.RunAfterPlugins = nil;
Logs:AddLog("Script", "Remote Module RunAfterPlugins Finished");
end
server.Remote = {
Init = Init;
RunAfterPlugins = RunAfterPlugins;
MaxLen = 0;
Clients = {};
Returns = {};
Sessions = {};
PendingReturns = {};
EncodeCache = {};
DecodeCache = {};
RemoteExecutionConfirmed = {};
TimeUntilKeyDestroyed = 60 * 5; --// How long until a player's key data should be completely removed?
--// Settings any client/user can grab
AllowedSettings = {
Theme = true;
MobileTheme = true;
DefaultTheme = true;
HelpButtonImage = true;
Prefix = true;
PlayerPrefix = true;
SpecialPrefix = true;
BatchKey = true;
AnyPrefix = true;
DonorCommands = true;
DonorCapes = true;
ConsoleKeyCode = true;
SplitKey = true;
};
--// Settings that are never sent to the client
--// These are blacklisted at the datastore level and cannot be updated in-game
BlockedSettings = {
Trello_Enabled = true;
Trello_Primary = true;
Trello_Secondary = true;
Trello_Token = true;
Trello_AppKey = true;
HideScript = true; -- Changing in-game will do nothing; Not able to be saved
DataStore = true;
DataStoreKey = true;
DataStoreEnabled = true;
LocalDatastore = true;
LoadAdminsFromDS = true;
Creators = true;
Permissions = true;
G_API = true;
G_Access = true;
G_Access_Key = true;
G_Access_Perms = true;
Allowed_API_Calls = true;
WebPanel_ApiKey = true;
WebPanel_Enabled = true;
OnStartup = true;
OnSpawn = true;
OnJoin = true;
CustomRanks = true;
Ranks = true;
Commands = true;
};
Returnables = {
RateLimits = function(p: Player,args: {[number]: any})
return server.Process.RateLimits
end;
Test = function(p: Player,args: {[number]: any})
return "HELLO FROM THE OTHER SIDE :)!"
end;
Ping = function(p: Player,args: {[number]: any})
return "Pong"
end;
Filter = function(p: Player,args: {[number]: any})
return service.Filter(args[1],args[2],args[3])
end;
BroadcastFilter = function(p: Player,args: {[number]: any})
return service.BroadcastFilter(args[1],args[2] or p)
end;
TaskManager = function(p: Player,args: {[number]: any})
if Admin.GetLevel(p) >= Settings.Ranks.Creators.Level then
local action = args[1]
if action == "GetTasks" then
local tab = {}
for _, v in service.GetTasks() do
local new = {
Status = v.Status;
Name = v.Name;
Index = v.Index;
Created = v.Created;
Function = tostring(v.Function);
}
table.insert(tab,new)
end
return tab
end
end
end;
ExecutePermission = function(p: Player,args: {[number]: any})
return Core.ExecutePermission(args[1],args[2],true)
end;
Variable = function(p: Player,args: {[number]: any})
return Variables[args[1]]
end;
Default = function(p: Player,args: {[number]: any})
local setting = args[1]
local level = Admin.GetLevel(p)
local ret
local blocked = {
DataStore = true;
DataStoreKey = true;
Trello_Enabled = true;
Trello_PrimaryBoard = true;
Trello_SecondaryBoards = true;
Trello_AppKey = true;
Trello_Token = true;
--G_Access = true;
G_Access_Key = true;
WebPanel_ApiKey = true;
--G_Access_Perms = true;
--Allowed_API_Calls = true;
}
if type(setting) == "table" then
ret = {}
for _,set in setting do
if Defaults[set] and (not blocked[set] or level >= Settings.Ranks.Creators.Level) then
ret[set] = Defaults[set]
end
end
elseif type(setting) == "string" then
if Defaults[setting] and (not blocked[setting] or level >= Settings.Ranks.Creators.Level) then
ret = Defaults[setting]
end
end
return ret
end;
AllDefaults = function(p: Player,args: {[number]: any})
if Admin.GetLevel(p) >= Settings.Ranks.Creators.Level then
local sets = {
Settings = table.clone(Defaults);
Descs = server.Descriptions;
Order = server.Order;
}
local blocked = {
HideScript = true; -- Changing in-game will do nothing; Not able to be saved
DataStore = true;
DataStoreKey = true;
DataStoreEnabled = true;
LocalDatastore = true;
--Trello_Enabled = true;
--Trello_PrimaryBoard = true;
--Trello_SecondaryBoards = true;
Trello_AppKey = true;
Trello_Token = true;
G_API = true;
G_Access = true;
G_Access_Key = true;
G_Access_Perms = true;
Allowed_API_Calls = true;
WebPanel_ApiKey = true;
WebPanel_Enabled = true;
OnStartup = true;
OnSpawn = true;
OnJoin = true;
CustomRanks = true; -- Not supported yet
Ranks = true;
Commands = true;
}
for setting in sets.Settings do
if blocked[setting] then
sets.Settings[setting] = nil
end
end
return sets
end
end;
Setting = function(p: Player,args: {[number]: any})
local setting = args[1]
local level = Admin.GetLevel(p)
local ret
local allowed = Remote.AllowedSettings
if type(setting) == "table" then
ret = {}
for _,set in setting do
if Settings[set] and (allowed[set] or level>=Settings.Ranks.Creators.Level) then
ret[set] = Settings[set]
end
end
elseif type(setting) == "string" then
if Settings[setting] and (allowed[setting] or level>=Settings.Ranks.Creators.Level) then
ret = Settings[setting]
end
end
return ret
end;
AllSettings = function(p: Player,args: {[number]: any})
if Admin.GetLevel(p) >= Settings.Ranks.Creators.Level then
local sets = {
Settings = table.clone(Settings);
Descs = server.Descriptions;
Order = server.Order;
}
local blocked = Remote.BlockedSettings
for setting in sets.Settings do
if blocked[setting] then
sets.Settings[setting] = nil
end
end
return sets
end
end;
UpdateList = function(p: Player,args: {[number]: any})
local list = args[1]
local update = Logs.ListUpdaters[list]
if update then
return update(p, unpack(args,2))
end
end;
AdminLevel = function(p: Player,args: {[number]: any})
return Admin.GetLevel(p)
end;
Keybinds = function(p: Player,args: {[number]: any})
local playerData = Core.GetPlayer(p)
return playerData.Keybinds or {}
end;
UpdateKeybinds = function(p: Player,args: {[number]: any})
local playerData = Core.GetPlayer(p)
local binds = args[1]
local resp = "OK"
if type(binds) == "table" then
playerData.Keybinds = binds
Core.SavePlayer(p,playerData)
resp = "Updated"
else
resp = "Error"
end
return resp
end;
Playlist = function(p: Player,args: {[number]: any})
local playerData = Core.GetPlayer(p)
return playerData.CustomPlaylist or {}
end;
UpdatePlaylist = function(p: Player,args: {[number]: any})
local resp = "Error: Unknown Error"
if type(args)=="table" then
if string.len(service.HttpService:JSONEncode(args)) < 4000 then
local playerData = Core.GetPlayer(p)
playerData.CustomPlaylist = args[1]
Core.SavePlayer(p,playerData)
resp = "Updated"
else
resp = "Error: Playlist is too big (4000+ chars)"
end
else
resp = "Error: Data is not a valid table"
end
return resp
end;
UpdateClient = function(p: Player,args: {[number]: any})
local playerData = Core.GetPlayer(p)
local setting = args[1]
local value = args[2]
local data = playerData.Client or {}
data[setting] = value
playerData.Client = data
Core.SavePlayer(p, playerData)
return "Updated"
end;
UpdateDonor = function(p: Player,args: {[number]: any})
local playerData = Core.GetPlayer(p)
local donor = args[1]
local resp = "OK"
if type(donor) == "table" and donor.Cape and type(donor.Cape) == "table" then
playerData.Donor = donor
Core.SavePlayer(p, playerData)
if donor.Enabled then
Functions.Donor(p)
else
Functions.UnCape(p)
end
resp = "Updated"
else
resp = "Error"
end
return resp
end;
UpdateAliases = function(p: Player,args: {[number]: any})
local aliases = args[1] or {};
if type(aliases) == "table" then
local data = Core.GetPlayer(p)
--// check for stupid stuff
for i,v in aliases do
if type(i) ~= "string" or type(v) ~= "string" then
aliases[i] = nil
end
end
data.Aliases = aliases;
end
end;
PlayerData = function(p: Player,args: {[number]: any})
local data = Core.GetPlayer(p)
data.isDonor = Admin.CheckDonor(p)
return data
end;
CheckAdmin = function(p: Player,args: {[number]: any})
return Admin.CheckAdmin(p)
end;
SearchCommands = function(p: Player,args: {[number]: any})
return Admin.SearchCommands(p,args[1] or "all")
end;
CheckBackpack = function(p: Player,args: {[number]: any})
return Anti.CheckBackpack(p,args[1])
end;
FormattedCommands = function(p: Player,args: {[number]: any})
local commands = Admin.SearchCommands(p,args[1] or "all")
local tab = {}
for _,v in commands do
if not v.Hidden and not v.Disabled then
for a in v.Commands do
table.insert(tab,Admin.FormatCommand(v,a))
end
end
end
return tab
end;
TerminalData = function(p: Player,args: {[number]: any})
if Admin.GetLevel(p) >= Settings.Ranks.Creators.Level then
local entry = Remote.Terminal.Data[tostring(p.UserId)]
if not entry then
Remote.Terminal.Data[tostring(p.UserId)] = {
Player = p;
Output = {};
}
end
return {
ServerLogs = service.LogService:GetLogHistory();
ClientLogs = {};
ScriptLogs = Logs.Script;
AdminLogs = Logs.Commands;
ErrorLogs = Logs.Errors;
ChatLogs = Logs.Chats;
JoinLogs = Logs.Joins;
Replications = Logs.Replications;
Exploit = Logs.Exploit;
}
end
end;
Terminal = function(p: Player,args: {[number]: any})
if Admin.GetLevel(p) >= Settings.Ranks.Creators.Level then
local data = args[2]
local message = args[1]
local command = string.match(message, "(.-) ") or message
local argString = string.match(message, "^.- (.+)") or ""
local comTable = Remote.Terminal.GetCommand(command)
if comTable then
local cArgs = Functions.Split(argString, " ", comTable.Arguments)
local ran,ret = pcall(comTable.Function,p,cArgs,data)
if ran then
return ret
else
return {
`COMMAND ERROR: {ret}`
}
end
else
return {
`Could not find any command matching "{command}"`
}
end
end
end;
AudioLib = function(p,args)
local canUseGlobalBroadcast
local cmd, ind
for i, v in Admin.SearchCommands(p, "all") do
for _, c in ipairs(v.Commands) do
if `{v.Prefix or ""}{string.lower(c) == `{(v.Prefix or "")}music`}` then
cmd, ind = v, i
break
end
end
if ind then break end
end
if cmd then
canUseGlobalBroadcast = true
else
canUseGlobalBroadcast = false
end
if canUseGlobalBroadcast then
if not server.Functions.AudioLib then
local audioLibFolder = service.SoundService:FindFirstChild("ADONIS_AUDIOLIB")
if not audioLibFolder then
audioLibFolder = service.New("Folder")
audioLibFolder.Name = "ADONIS_AUDIOLIB"
audioLibFolder.Parent = service.SoundService
end
server.Functions.AudioLib = require(server.Shared.AudioLib).new(service.UnWrap(audioLibFolder))
end
return server.Functions.AudioLib[args[1][1]](server.Functions.AudioLib, args[1][2])
end
end;
};
Terminal = {
Data = {};
Format = function(msg,data) (data or {}).Text = msg end;
Output = function(tab,msg,mata) table.insert(tab,Remote.Terminal.Format(msg,mata)) end;
GetCommand = function(cmd) for i,com in Remote.Terminal.Commands do if com.Command:lower() == cmd:lower() then return com end end end;
LiveOutput = function(p,data,type) Remote.FireEvent(p,"TerminalLive",{Data = data; Type = type or "Terminal";}) end;
Commands = {
Help = {
Usage = "help";
Command = "help";
Arguments = 0;
Description = "Shows a list of available commands and their usage";
Function = function(p,args,data)
local output = {}
for i,v in Remote.Terminal.Commands do
table.insert(output, `{v.Usage}{string.rep(" ",30-string.len(tostring(v.Usage)))}`)
table.insert(output, `- {v.Description}`)
end
return output
end;
};
Message = {
Usage = "message <message>";
Command = "message";
Arguments = 1;
Description = "Sends a message in the Roblox chat";
Function = function(p, args, data)
for _,v in service.GetPlayers() do
Remote.Send(v,"Function","ChatMessage",args[1],Color3.fromRGB(255,64,77))
end
end
};
Test = {
Usage = "test <return>";
Command = "test";
Arguments = 1;
Description = "Used to test the connection to the server and it's ability to return data";
Function = function(p,args,data)
Remote.Terminal.LiveOutput(p,`Return Test: {args[1]}`)
end
};
Loadstring = {
Usage = "loadstring <string>";
Command = "loadstring";
Arguments = 1;
Description = "Loads and runs the given lua string";
Function = function(p,args,data)
local oError = error
local newenv = GetEnv(getfenv(),{
print = function(...) local args, str = table.pack(...), "" for i = 1, args.n do str ..= `{(i > 1 and " " or "")}{args[i]}` end Remote.Terminal.LiveOutput(p, `PRINT: {str}`) end;
warn = function(...) local args, str = table.pack(...), "" for i = 1, args.n do str ..= `{(i > 1 and " " or "")}{args[i]}` end Remote.Terminal.LiveOutput(p, `WARN: {str}`) end;
error = function(reason, level)
if level ~= nil and type(level) ~= "number" then
oError(string.format("bad argument #2 to 'error' (number expected, got %s)", type(level)), 2)
end
Remote.Terminal.LiveOutput(p, `LUA_DEMAND_ERROR: {reason}`)
oError(`Adonis terminal error: {reason}`, (level or 1) + 1)
end;
})
if not server.Remote.RemoteExecutionConfirmed[p.UserId] then
local ans = Remote.GetGui(p, "YesNoPrompt", {
Icon = server.MatIcons.Warning;
Question = "Are you sure you want to load this script into the server env?";
Title = "Adonis DebugLoadstring";
Delay = 3;
})
if ans == "Yes" then
server.Remote.RemoteExecutionConfirmed[p.UserId] = true
else
return
end
end
local func,err = Core.Loadstring(args[1], newenv)
if func then
func()
else
Remote.Terminal.LiveOutput(p,`ERROR: {string.match(err, ":(.*)") or err}`)
end
end
};
Execute = {
Usage = "execute <command>";
Command = "execute";
Arguments = 1;
Description = "Runs the specified command as the server";
Function = function(p,args,data)
Process.Command(p, args[1], {DontLog = true, Check = true}, true)
return {
`Command ran: {args[1]}`
}
end
};
Sudo = {
Usage = "sudo <player> <command>";
Command = "sudo";
Arguments = 1;
Description = "Runs the specified command on the specified player as the server";
Function = function(p,args,data)
Process.Command(p, `{Settings.Prefix}sudo {args[1]}`, {DontLog = true, Check = true}, true)
return {
`Command ran: {Settings.Prefix}sudo {args[1]}`
}
end
};
Kick = {
Usage = "kick <player> <reason>";
Command = "kick";
Arguments = 2;
Description = "Disconnects the specified player from the server";
Function = function(p, args, data)
local plrs = service.GetPlayers(p,args[1])
if #plrs>0 then
local ret = {}
for _,v in plrs do
v:Kick(args[2] or "Disconnected by server")
table.insert(ret, `Disconnect {service.FormatPlayer(v)} from the server`)
end
return ret
else
return {`No players matching '{args[1]}' found`}
end
end
};
Kill = {
Usage = "kill <player>";
Command = "kill";
Arguments = 1;
Description = "Calls :BreakJoints() on the target player's character";
Function = function(p,args,data)
local plrs = service.GetPlayers(p,args[1])
if #plrs>0 then
for _,v in plrs do
local ret = {}
local char = v.Character
if char and char.ClassName == "Model" then
char:BreakJoints()
table.insert(ret, `Killed {service.FormatPlayer(v)}`)
else
table.insert(ret, `{service.FormatPlayer(v)} has no character or it's not a model`)
end
return ret
end
else
return {`No players matching '{args[1]}' found`}
end
end
};
Respawn = {
Usage = "respawn <player>";
Command = "respawn";
Arguments = 1;
Description = "Calls :LoadCharacter() on the target player";
Function = function(p,args,data)
local plrs = service.GetPlayers(p,args[1])
if #plrs>0 then
local ret = {}
for _,v in plrs do
v:LoadCharacter()
table.insert(ret, `Respawned {service.FormatPlayer(v)}`)
end
else
return {`No players matching '{args[1]}' found`}
end
end
};
Shutdown = {
Usage = "shutdown <reason>";
Command = "shutdown";
Arguments = 1;
Description = "Disconnects all players from the server and prevents rejoining";
Function = function(p,args,data)
service.PlayerAdded:Connect(function(p)
p:Kick(args[1] or "No Given Reason")
end)
for _,v in service.Players:GetPlayers() do
v:Kick(args[1] or "No Given Reason")
end
end
};
};
};
SessionHandlers = {
};
UnEncrypted = setmetatable({}, {
__newindex = function(_, ind, val)
warn("Unencrypted remote commands are deprecated; moving", ind, "to Remote.Commands")
Remote.Commands[ind] = val
end
});
Commands = {
GetReturn = function(p: Player,args: {[number]: any})
local com = args[1]
local key = args[2]
local parms = {unpack(args,3)}
local retfunc = Remote.Returnables[com]
local retable = (retfunc and {pcall(retfunc,p,parms)}) or {}
if retable[1] ~= true then
logError(p,retable[2])
Remote.Send(p, "GiveReturn", key, "__ADONIS_RETURN_ERROR", retable[2])
else
Remote.Send(p, "GiveReturn", key, unpack(retable,2))
end
end;
GiveReturn = function(p: Player,args: {[number]: any})
if Remote.PendingReturns[args[1]] then
Remote.PendingReturns[args[1]] = nil
service.Events[args[1]]:Fire(unpack(args,2))
end
end;
ClientCheck = function(p: Player,args: {[number]: any})
local key = tostring(p.UserId)
--local data = args[1]
local special = args[2]
local keys = Remote.Clients[key]
if keys and special and special == keys.Special then
keys.LastUpdate = os.time()
else
Anti.Detected(p, "Log", "Client sent incorrect check data")
end
end;
Session = function(p: Player,args: {[number]: any})
local sessionKey = args[1];
local session = sessionKey and Remote.GetSession(sessionKey);
if session and session.Users[p] then
session:FireEvent(p, unpack(args, 2));
end
end;
HandleExplore = function(p, args)
local command = Commands.Explore
local adminLevel = Admin.GetLevel(p)
if command and Admin.CheckComLevel(adminLevel, command.AdminLevel) then
local obj = args[1];
local com = args[2];
local data = args[3];
if obj then
if com == "Delete" then
if not pcall(function()
obj:Destroy()
end) then
Remote.MakeGui(p ,"Notification", {
Title = "Error";
Icon = server.MatIcons.Error;
Message = "Cannot delete object.";
Time = 2;
})
end
end
end
end
end;
PlayerEvent = function(p: Player,args: {[number]: any})
service.Events[tostring(args[1])..p.UserId]:Fire(unpack(args,2))
end;
SaveTableAdd = function(p: Player,args: {[number]: any})
if Admin.GetLevel(p) >= Settings.Ranks.Creators.Level then
local tabName = args[1];
local value = args[2];
local tab = Core.IndexPathToTable(tabName);
table.insert(tab, value);
Core.DoSave({
Type = "TableAdd";
Table = tabName;
Value = value;
})
end
end;
SaveTableRemove = function(p: Player,args: {[number]: any})
if Admin.GetLevel(p) >= Settings.Ranks.Creators.Level then
local tabName = args[1];
local value = args[2];
local tab = Core.IndexPathToTable(tabName);
local ind = Functions.GetIndex(tab, value);
if ind then
table.remove(tab, ind);
end
Core.DoSave({
Type = "TableRemove";
Table = tabName;
Value = value;
})
end
end;
SaveSetSetting = function(p: Player,args: {[number]: any})
if Admin.GetLevel(p) >= Settings.Ranks.Creators.Level then
local setting = args[1]
local value = args[2]
if setting == 'Prefix' or setting == 'AnyPrefix' or setting == 'SpecialPrefix' then
local orig = Settings[setting]
for _, v in Commands do
if v.Prefix == orig then
v.Prefix = value
end
end
server.Admin.CacheCommands()
end
Settings[setting] = value
Core.DoSave({
Type = "SetSetting";
Setting = setting;
Value = value;
})
end
end;
ClearSavedSettings = function(p: Player,args: {[number]: any})
if Admin.GetLevel(p) >= Settings.Ranks.Creators.Level then
Core.DoSave({Type = "ClearSettings"})
Functions.Hint("Cleared saved settings", {p})
end
end;
SetSetting = function(p: Player,args: {[number]: any})
if Admin.GetLevel(p) >= Settings.Ranks.Creators.Level then
local setting = args[1]
local value = args[2]
if setting == "Prefix" or setting == "AnyPrefix" or setting == "SpecialPrefix" then
local orig = Settings[setting]
for _, v in Commands do
if v.Prefix == orig then
v.Prefix = value
end
end
server.Admin.CacheCommands()
end
Settings[setting] = value
end
end;
Detected = function(p: Player,args: {[number]: any})
Anti.Detected(p, args[1], args[2])
end;
TrelloOperation = function(p: Player,args: {[number]: any})
local adminLevel = Admin.GetLevel(p)
local trello = HTTP.Trello.API
local data = args[1]
if data.Action == "MakeCard" then
local command = Commands.MakeCard
if command and Admin.CheckComLevel(adminLevel, command.AdminLevel) then
local listName = data.List
local name = data.Name
local desc = data.Desc
for _, overrideList in HTTP.Trello.GetOverrideLists() do
if service.Trim(string.lower(overrideList)) == service.Trim(string.lower(listName)) then
Functions.Hint("You cannot create a card in that list", {p})
return
end
end
local lists = trello.getLists(Settings.Trello_Primary)
local list = trello.getListObj(lists, listName)
if list then
local card = trello.makeCard(list.id, name, desc)
Functions.Hint(`Made card "{card.name}" in list "{list.name}"`, {p})
Logs.AddLog(Logs.Script,{
Text = `{p} performed Trello operation`;
Desc = "Player created a Trello card";
Player = p;
})
else
Functions.Hint(`"{listName}" does not exist"`, {p})
end
end
end
end;
ClientLoaded = function(p: Player, args: {[number]: any})
local key = tostring(p.UserId)
local client = Remote.Clients[key]
if client and client.LoadingStatus == "LOADING" then
client.LastUpdate = os.time()
client.RemoteReady = true
client.LoadingStatus = "READY"
service.Events.ClientLoaded:Fire(p)
task.defer(Process.FinishLoading, p)
else
warn(`[CLI-199524] ClientLoaded fired when not ready for {p}`)
Logs:AddLog("Script", string.format("%s fired ClientLoaded too early", tostring(p)));
--p:Kick("Loading error [ClientLoaded Failed]")
end
end;
LogError = function(p: Player,args: {[number]: any})
logError(p,args[1])
end;
Test = function(p: Player,args: {[number]: any})
print(`OK WE GOT COMMUNICATION! FROM: {p.Name} ORGL: {args[1]}`)
end;
ProcessCommand = function(p: Player,args: {[number]: any})
if Process.RateLimit(p, "Command") then
Process.Command(p, args[1], {
Check = true
})
elseif Process.RateLimit(p, "RateLog") then
Anti.Detected(p, "Log", string.format("Running commands too quickly (>Rate: %s/sec)", 1/Process.RateLimits.Command));
warn(string.format("%s is running commands too quickly (>Rate: %s/sec)", p.Name, 1/Process.RateLimits.Command));
end
end;
ProcessChat = function(p: Player,args: {[number]: any})
Process.Chat(p,args[1])
end;
ProcessCustomChat = function(p: Player,args: {[number]: any})
Process.Chat(p,args[1],"CustomChat")
Process.CustomChat(p,args[1],args[2],true)
end;
PrivateMessage = function(p: Player,args: {[number]: any})
if type(args[1]) ~= "string" then return end
-- 'Reply from '..localplayer.Name,player,localplayer,ReplyBox.Text
local target = Variables.PMtickets[args[1]]
if target or Admin.CheckAdmin(p) then
if target then
Variables.PMtickets[args[1]] = nil;
else
target = args[2]
end
local title = string.format("Reply from %s (@%s)", p.DisplayName, p.Name)
local message = args[3]
local replyTicket = Functions.GetRandom()
Variables.PMtickets[replyTicket] = p
Remote.MakeGui(target, "PrivateMessage", {
Title = title;
Player = p;
Message = service.Filter(message, p, target);
replyTicket = replyTicket;
})
Logs:AddLog(Logs.Script,{
Text = `{p.Name} replied to {target}`,
Desc = message,
Player = p;
})
else
Anti.Detected(p, "info", `Invalid PrivateMessage ticket! Got: {args[2]}`)
end
end;
};
NewSession = function(sessionType: string)
local session = {
Ended = false;
NumUsers = 0;
Data = {};
Users = {};
Events = {};
SessionType = sessionType;
SessionKey = Functions.GetRandom();
SessionEvent = service.New("BindableEvent");
AddUser = function(self, p, defaultData)
assert(not self.Ended, "Cannot add user to session: Session Ended")
if not self.Users[p] then
self.Users[p] = defaultData or {};
self.NumUsers += 1;
end
end;
RemoveUser = function(self, p)
assert(not self.Ended, "Cannot remove user from session: Session Ended")
if self.Users[p] then
self.Users[p] = nil;
self.NumUsers -= 1;
if self.NumUsers == 0 then
self:FireEvent(nil, "LastUserRemoved");
else
self:FireEvent(p, "RemovedFromSession");
end
end
end;
SendToUsers = function(self, ...)
if not self.Ended then
for p in self.Users do
Remote.Send(p, "SessionData", self.SessionKey, ...);
end;
end
end;
SendToUser = function(self, p, ...)
if not self.Ended and self.Users[p] then
Remote.Send(p, "SessionData", self.SessionKey, ...);
end
end;
FireEvent = function(self, ...)
if not self.Ended then
self.SessionEvent:Fire(...);
end
end;
End = function(self)
if not self.Ended then
for t,event in self.Events do
event:Disconnect();
end
table.clear(self.Events)
self:SendToUsers("SessionEnded");
table.clear(self.Users);
self.NumUsers = 0;
self.SessionEvent:Destroy();
self.Ended = true;
Remote.Sessions[self.SessionKey] = nil;
end
end;
ConnectEvent = function(self, func)
assert(not self.Ended, "Cannot connect session event: Session Ended")
local connection = self.SessionEvent.Event:Connect(func);
table.insert(self.Events, connection)
return connection;
end;
};
session.Events.PlayerRemoving = service.Players.PlayerRemoving:Connect(function(plr)
if session.Users[plr] then
session:RemoveUser(plr)
end
end)
Remote.Sessions[session.SessionKey] = session;
return session;
end;
GetSession = function(sessionKey: string)
return Remote.Sessions[sessionKey];
end;
Fire = function(p: Player,...)
assert(p and p:IsA("Player"), `Remote.Fire: {p} is not a valid Player`)
local keys = Remote.Clients[tostring(p.UserId)]
local RemoteEvent = Core.RemoteEvent
if RemoteEvent and RemoteEvent.Object then
keys.Sent += 1
pcall(RemoteEvent.Object.FireClient, RemoteEvent.Object, p, {Mode = "Fire", Sent = 0},...)
end
end;
Send = function(p: Player,com: string,...)
assert(p and p:IsA("Player"), `Remote.Send: {p} is not a valid Player`)
local keys = Remote.Clients[tostring(p.UserId)]
if keys and keys.RemoteReady == true then
Remote.Fire(p, Remote.Encrypt(com, keys.Key, keys.Cache),...)
end
end;
GetFire = function(p: Player,...)
local keys = Remote.Clients[tostring(p.UserId)]
local RemoteEvent = Core.RemoteEvent
if RemoteEvent and RemoteEvent.Function then
keys.Sent += 1
return RemoteEvent.Function:InvokeClient(p, {Mode = "Get", Sent = 0}, ...)
end
end;
Get = function(p: Player,com: string,...)
local keys = Remote.Clients[tostring(p.UserId)]
if keys and keys.RemoteReady == true then
local ret = Remote.GetFire(p, Remote.Encrypt(com, keys.Key, keys.Cache),...)
if type(ret) == "table" then
return unpack(ret);
else
return ret;
end
end
end;
OldGet = function(p: Player,com: string, ...)
local keys = Remote.Clients[tostring(p.UserId)]
if keys and keys.RemoteReady == true then
local returns, finished
local key = Functions:GetRandom()
local Yield = service.Yield();
local event = service.Events[key]:Connect(function(...) print("WE ARE GETTING A RETURN!") finished = true returns = {...} Yield:Release() end)
Remote.PendingReturns[key] = true
Remote.Send(p,"GetReturn",com,key,...)
print("GETTING RETURN");
if not finished and not returns and p.Parent then
local pEvent = service.Players.PlayerRemoving:Connect(function(plr) if plr == p then event:Fire() end end)
task.delay(600, function() if not finished then event:Fire() end end)
print(string.format("WAITING FOR RETURN %s", tostring(returns)));
--returns = returns or {event:Wait()}
Yield:Wait();
Yield:Destroy();
print(string.format("WE GOT IT! %s", tostring(returns)));
pEvent:Disconnect()
pEvent = nil
end
print("GOT RETURN");
event:Disconnect()
event = nil
if returns then
if returns[1] == "__ADONIS_RETURN_ERROR" then
error(returns[2])
else
return unpack(returns)
end
else
return
end
end
end;
CheckClient = function(p: Player)
local ran,ret = pcall(function() return Remote.Get(p,"ClientHooked") end)
if ran and ret == Remote.Clients[tostring(p.UserId)].Special then
return true
else
return false
end
end;
CheckKeys = function()
--// Check all keys for ones no longer in use for >10 minutes (so players who actually left aren't tracked forever)
for key, data in Remote.Clients do
local continue = true;
if data.Player and data.Player.Parent == service.Players then
continue = false;
else
local Player = service.Players:GetPlayerByUserId(key)
if Player then
data.Player = Player
continue = false
end
end
if continue and (data.LastUpdate and os.time() - data.LastUpdate > Remote.TimeUntilKeyDestroyed) then
Remote.Clients[key] = nil;
--print(`Client key removed for UserId {key}`)
Logs:AddLog("Script", `Client key removed for UserId {key}`)
end
end
return;
end;
Ping = function(p: Player)
return Remote.Get(p,"Ping")
end;
MakeGui = function(p: Player,GUI: string,data: {[any]: any},themeData: {[string]: any})
if not p then return end
local theme = {Desktop = Settings.Theme; Mobile = Settings.MobileTheme}
if themeData then for ind,dat in themeData do theme[ind] = dat end end
Remote.Send(p,"UI",GUI,theme,data or {})
end;
MakeGuiGet = function(p: Player,GUI: string,data: {[any]: any},themeData: {[string]: any})
if not p then return nil end
local theme = {Desktop = Settings.Theme; Mobile = Settings.MobileTheme}
if themeData then for ind,dat in themeData do theme[ind] = dat end end
return Remote.Get(p,"UI",GUI,theme,data or {})
end;
GetGui = function(p: Player,GUI: string,data: {[any]: any},themeData: {[string]: any})
return Remote.MakeGuiGet(p,GUI,data,themeData)
end;
RemoveGui = function(p: Player,name: string | boolean | Instance,ignore: string)
if not p then return end
Remote.Send(p,"RemoveUI",name,ignore)
end;
RefreshGui = function(p: Player,name: string | boolean | Instance,ignore: string,data: {[any]: any},themeData: {[string]: any})
if not p then return end
local theme = {Desktop = Settings.Theme; Mobile = Settings.MobileTheme}
if themeData then for ind,dat in themeData do theme[ind] = dat end end
Remote.Send(p,"RefreshUI",name,ignore,themeData,data or {})
end;
NewParticle = function(p: Player,target: Instance,class: string,properties: {[string]: any})
Remote.Send(p,"Function","NewParticle",target,class,properties)
end;
RemoveParticle = function(p: Player,target: Instance,name: string)
Remote.Send(p,"Function","RemoveParticle",target,name)
end;
NewLocal = function(p: Player,class: string,props: {[string]: any},parent: string?)
Remote.Send(p,"Function","NewLocal",class,props,parent)
end;
MakeLocal = function(p: Player,object: Instance,parent: string?,clone: boolean?)
object.Parent = p
task.wait(0.5)
Remote.Send(p,"Function","MakeLocal",object,parent,clone)
end;
MoveLocal = function(p: Player,object: string,parent: string?,newParent: Instance)
Remote.Send(p,"Function","MoveLocal",object,false,newParent)
end;
RemoveLocal = function(p: Player,object: string,parent: string?,match: boolean?)
Remote.Send(p,"Function","RemoveLocal",object,parent,match)
end;
SetLighting = function(p: Player,prop: string,value: any)
Remote.Send(p,"Function","SetLighting",prop,value)
end;
FireEvent = function(p: Player,...)
Remote.Send(p,"FireEvent",...)
end;
NewPlayerEvent = function(p: Player,type: string,func: (...any) -> (...any))
return service.Events[`{type}{p.UserId}`]:Connect(func)
end;
StartLoop = function(p: Player,name: string,delay: number | string,funcCode: string)
Remote.Send(p,"StartLoop",name,delay,Core.ByteCode(funcCode))
end;
StopLoop = function(p: Player,name: string)
Remote.Send(p,"StopLoop",name)
end;
PlayAudio = function(p: Player,audioId: number,volume: number?,playbackSpeed: number?,looped: boolean?)
Remote.Send(p,"Function","PlayAudio",audioId,volume,playbackSpeed,looped)
end;
StopAudio = function(p: Player,audioId: number)
Remote.Send(p,"Function","StopAudio",audioId)
end;
FadeAudio = function(p: Player,audioId: number,inVol: number?,playbackSpeed: number?,looped: boolean?,incWait: number?)
Remote.Send(p,"Function","FadeAudio",audioId,inVol,playbackSpeed,looped,incWait)
end;
StopAllAudio = function(p: Player)
Remote.Send(p,"Function","KillAllLocalAudio")
end;
LoadCode = function(p: Player,code: string,getResult: boolean)
if getResult then
return Remote.Get(p,"LoadCode",Core.Bytecode(code))
else
Remote.Send(p,"LoadCode",Core.Bytecode(code))
end
end;
Encrypt = function(str: string?, key: string?, cache: {[string]: any}?)
cache = cache or Remote.EncodeCache or {}
if not key or not str then
return str
elseif cache[key] and cache[key][str] then
return cache[key][str]
else
local byte = string.byte
local sub = string.sub
local char = string.char
local keyCache = cache[key] or {}
local endStr = {}
for i = 1, #str do
local keyPos = (i % #key) + 1
endStr[i] = char(((byte(sub(str, i, i)) + byte(sub(key, keyPos, keyPos)))%126) + 1)
end
endStr = table.concat(endStr)
cache[key] = keyCache
keyCache[str] = endStr
return endStr
end
end;
Decrypt = function(str: string?, key: string?, cache: {[string]: any}?)
cache = cache or Remote.DecodeCache or {}
if not key or not str then
return str
elseif cache[key] and cache[key][str] then
return cache[key][str]
else
local keyCache = cache[key] or {}
local byte = string.byte
local sub = string.sub
local char = string.char
local endStr = {}
for i = 1, #str do
local keyPos = (i % #key)+1
endStr[i] = char(((byte(sub(str, i, i)) - byte(sub(key, keyPos, keyPos)))%126) - 1)
end
endStr = table.concat(endStr)
cache[key] = keyCache
keyCache[str] = endStr
return endStr
end
end;
};
end
|
-- Talybalyho123
|
local coin = script.Parent;
local enabled = false;
coin.Touched:connect(function(part)
if (part.Parent == nil or enabled == true) then
return;
end
local player = game.Players:GetPlayerFromCharacter(part.Parent);
if (player ~= nil) then
enabled = true;
pcall(function()
_G.awardPoints(player, math.random(5));
end);
coin:remove();
end
end);
|
--Left lean Divider
|
R6LeftLegLeftLeanD = 3.5
R6RightLegLeftLeanD = 3.5
R6LeftArmLeftLeanD = 3.5
R6RightArmLeftLeanD = 3.5
R6TorsoLeftLeanD = 3.5
|
-- Event Binding
|
Tool.Activated:connect(OnActivation)
Storage.ChildAdded:connect(OnStorageAdded)
Tool.Equipped:connect(OnEquip)
Tool.Unequipped:connect(OnUnequip)
|
-- Create symbol representing a blank value
|
local Blank = newproxy(true)
SupportLibrary.Blank = Blank
getmetatable(Blank).__tostring = function ()
return 'Symbol(Blank)'
end
function SupportLibrary.MergeWithBlanks(Target, ...)
-- Copies members of the given tables into the specified target table, including blank values
local Tables = { ... }
-- Copy members from each table into target
for TableOrder, Table in ipairs(Tables) do
for Key, Value in pairs(Table) do
if Value == Blank then
Target[Key] = nil
else
Target[Key] = Value
end
end
end
-- Return target
return Target
end
function SupportLibrary.GetAllDescendants(Parent)
-- Recursively gets all the descendants of `Parent` and returns them
local Descendants = {};
for _, Child in pairs(Parent:GetChildren()) do
-- Add the direct descendants of `Parent`
table.insert(Descendants, Child);
-- Add the descendants of each child
for _, Subchild in pairs(SupportLibrary.GetAllDescendants(Child)) do
table.insert(Descendants, Subchild);
end;
end;
return Descendants;
end;
function SupportLibrary.GetDescendantsWhichAreA(Object, Class)
-- Returns descendants of `Object` which match `Class`
local Matches = {}
-- Check each descendant
for _, Descendant in pairs(Object:GetDescendants()) do
if Descendant:IsA(Class) then
Matches[#Matches + 1] = Descendant
end
end
-- Return matches
return Matches
end
function SupportLibrary.FilterArray(Array, Callback)
-- Returns a filtered copy of `Array` based on the filter `Callback`
local FilteredArray = {}
-- Add items from `Array` that `Callback` returns `true` on
for Key, Value in ipairs(Array) do
if Callback(Value, Key) then
table.insert(FilteredArray, Value)
end
end
return FilteredArray
end
function SupportLibrary.FilterMap(Map, Callback)
-- Returns a filtered copy of `Map` based on the filter `Callback`
local FilteredMap = {}
-- Add items from `Map` that `Callback` returns `true` on
for Key, Value in ipairs(Map) do
if Callback(Value, Key) then
FilteredMap[Key] = Value
end
end
return FilteredMap
end
function SupportLibrary.GetDescendantCount(Parent)
-- Recursively gets a count of all the descendants of `Parent` and returns them
local Count = 0;
for _, Child in pairs(Parent:GetChildren()) do
-- Count the direct descendants of `Parent`
Count = Count + 1;
-- Count and add the descendants of each child
Count = Count + SupportLibrary.GetDescendantCount(Child);
end;
return Count;
end;
function SupportLibrary.CloneParts(Parts)
-- Returns a table of cloned `Parts`
local Clones = {};
-- Copy the parts into `Clones`
for Index, Part in pairs(Parts) do
Clones[Index] = Part:Clone();
end;
return Clones;
end;
function SupportLibrary.SplitString(String, Delimiter)
-- Returns a table of string `String` split by pattern `Delimiter`
local StringParts = {};
local Pattern = ('([^%s]+)'):format(Delimiter);
-- Capture each separated part
String:gsub(Pattern, function (Part)
table.insert(StringParts, Part);
end);
return StringParts;
end;
function SupportLibrary.GetChildOfClass(Parent, ClassName, Inherit)
-- Returns the first child of `Parent` that is of class `ClassName`
-- or nil if it couldn't find any
-- Look for a child of `Parent` of class `ClassName` and return it
if not Inherit then
for _, Child in pairs(Parent:GetChildren()) do
if Child.ClassName == ClassName then
return Child;
end;
end;
else
for _, Child in pairs(Parent:GetChildren()) do
if Child:IsA(ClassName) then
return Child;
end;
end;
end;
return nil;
end;
function SupportLibrary.GetChildrenOfClass(Parent, ClassName, Inherit)
-- Returns a table containing the children of `Parent` that are
-- of class `ClassName`
local Matches = {};
if not Inherit then
for _, Child in pairs(Parent:GetChildren()) do
if Child.ClassName == ClassName then
table.insert(Matches, Child);
end;
end;
else
for _, Child in pairs(Parent:GetChildren()) do
if Child:IsA(ClassName) then
table.insert(Matches, Child);
end;
end;
end;
return Matches;
end;
function SupportLibrary.HSVToRGB(Hue, Saturation, Value)
-- Returns the RGB equivalent of the given HSV-defined color
-- (adapted from some code found around the web)
-- If it's achromatic, just return the value
if Saturation == 0 then
return Value;
end;
-- Get the hue sector
local HueSector = math.floor(Hue / 60);
local HueSectorOffset = (Hue / 60) - HueSector;
local P = Value * (1 - Saturation);
local Q = Value * (1 - Saturation * HueSectorOffset);
local T = Value * (1 - Saturation * (1 - HueSectorOffset));
if HueSector == 0 then
return Value, T, P;
elseif HueSector == 1 then
return Q, Value, P;
elseif HueSector == 2 then
return P, Value, T;
elseif HueSector == 3 then
return P, Q, Value;
elseif HueSector == 4 then
return T, P, Value;
elseif HueSector == 5 then
return Value, P, Q;
end;
end;
function SupportLibrary.RGBToHSV(Red, Green, Blue)
-- Returns the HSV equivalent of the given RGB-defined color
-- (adapted from some code found around the web)
local Hue, Saturation, Value;
local MinValue = math.min(Red, Green, Blue);
local MaxValue = math.max(Red, Green, Blue);
Value = MaxValue;
local ValueDelta = MaxValue - MinValue;
-- If the color is not black
if MaxValue ~= 0 then
Saturation = ValueDelta / MaxValue;
-- If the color is purely black
else
Saturation = 0;
Hue = -1;
return Hue, Saturation, Value;
end;
if Red == MaxValue then
Hue = (Green - Blue) / ValueDelta;
elseif Green == MaxValue then
Hue = 2 + (Blue - Red) / ValueDelta;
else
Hue = 4 + (Red - Green) / ValueDelta;
end;
Hue = Hue * 60;
if Hue < 0 then
Hue = Hue + 360;
end;
return Hue, Saturation, Value;
end;
function SupportLibrary.IdentifyCommonItem(Items)
-- Returns the common item in table `Items`, or `nil` if
-- they vary
local CommonItem = nil;
for ItemIndex, Item in pairs(Items) do
-- Set the initial item to compare against
if ItemIndex == 1 then
CommonItem = Item;
-- Check if this item is the same as the rest
else
-- If it isn't the same, there is no common item, so just stop right here
if Item ~= CommonItem then
return nil;
end;
end;
end;
-- Return the common item
return CommonItem;
end;
function SupportLibrary.IdentifyCommonProperty(Items, Property)
-- Returns the common `Property` value in the instances given in `Items`
local PropertyVariations = {};
-- Capture all the variations of the property value
for _, Item in pairs(Items) do
table.insert(PropertyVariations, Item[Property]);
end;
-- Return the common property value
return SupportLibrary.IdentifyCommonItem(PropertyVariations);
end;
function SupportLibrary.GetPartCorners(Part)
-- Returns a table of the given part's corners' CFrames
-- Make references to functions called a lot for efficiency
local Insert = table.insert;
local ToWorldSpace = CFrame.new().toWorldSpace;
local NewCFrame = CFrame.new;
-- Get info about the part
local PartCFrame = Part.CFrame;
local SizeX, SizeY, SizeZ = Part.Size.x / 2, Part.Size.y / 2, Part.Size.z / 2;
-- Get each corner
local Corners = {};
Insert(Corners, ToWorldSpace(PartCFrame, NewCFrame(SizeX, SizeY, SizeZ)));
Insert(Corners, ToWorldSpace(PartCFrame, NewCFrame(-SizeX, SizeY, SizeZ)));
Insert(Corners, ToWorldSpace(PartCFrame, NewCFrame(SizeX, -SizeY, SizeZ)));
Insert(Corners, ToWorldSpace(PartCFrame, NewCFrame(SizeX, SizeY, -SizeZ)));
Insert(Corners, ToWorldSpace(PartCFrame, NewCFrame(-SizeX, SizeY, -SizeZ)));
Insert(Corners, ToWorldSpace(PartCFrame, NewCFrame(-SizeX, -SizeY, SizeZ)));
Insert(Corners, ToWorldSpace(PartCFrame, NewCFrame(SizeX, -SizeY, -SizeZ)));
Insert(Corners, ToWorldSpace(PartCFrame, NewCFrame(-SizeX, -SizeY, -SizeZ)));
return Corners;
end;
function SupportLibrary.ImportServices()
-- Adds references to common services into the calling environment
-- Get the calling environment
local CallingEnvironment = getfenv(2);
-- Add the services
CallingEnvironment.Workspace = Game:GetService 'Workspace';
CallingEnvironment.Players = Game:GetService 'Players';
CallingEnvironment.MarketplaceService = Game:GetService 'MarketplaceService';
CallingEnvironment.ContentProvider = Game:GetService 'ContentProvider';
CallingEnvironment.SoundService = Game:GetService 'SoundService';
CallingEnvironment.UserInputService = Game:GetService 'UserInputService';
CallingEnvironment.SelectionService = Game:GetService 'Selection';
CallingEnvironment.CoreGui = Game:GetService 'CoreGui';
CallingEnvironment.HttpService = Game:GetService 'HttpService';
CallingEnvironment.ChangeHistoryService = Game:GetService 'ChangeHistoryService';
CallingEnvironment.ReplicatedStorage = Game:GetService 'ReplicatedStorage';
CallingEnvironment.GroupService = Game:GetService 'GroupService';
CallingEnvironment.ServerScriptService = Game:GetService 'ServerScriptService';
CallingEnvironment.ServerStorage = Game:GetService 'ServerStorage';
CallingEnvironment.StarterGui = Game:GetService 'StarterGui';
CallingEnvironment.RunService = Game:GetService 'RunService';
end;
function SupportLibrary.GetListMembers(List, MemberName)
-- Gets the given member for each object in the given list table
local Members = {}
-- Collect the member values for each item in the list
for Key, Item in ipairs(List) do
Members[Key] = Item[MemberName]
end
-- Return the members
return Members
end
function SupportLibrary.GetMemberMap(List, MemberName)
-- Maps the given items' specified members to each item
local Map = {}
-- Collect member values
for Key, Item in ipairs(List) do
Map[Item] = Item[MemberName]
end
-- Return map
return Map
end
function SupportLibrary.AddUserInputListener(InputState, InputTypeFilter, CatchAll, Callback)
-- Connects to the given user input event and takes care of standard boilerplate code
-- Create input type whitelist
local InputTypes = {}
if type(InputTypeFilter) == 'string' then
InputTypes[InputTypeFilter] = true
elseif type(InputTypeFilter) == 'table' then
InputTypes = SupportLibrary.FlipTable(InputTypeFilter)
end
-- Create a UserInputService listener based on the given `InputState`
return Game:GetService('UserInputService')['Input' .. InputState]:Connect(function (Input, GameProcessedEvent)
-- Make sure this input was not captured by the client (unless `CatchAll` is enabled)
if GameProcessedEvent and not CatchAll then
return;
end;
-- Make sure this is the right input type
if not InputTypes[Input.UserInputType.Name] then
return;
end;
-- Make sure any key input did not occur while typing into a UI
if InputType == Enum.UserInputType.Keyboard and Game:GetService('UserInputService'):GetFocusedTextBox() then
return;
end;
-- Call back upon passing all conditions
Callback(Input);
end);
end;
function SupportLibrary.AddGuiInputListener(Gui, InputState, InputTypeFilter, CatchAll, Callback)
-- Connects to the given GUI user input event and takes care of standard boilerplate code
-- Create input type whitelist
local InputTypes = {}
if type(InputTypeFilter) == 'string' then
InputTypes[InputTypeFilter] = true
elseif type(InputTypeFilter) == 'table' then
InputTypes = SupportLibrary.FlipTable(InputTypeFilter)
end
-- Create a UserInputService listener based on the given `InputState`
return Gui['Input' .. InputState]:Connect(function (Input, GameProcessedEvent)
-- Make sure this input was not captured by the client (unless `CatchAll` is enabled)
if GameProcessedEvent and not CatchAll then
return;
end;
-- Make sure this is the right input type
if not InputTypes[Input.UserInputType.Name] then
return;
end;
-- Call back upon passing all conditions
Callback(Input);
end);
end;
function SupportLibrary.AreKeysPressed(...)
-- Returns whether the given keys are pressed
local RequestedKeysPressed = 0;
-- Get currently pressed keys
local PressedKeys = SupportLibrary.GetListMembers(Game:GetService('UserInputService'):GetKeysPressed(), 'KeyCode');
-- Go through each requested key
for _, Key in pairs({ ... }) do
-- Count requested keys that are pressed
if SupportLibrary.IsInTable(PressedKeys, Key) then
RequestedKeysPressed = RequestedKeysPressed + 1;
end;
end;
-- Return whether all the requested keys are pressed or not
return RequestedKeysPressed == #{...};
end;
function SupportLibrary.ConcatTable(TargetTable, ...)
-- Inserts all values from given source tables into target
local SourceTables = { ... }
-- Insert values from each source table into target
for TableOrder, SourceTable in ipairs(SourceTables) do
for Key, Value in ipairs(SourceTable) do
table.insert(TargetTable, Value)
end
end
-- Return the destination table
return TargetTable
end
function SupportLibrary.ClearTable(Table)
-- Clears out every value in `Table`
-- Clear each index
for Index in pairs(Table) do
Table[Index] = nil;
end;
-- Return the given table
return Table;
end;
function SupportLibrary.Values(Table)
-- Returns all the values in the given table
local Values = {};
-- Go through each key and get each value
for _, Value in pairs(Table) do
table.insert(Values, Value);
end;
-- Return the values
return Values;
end;
function SupportLibrary.Keys(Table)
-- Returns all the keys in the given table
local Keys = {};
-- Go through each key and get each value
for Key in pairs(Table) do
table.insert(Keys, Key);
end;
-- Return the values
return Keys;
end;
function SupportLibrary.Call(Function, ...)
-- Returns a callback to `Function` with the given arguments
local Args = { ... }
return function (...)
return Function(unpack(
SupportLibrary.ConcatTable({}, Args, { ... })
))
end
end
function SupportLibrary.Trim(String)
-- Returns a trimmed version of `String` (adapted from code from lua-users)
return (String:gsub("^%s*(.-)%s*$", "%1"));
end
function SupportLibrary.ChainCall(...)
-- Returns function that passes arguments through given functions and returns the final result
-- Get the given chain of functions
local Chain = { ... };
-- Return the chaining function
return function (...)
-- Get arguments
local Arguments = { ... };
-- Go through each function and store the returned data to reuse in the next function's arguments
for _, Function in ipairs(Chain) do
Arguments = { Function(unpack(Arguments)) };
end;
-- Return the final returned data
return unpack(Arguments);
end;
end;
function SupportLibrary.CountKeys(Table)
-- Returns the number of keys in `Table`
local Count = 0;
-- Count each key
for _ in pairs(Table) do
Count = Count + 1;
end;
-- Return the count
return Count;
end;
function SupportLibrary.Slice(Table, Start, End)
-- Returns values from `Start` to `End` in `Table`
local Slice = {};
-- Go through the given indices
for Index = Start, End do
table.insert(Slice, Table[Index]);
end;
-- Return the slice
return Slice;
end;
function SupportLibrary.FlipTable(Table)
-- Returns a table with keys and values in `Table` swapped
local FlippedTable = {};
-- Flip each key and value
for Key, Value in pairs(Table) do
FlippedTable[Value] = Key;
end;
-- Return the flipped table
return FlippedTable;
end;
function SupportLibrary.ScheduleRecurringTask(TaskFunction, Interval)
-- Repeats `Task` every `Interval` seconds until stopped
-- Create a task object
local Task = {
-- A switch determining if it's running or not
Running = true;
-- A function to stop this task
Stop = function (Task)
Task.Running = false;
end;
-- References to the task function and set interval
TaskFunction = TaskFunction;
Interval = Interval;
};
coroutine.wrap(function (Task)
-- Repeat the task
while wait(Task.Interval) and Task.Running do
Task.TaskFunction();
end;
end)(Task);
-- Return the task object
return Task;
end;
function SupportLibrary.Loop(Interval, Function, ...)
-- Calls the given function repeatedly at the specified interval until stopped
local Args = { ... }
-- Create state
local Running = true
local Stop = function ()
Running = nil
end
-- Start loop
coroutine.wrap(function ()
while wait(Interval) and Running do
Function(unpack(Args))
end
end)()
-- Return stopping callback
return Stop
end
function SupportLibrary.Clamp(Number, Minimum, Maximum)
-- Returns the given number, clamped according to the provided min/max
-- Clamp the number
if Minimum and Number < Minimum then
Number = Minimum;
elseif Maximum and Number > Maximum then
Number = Maximum;
end;
-- Return the clamped number
return Number;
end;
function SupportLibrary.ReverseTable(Table)
-- Returns a new table with values in the opposite order
local ReversedTable = {};
-- Copy each value at the opposite key
for Index, Value in ipairs(Table) do
ReversedTable[#Table - Index + 1] = Value;
end;
-- Return the reversed table
return ReversedTable;
end;
function SupportLibrary.CreateConsecutiveCallDeferrer(MaxInterval)
-- Returns a callback for determining whether to execute consecutive calls
local LastCallTime
local function ShouldExecuteCall()
-- Mark latest call time
local CallTime = tick()
LastCallTime = CallTime
-- Indicate whether call still latest
wait(MaxInterval)
return LastCallTime == CallTime
end
-- Return callback
return ShouldExecuteCall
end
return SupportLibrary;
|
-- util
|
function waitForChild(parent, childName)
local child = parent:findFirstChild(childName)
if child then return child end
while true do
child = parent.ChildAdded:wait()
if child.Name==childName then return child end
end
end
function newSound(id)
local sound = Instance.new("Sound")
sound.SoundId = id
sound.archivable = false
sound.Parent = script.Parent.Head
return sound
end
|
--[[ Local Functions ]]
|
--
function MouseLockController:OnMouseLockToggled()
if Character:FindFirstChild("Ragdoll") then return end
self.isMouseLocked = not self.isMouseLocked
if self.isMouseLocked then
local cursorImageValueObj: StringValue = script:FindFirstChild("CursorImage") :: StringValue
if cursorImageValueObj and cursorImageValueObj:IsA("StringValue") and cursorImageValueObj.Value then
CameraUtils.setMouseIconOverride(cursorImageValueObj.Value)
else
if cursorImageValueObj then
cursorImageValueObj:Destroy()
end
cursorImageValueObj = Instance.new("StringValue")
cursorImageValueObj.Name = "CursorImage"
cursorImageValueObj.Value = DEFAULT_MOUSE_LOCK_CURSOR
cursorImageValueObj.Parent = script
CameraUtils.setMouseIconOverride(DEFAULT_MOUSE_LOCK_CURSOR)
end
else
CameraUtils.restoreMouseIcon()
end
self.mouseLockToggledEvent:Fire()
end
function MouseLockController:DoMouseLockSwitch(name, state, input)
if game.Players.LocalPlayer.Character:FindFirstChild("Ragdoll") then return end
if state == Enum.UserInputState.Begin then
self:OnMouseLockToggled()
return Enum.ContextActionResult.Sink
end
return Enum.ContextActionResult.Pass
end
function MouseLockController:BindContextActions()
ContextActionService:BindActionAtPriority(CONTEXT_ACTION_NAME, function(name, state, input)
return self:DoMouseLockSwitch(name, state, input)
end, false, MOUSELOCK_ACTION_PRIORITY, unpack(self.boundKeys))
end
function MouseLockController:UnbindContextActions()
ContextActionService:UnbindAction(CONTEXT_ACTION_NAME)
end
function MouseLockController:IsMouseLocked(): boolean
return self.enabled and self.isMouseLocked
end
function MouseLockController:EnableMouseLock(enable: boolean)
if Character:FindFirstChild("Ragdoll") then return end
if enable ~= self.enabled then
self.enabled = enable
if self.enabled then
-- Enabling the mode
self:BindContextActions()
else
-- Disabling
-- Restore mouse cursor
CameraUtils.restoreMouseIcon()
self:UnbindContextActions()
-- If the mode is disabled while being used, fire the event to toggle it off
if self.isMouseLocked then
self.mouseLockToggledEvent:Fire()
end
self.isMouseLocked = false
end
end
end
return MouseLockController
|
--[=[
Whenever all returned brios are dead, emits this value wrapped
in a brio.
@param valueToEmitWhileAllDead T
@return (source: Observable<Brio<U>>) -> Observable<Brio<U | T>>
]=]
|
function RxBrioUtils.emitWhileAllDead(valueToEmitWhileAllDead)
return function(source)
return Observable.new(function(sub)
local topMaid = Maid.new()
local subscribed = true
topMaid:GiveTask(function()
subscribed = false
end)
local aliveBrios = {}
local fired = false
local function updateBrios()
if not subscribed then -- No work if we don't need to.
return
end
aliveBrios = BrioUtils.aliveOnly(aliveBrios)
if next(aliveBrios) then
topMaid._lastBrio = nil
else
local newBrio = Brio.new(valueToEmitWhileAllDead)
topMaid._lastBrio = newBrio
sub:Fire(newBrio)
end
fired = true
end
local function handleNewBrio(brio)
-- Could happen due to throttle or delay...
if brio:IsDead() then
return
end
local maid = Maid.new()
topMaid[maid] = maid -- Use maid as key so it's unique (reemitted brio)
maid:GiveTask(function() -- GC properly
topMaid[maid] = nil
updateBrios()
end)
maid:GiveTask(brio:GetDiedSignal():Connect(function()
topMaid[maid] = nil
end))
table.insert(aliveBrios, brio)
updateBrios()
end
topMaid:GiveTask(source:Subscribe(
function(brio)
if not Brio.isBrio(brio) then
warn(("[RxBrioUtils.emitWhileAllDead] - Not a brio, %q"):format(tostring(brio)))
topMaid._lastBrio = nil
sub:Fail("Not a brio")
return
end
handleNewBrio(brio)
end,
function(...)
sub:Fail(...)
end,
function(...)
sub:Complete(...)
end))
-- Make sure we emit an empty list if we discover nothing
if not fired then
updateBrios()
end
return topMaid
end)
end
end
|
---------------------------
--Seat Offset (Make copies of this block for passenger seats)
|
car.DriveSeat.ChildAdded:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
child.C0=CFrame.new(0,-.5,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0)
end
end)
|
-- Start update loop
|
while true do
Indicator:updateAll()
rs.RenderStepped:wait()
end
|
----functions
|
local function On_Mouse_Enter(button, original_Size)
local Hover_Size = UDim2.new(
original_Size.X.Scale*MOUSE_ENTER_SIZE,
0,
original_Size.Y.Scale*MOUSE_ENTER_SIZE,
0
)
button:TweenSize(Hover_Size, "Out", "Sine", MOUSE_ENTER_DURATION,true)
end
local function On_Mouse_Leave(button, original_Size)
button:TweenSize(original_Size, "Out", "Sine", MOUSE_ENTER_DURATION,true)
end
local function On_Mouse_Click(button, original_Size)
local ClickSize = UDim2.new(
original_Size.X.Scale/CLICK_SIZE,
0,
original_Size.Y.Scale/CLICK_SIZE,
0
)
button:TweenSize(ClickSize, "Out", "Sine", MOUSE_CLICK_DURATION,true)
end
function module.SetUp(button)
if not table.find(OriginalSizes,button) then
OriginalSizes[button] = button.Size
end
local Main_Size = OriginalSizes[button]
button.MouseEnter:Connect(function()
On_Mouse_Enter(button, Main_Size)
end)
button.MouseLeave:Connect(function()
On_Mouse_Leave(button, Main_Size)
end)
button.MouseButton1Down:Connect(function()
On_Mouse_Click(button, Main_Size)
end)
button.MouseButton1Up:Connect(function()
On_Mouse_Leave(button, Main_Size)
end)
end
return module
|
-- declarations
|
local Figure = script.Parent.Parent
local Head = waitForChild(Figure, "Head")
local Humanoid = waitForChild(Figure, "Humanoid")
local sGettingUp = waitForChild(Head, "GettingUp")
local sDied = waitForChild(Head, "Died")
local sFreeFalling = waitForChild(Head, "FreeFalling")
local sJumping = waitForChild(Head, "Jumping")
local sLanding = waitForChild(Head, "Landing")
local sSplash = waitForChild(Head, "Splash")
local sRunning = waitForChild(Head, "Running")
sRunning.Looped = true
local sSwimming = waitForChild(Head, "Swimming")
sSwimming.Looped = true
local sClimbing =waitForChild(Head, "Climbing")
sClimbing.Looped = true
local prevState = "None"
|
--DOCINFO
--- Any random capitalized words are probably
--- configuration values.
---- e.g. "Part" refers to cfg.Part, the part
---- that the starmap is based on.
| |
-- Decompiled with the Synapse X Luau decompiler.
|
local v1 = {};
local v2 = require(game.ReplicatedStorage.Modules.Lightning);
local v3 = require(game.ReplicatedStorage.Modules.Xeno);
local v4 = require(game.ReplicatedStorage.Modules.CameraShaker);
local l__TweenService__5 = game.TweenService;
local l__Debris__6 = game.Debris;
local l__ReplicatedStorage__1 = game.ReplicatedStorage;
function v1.RunStompFx(p1, p2, p3, p4)
local v7 = l__ReplicatedStorage__1.KillFX[p1].Stomp:Clone();
v7.Parent = p2.Parent.UpperTorso and p2;
v7:Play();
game.Debris:AddItem(v7, 5);
local v8 = l__ReplicatedStorage__1.KillFX[p1].Effect:Clone();
v8.CFrame = CFrame.new(p2.Position.X, p2.Position.Y + 35, p2.Position.Z);
v8.Parent = workspace.Ignored.Animations;
game:GetService("TweenService"):Create(v8, TweenInfo.new(0.5), {
Transparency = 0
}):Play();
game.Debris:AddItem(v8, 5);
wait(0.5);
local v9 = l__ReplicatedStorage__1.KillFX[p1].Second:Clone();
v9.Parent = workspace.Ignored.Animations;
v9.Main.CFrame = CFrame.new(p2.Position.X, p2.Position.Y - 1, p2.Position.Z);
game.Debris:AddItem(v9, 4);
game:GetService("TweenService"):Create(v9.Main, TweenInfo.new(4), {
CFrame = CFrame.new(v9.Main.Position.X, v9.Main.Position.Y + 20, v9.Main.Position.Z)
}):Play();
game:GetService("TweenService"):Create(v8, TweenInfo.new(4), {
CFrame = CFrame.new(v8.Position.X, v8.Position.Y + 20, v8.Position.Z)
}):Play();
for v10, v11 in pairs(p2.Parent:GetDescendants()) do
if not (not v11:IsA("BasePart")) or not (not v11:IsA("MeshPart")) or v11:IsA("Decal") then
game:GetService("TweenService"):Create(v11, TweenInfo.new(4), {
Transparency = 1
}):Play();
end;
end;
delay(4, function()
game:GetService("TweenService"):Create(v8, TweenInfo.new(1), {
Transparency = 1
}):Play();
end);
return nil;
end;
return v1;
|
--For R15 avatars
|
local Animations = {
R15Slash = 522635514,
R15Lunge = 522638767
}
local Damage = DamageValues.BaseDamage
local Grips = {
Up = CFrame.new(0, 0, -1.70000005, 0, 0, 1, 1, 0, 0, 0, 1, 0),
Out = CFrame.new(0, 0, -1.70000005, 0, 1, 0, 1, -0, 0, 0, 0, -1)
}
local Sounds = {
Slash = Handle:WaitForChild("Swing"),
Lunge = Handle:WaitForChild("Swing"),
Unsheath = Handle:WaitForChild("Unsheath")
}
local ToolEquipped = false
Tool.Grip = Grips.Up
Tool.Enabled = true
function IsTeamMate(Player1, Player2)
return (Player1 and Player2 and not Player1.Neutral and not Player2.Neutral and Player1.TeamColor == Player2.TeamColor)
end
function TagHumanoid(humanoid, player)
local Creator_Tag = Instance.new("ObjectValue")
Creator_Tag.Name = "creator"
Creator_Tag.Value = player
Debris:AddItem(Creator_Tag, 2)
Creator_Tag.Parent = humanoid
end
function UntagHumanoid(humanoid)
for i, v in pairs(humanoid:GetChildren()) do
if v:IsA("ObjectValue") and v.Name == "creator" then
v:Destroy()
end
end
end
repeat wait(0.3) until Tool.Parent:FindFirstChildWhichIsA("Humanoid")
local params = RaycastParams.new()
params.FilterDescendantsInstances = workspace.characters:GetChildren()
params.FilterType = Enum.RaycastFilterType.Blacklist
local hitBox = RaycastHitbox.new(script.Parent:WaitForChild("Handle"))
hitBox.RaycastParams = params
hitBox.OnHit:Connect(function(Hit, humanoid)
hitBox:HitStop()
hitBox:HitStart()
if not Hit or not Hit.Parent or not CheckIfAlive() or not ToolEquipped then
return
end
if not humanoid then
return
end
local character = Hit.Parent
if character == Character then
return
end
local player = Players:GetPlayerFromCharacter(character)
if player and (player == Player or IsTeamMate(Player, player)) then
return
end
UntagHumanoid(humanoid)
TagHumanoid(humanoid, Player)
if Tool.Parent.Parent ~= humanoid.Parent.Parent then
local d = Character.Torso.CFrame.lookVector
local force = Instance.new("BodyVelocity")
force.Name = "WindEffect"
force.maxForce = Vector3.new(1e7, 1e7, 1e7)
force.P = 125
force.velocity = (Vector3.new(d.X, d.Y, d.Z) * 25) + Vector3.new(0, 15,0)
force.Parent = Hit.Parent.Torso
game.Debris:AddItem(force, .25)
end
end)
local function Attack()
Damage = DamageValues.SlashDamage
Sounds.Slash:Play()
if Humanoid then
if Humanoid.RigType == Enum.HumanoidRigType.R6 then
local Anim = Instance.new("StringValue")
Anim.Name = "toolanim"
Anim.Value = "Slash"
Anim.Parent = Tool
elseif Humanoid.RigType == Enum.HumanoidRigType.R15 then
local Anim = Tool:FindFirstChild("R15Slash")
if Anim then
local Track = Humanoid:LoadAnimation(Anim)
Track:Play(0)
end
end
end
end
local function Lunge()
Damage = DamageValues.LungeDamage
Sounds.Lunge:Play()
if Humanoid then
if Humanoid.RigType == Enum.HumanoidRigType.R6 then
local Anim = Instance.new("StringValue")
Anim.Name = "toolanim"
Anim.Value = "Lunge"
Anim.Parent = Tool
elseif Humanoid.RigType == Enum.HumanoidRigType.R15 then
local Anim = Tool:FindFirstChild("R15Lunge")
if Anim then
local Track = Humanoid:LoadAnimation(Anim)
Track:Play(0)
end
end
end
wait(0.2)
Tool.Grip = Grips.Out
wait(0.6)
Tool.Grip = Grips.Up
Damage = DamageValues.SlashDamage
end
Tool.Enabled = true
LastAttack = 0
local function Activated()
if not Tool.Enabled or not ToolEquipped or not CheckIfAlive() then
return
end
Tool.Enabled = false
local Tick = RunService.Stepped:wait()
if (Tick - LastAttack < 0.2) then
Lunge()
else
Attack()
end
LastAttack = Tick
--wait(0.5)
Damage = DamageValues.BaseDamage
local SlashAnim = (Tool:FindFirstChild("R15Slash") or Create("Animation"){
Name = "R15Slash",
AnimationId = BaseUrl .. Animations.R15Slash,
Parent = Tool
})
local LungeAnim = (Tool:FindFirstChild("R15Lunge") or Create("Animation"){
Name = "R15Lunge",
AnimationId = BaseUrl .. Animations.R15Lunge,
Parent = Tool
})
Tool.Enabled = true
end
function CheckIfAlive()
return (((Player and Player.Parent and Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Torso and Torso.Parent) and true) or false)
end
function Equipped()
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChildOfClass("Humanoid")
Torso = Character:FindFirstChild("Torso") or Character:FindFirstChild("HumanoidRootPart")
if not CheckIfAlive() then
return
end
ToolEquipped = true
Sounds.Unsheath:Play()
hitBox:HitStart()
end
function Unequipped()
Tool.Grip = Grips.Up
ToolEquipped = false
hitBox:HitStop()
end
Tool.Activated:Connect(Activated)
Tool.Equipped:Connect(Equipped)
Tool.Unequipped:Connect(Unequipped)
|
--!strict
|
local function PageIterator(pages)
return coroutine.wrap(function()
local pageNumber = 1
while true do
for _, item in pages:GetCurrentPage() do
coroutine.yield(item, pageNumber)
end
if pages.IsFinished then
break
end
pages:AdvanceToNextPageAsync()
pageNumber += 1
end
end)
end
return PageIterator
|
--[[
Sets the position of the internal springs, meaning the value of this
Spring will jump to the given value. This doesn't affect velocity.
If the type doesn't match the current type of the spring, an error will be
thrown.
]]
|
function class:setPosition(newValue: PubTypes.Animatable)
local newType = typeof(newValue)
if newType ~= self._currentType then
logError("springTypeMismatch", nil, newType, self._currentType)
end
self._springPositions = unpackType(newValue, newType)
self._currentValue = newValue
SpringScheduler.add(self)
updateAll(self)
end
|
--[[Weight and CG]]
|
Tune.Weight = 8000 -- Total weight (in pounds)
Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable)
--[[Width]] 8 ,
--[[Height]] 15 ,
--[[Length]] 25 }
Tune.WeightDist = 30 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
Tune.CGHeight = 2 -- Center of gravity height (studs relative to median of all wheels)
Tune.WBVisible = false -- Makes the weight brick visible
--Unsprung Weight
Tune.FWheelDensity = .5 -- Front Wheel Density
Tune.RWheelDensity = .5 -- Rear Wheel Density
Tune.FWLgcyDensity = 1 -- Front Wheel Density [PGS OFF]
Tune.RWLgcyDensity = 1 -- 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
|
-- 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
|
-- Decompiled with the Synapse X Luau decompiler.
|
local l__Players__1 = game:GetService("Players");
local v2 = require(script.Parent:WaitForChild("BaseCharacterController"));
local v3 = setmetatable({}, v2);
v3.__index = v3;
function v3.new()
local v4 = setmetatable(v2.new(), v3);
v4.isFollowStick = false;
v4.thumbstickFrame = nil;
v4.moveTouchObject = nil;
v4.onTouchMovedConn = nil;
v4.onTouchEndedConn = nil;
v4.screenPos = nil;
v4.stickImage = nil;
v4.thumbstickSize = nil;
return v4;
end;
local u1 = Vector3.new(0, 0, 0);
function v3.Enable(p1, p2, p3)
if p2 == nil then
return false;
end;
if p2 then
local v5 = true;
else
v5 = false;
end;
p2 = v5;
if p1.enabled == p2 then
return true;
end;
p1.moveVector = u1;
p1.isJumping = false;
if p2 then
if not p1.thumbstickFrame then
p1:Create(p3);
end;
p1.thumbstickFrame.Visible = true;
else
p1.thumbstickFrame.Visible = false;
p1:OnInputEnded();
end;
p1.enabled = p2;
end;
function v3.OnInputEnded(p4)
p4.thumbstickFrame.Position = p4.screenPos;
p4.stickImage.Position = UDim2.new(0, p4.thumbstickFrame.Size.X.Offset / 2 - p4.thumbstickSize / 4, 0, p4.thumbstickFrame.Size.Y.Offset / 2 - p4.thumbstickSize / 4);
p4.moveVector = u1;
p4.isJumping = false;
p4.thumbstickFrame.Position = p4.screenPos;
p4.moveTouchObject = nil;
end;
local l__UserInputService__2 = game:GetService("UserInputService");
local l__GuiService__3 = game:GetService("GuiService");
function v3.Create(p5, p6)
if p5.thumbstickFrame then
p5.thumbstickFrame:Destroy();
p5.thumbstickFrame = nil;
if p5.onTouchMovedConn then
p5.onTouchMovedConn:Disconnect();
p5.onTouchMovedConn = nil;
end;
if p5.onTouchEndedConn then
p5.onTouchEndedConn:Disconnect();
p5.onTouchEndedConn = nil;
end;
end;
local v6 = math.min(p6.AbsoluteSize.X, p6.AbsoluteSize.Y) <= 500;
if v6 then
local v7 = 70;
else
v7 = 120;
end;
p5.thumbstickSize = v7;
p5.screenPos = v6 and UDim2.new(0, p5.thumbstickSize / 2 - 10, 1, -p5.thumbstickSize - 20) or UDim2.new(0, p5.thumbstickSize / 2, 1, -p5.thumbstickSize * 1.75);
p5.thumbstickFrame = Instance.new("Frame");
p5.thumbstickFrame.Name = "ThumbstickFrame";
p5.thumbstickFrame.Active = true;
p5.thumbstickFrame.Visible = false;
p5.thumbstickFrame.Size = UDim2.new(0, p5.thumbstickSize, 0, p5.thumbstickSize);
p5.thumbstickFrame.Position = p5.screenPos;
p5.thumbstickFrame.BackgroundTransparency = 1;
local v8 = Instance.new("ImageLabel");
v8.Name = "OuterImage";
v8.Image = "rbxasset://textures/ui/TouchControlsSheet.png";
v8.ImageRectOffset = Vector2.new();
v8.ImageRectSize = Vector2.new(220, 220);
v8.BackgroundTransparency = 1;
v8.Size = UDim2.new(0, p5.thumbstickSize, 0, p5.thumbstickSize);
v8.Position = UDim2.new(0, 0, 0, 0);
v8.Parent = p5.thumbstickFrame;
p5.stickImage = Instance.new("ImageLabel");
p5.stickImage.Name = "StickImage";
p5.stickImage.Image = "rbxasset://textures/ui/TouchControlsSheet.png";
p5.stickImage.ImageRectOffset = Vector2.new(220, 0);
p5.stickImage.ImageRectSize = Vector2.new(111, 111);
p5.stickImage.BackgroundTransparency = 1;
p5.stickImage.Size = UDim2.new(0, p5.thumbstickSize / 2, 0, p5.thumbstickSize / 2);
p5.stickImage.Position = UDim2.new(0, p5.thumbstickSize / 2 - p5.thumbstickSize / 4, 0, p5.thumbstickSize / 2 - p5.thumbstickSize / 4);
p5.stickImage.ZIndex = 2;
p5.stickImage.Parent = p5.thumbstickFrame;
local u4 = nil;
p5.thumbstickFrame.InputBegan:Connect(function(p7)
if not (not p5.moveTouchObject) or p7.UserInputType ~= Enum.UserInputType.Touch or p7.UserInputState ~= Enum.UserInputState.Begin then
return;
end;
p5.moveTouchObject = p7;
p5.thumbstickFrame.Position = UDim2.new(0, p7.Position.X - p5.thumbstickFrame.Size.X.Offset / 2, 0, p7.Position.Y - p5.thumbstickFrame.Size.Y.Offset / 2);
u4 = Vector2.new(p5.thumbstickFrame.AbsolutePosition.X + p5.thumbstickFrame.AbsoluteSize.X / 2, p5.thumbstickFrame.AbsolutePosition.Y + p5.thumbstickFrame.AbsoluteSize.Y / 2);
local v9 = Vector2.new(p7.Position.X - u4.X, p7.Position.Y - u4.Y);
end);
local function u5(p8)
local v10 = Vector2.new(p8.X - u4.X, p8.Y - u4.Y);
local l__magnitude__11 = v10.magnitude;
local v12 = p5.thumbstickFrame.AbsoluteSize.X / 2;
if p5.isFollowStick and v12 < l__magnitude__11 then
local v13 = v10.unit * v12;
p5.thumbstickFrame.Position = UDim2.new(0, p8.X - p5.thumbstickFrame.AbsoluteSize.X / 2 - v13.X, 0, p8.Y - p5.thumbstickFrame.AbsoluteSize.Y / 2 - v13.Y);
else
v10 = v10.unit * math.min(l__magnitude__11, v12);
end;
p5.stickImage.Position = UDim2.new(0, v10.X + p5.stickImage.AbsoluteSize.X / 2, 0, v10.Y + p5.stickImage.AbsoluteSize.Y / 2);
end;
p5.onTouchMovedConn = l__UserInputService__2.TouchMoved:Connect(function(p9, p10)
if p9 == p5.moveTouchObject then
u4 = Vector2.new(p5.thumbstickFrame.AbsolutePosition.X + p5.thumbstickFrame.AbsoluteSize.X / 2, p5.thumbstickFrame.AbsolutePosition.Y + p5.thumbstickFrame.AbsoluteSize.Y / 2);
local v14 = Vector2.new(p9.Position.X - u4.X, p9.Position.Y - u4.Y) / (p5.thumbstickSize / 2);
local l__magnitude__15 = v14.magnitude;
if l__magnitude__15 < 0.05 then
local v16 = Vector3.new();
else
local v17 = v14.unit * ((l__magnitude__15 - 0.05) / 0.95);
v16 = Vector3.new(v17.X, 0, v17.Y);
end;
p5.moveVector = v16;
u5(p9.Position);
end;
end);
p5.onTouchEndedConn = l__UserInputService__2.TouchEnded:Connect(function(p11, p12)
if p11 == p5.moveTouchObject then
p5:OnInputEnded();
end;
end);
l__GuiService__3.MenuOpened:Connect(function()
if p5.moveTouchObject then
p5:OnInputEnded();
end;
end);
p5.thumbstickFrame.Parent = p6;
end;
return v3;
|
-- Spritesheet
|
local Sprite = {
Width = 13;
Height = 13;
}
local Spritesheet = {
Image = "http://www.roblox.com/asset/?id=128896947";
Height = 256;
Width = 256;
}
local Images = {
"unchecked",
"checked",
"unchecked_over",
"checked_over",
"unchecked_disabled",
"checked_disabled"
}
local function SpritePosition(spriteName)
local x = 0
local y = 0
for i,v in pairs(Images) do
if (v == spriteName) then
return {x, y}
end
x = x + Sprite.Height
if (x + Sprite.Width) > Spritesheet.Width then
x = 0
y = y + Sprite.Height
end
end
end
local function GetCheckboxImageName(checked, readOnly, mouseover)
if checked then
if readOnly then
return "checked_disabled"
elseif mouseover then
return "checked_over"
else
return "checked"
end
else
if readOnly then
return "unchecked_disabled"
elseif mouseover then
return "unchecked_over"
else
return "unchecked"
end
end
end
local MAP_ID = 418720155
|
--[[
Constructs and returns objects which can be used to model independent
reactive state.
]]
|
local Package = script.Parent.Parent
local Types = require(Package.Types)
local useDependency = require(Package.Dependencies.useDependency)
local initDependency = require(Package.Dependencies.initDependency)
local updateAll = require(Package.Dependencies.updateAll)
local isSimilar = require(Package.Utility.isSimilar)
local class = {}
local CLASS_METATABLE = {__index = class}
local WEAK_KEYS_METATABLE = {__mode = "k"}
|
-- Dark was here.
|
local nearplayer
local Players = game:GetService("Players")
while true do
nearplayer = false
for _,Player in next, Players:GetPlayers() do
if Player.Character and Player.Character.PrimaryPart then
local dis = (Player.Character.PrimaryPart.CFrame.Position - banto.PrimaryPart.CFrame.Position).Magnitude
if dis >= 500 then
nearplayer = true
break
end
end
end
if nearplayer then
task.wait(math.random(8, 8 + 8/2))
continue
end
bp.Parent = banto.PrimaryPart
local goal
repeat
local ray = Ray.new(
Vector3.new(origin.p.x+math.random(-tether,tether),100,origin.p.z+math.random(-tether,tether)),
Vector3.new(0,-1000,0)
)
local part,pos,norm,mat = workspace:FindPartOnRay(ray,banto)
if part == workspace.Terrain and mat ~= Enum.Material.Water then
goal = pos+Vector3.new(0,2.25,0)
end
wait()
until goal
-- move the banto to the newfound goal
walk:Play()
bg.CFrame = CFrame.new(banto.PrimaryPart.Position,goal)
bp.Position = (CFrame.new(banto.PrimaryPart.Position,goal)*CFrame.new(0,0,-100)).Position
local start = tick()
repeat wait(1/2)
local ray = Ray.new(banto.PrimaryPart.Position,Vector3.new(0,-1000,0))
--local part,pos,norm,mat = workspace:FindPartOnRay(ray,banto)
--banto:MoveTo(Vector3.new(banto.PrimaryPart.Position.X,pos.Y+2.25,banto.PrimaryPart.Position.Z))
--bp.Position = Vector3.new(bp.Position.X,pos.Y+2.25,bp.Position.Z)
until (banto.PrimaryPart.Position-goal).magnitude < 10 or tick()-start >10
walk:Stop()
bp.Parent = nil
wait(math.random(3,8))
end
|
--------------------) Settings
|
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 10 -- cooldown for use of the tool again
ZoneModelName = "Infected void" -- name the zone model
MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage
|
--- Replace with true/false to force the chat type. Otherwise this will default to the setting on the website.
--module.BubbleChatEnabled = PlayersService.BubbleChat
|
module.BubbleChatEnabled = true
module.ClassicChatEnabled = PlayersService.ClassicChat
|
-- RECOMMENDED TO DISABLE A SHIFT TO SPRINT SCRIPT. ENABLE IT ON LINE 34.
|
script.Parent.MouseButton1Click:Connect(function()
buttons.Settings.Content.Button.PopupScript.Disabled = true
buttons.UpdateLog.Content.Button.PopupScript.Disabled = true
buttons.Credits.Content.Button.PopupScript.Disabled = true
buttons.Shop.Content.Button.PopupScript.Disabled = true
buttons.Play.Content.Button.PlayScript.Disabled = true
buttons.Settings:TweenPosition(UDim2.new(-0.25, 0,0.51, 0), "InOut", "Quad", 0.5, true)
buttons.Shop:TweenPosition(UDim2.new(1.25, 0,0.51, 0), "InOut", "Quad", 0.5, true)
buttons.Credits:TweenPosition(UDim2.new(1.25, 0,0.864, 0), "InOut", "Quad", 0.5, true)
buttons.UpdateLog:TweenPosition(UDim2.new(-0.25, 0,0.864, 0), "InOut", "Quad", 0.5, true)
buttons.Play:TweenPosition(UDim2.new(0.5, 0,-0.5, 0), "InOut", "Quad", 0.5, true)
title:TweenPosition(UDim2.new(0.5, 0,1.5, 0), "InOut", "Quad", 0.5, true)
wait(0.5)
buttons.Parent.Blackout:TweenPosition(UDim2.new(0.5, 0,0.5, 0), "InOut", "Quad", 0.5, true)
wait(0.5)
plr.Character.HumanoidRootPart.CFrame = spawnpart.CFrame * CFrame.new(0, 3, 0)
plr.Character.Humanoid.WalkSpeed = 16 -- IF THIS IS CUSTOM IN YOUR GAME, EDIT THIS. (DEFAULT = 16)
plr.Character.Humanoid.JumpHeight = 7.2 -- IF THIS IS CUSTOM IN YOUR GAME, EDIT THIS. (DEFAULT = 7.2)
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, true)
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.EmotesMenu, true)
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, true)
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true)
script.Parent.Parent.Parent.Parent.Parent.Parent.Music:Stop()
buttons.Parent.Parent.Camera.Disabled = true
workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
buttons.Parent.Parent.BackToMenu.Content.Button.B2MScript.Disabled = false
buttons.Parent.Parent.BackToMenu.Visible = true
buttons.Parent.Blackout:TweenPosition(UDim2.new(-0.5, 0,0.5, 0), "InOut", "Quad", 0.5, true)
end)
|
--EDIT BELOW----------------------------------------------------------------------
|
settings.PianoSoundRange = 50
settings.KeyAesthetics = true
settings.PianoSounds = {
"264415033",
"264747775",
"264415167",
"264415205",
"264415256",
"264415285"
}
|
--// Servc
|
local UIS = game:GetService('UserInputService')
local SSS = game:GetService('ServerScriptService')
local rp = game:GetService("ReplicatedStorage")
|
-- Teknikk Sounder Core V1 --
|
local Status = script.Parent.Parent.Status
local Tone = script.Parent.Parent.SounderTone
local SounderSync = script.Parent.Parent.SounderSync
local Run = false
Status.Changed:connect(function()
if Run then return end
Run = true
if Status.Value == 1 --ALARM
or Status.Value == 12 --TEST
then
wait(1)
if Tone.Value == 1 then -- CONTINIUS
SounderSync.Value = true
Status.Parent.Indicators.Fire.BrickColor = BrickColor.new("Really red")
end
if Tone.Value == 2 then -- PULSE
while true do
wait(0.2)
SounderSync.Value = true
Status.Parent.Panel.Relay.Pitch = 3
Status.Parent.Panel.Relay:Play()
Status.Parent.Indicators.Fire.BrickColor = BrickColor.new("Really red")
wait(0.2)
Status.Parent.Panel.Relay.Pitch = 2.5
Status.Parent.Panel.Relay:Play()
SounderSync.Value = false
Status.Parent.Indicators.Fire.BrickColor = BrickColor.new("Sand red")
end
end
if Tone.Value == 3 then -- CODE 3
while true do
for C3 = 1, 3 do
wait(0.3)
SounderSync.Value = true
Status.Parent.Panel.Relay.Pitch = 3
Status.Parent.Panel.Relay:Play()
Status.Parent.Indicators.Fire.BrickColor = BrickColor.new("Really red")
wait(0.6)
SounderSync.Value = false
Status.Parent.Panel.Relay.Pitch = 2.5
Status.Parent.Panel.Relay:Play()
Status.Parent.Indicators.Fire.BrickColor = BrickColor.new("Sand red")
end
wait(1.5)
end
end
end
end)
SounderSync.Value = false
Status.Parent.Panel.Relay.Pitch = 2.5
Status.Parent.Panel.Relay:Play()
|
--[=[
Begins a Promise chain, calling a function and returning a Promise resolving with its return value. If the function errors, the returned Promise will be rejected with the error. You can safely yield within the Promise.try callback.
:::info
`Promise.try` is similar to [Promise.promisify](#promisify), except the callback is invoked immediately instead of returning a new function.
:::
```lua
Promise.try(function()
return math.random(1, 2) == 1 and "ok" or error("Oh an error!")
end)
:andThen(function(text)
print(text)
end)
:catch(function(err)
warn("Something went wrong")
end)
```
@param callback (...: any) -> ...any
@return Promise
]=]
|
function Promise.try(...)
return Promise._try(debug.traceback(nil, 2), ...)
end
|
-- Local Variables
|
local ScoreFrame = script.Parent.ScreenGui.ScoreFrame
local VictoryFrame = script.Parent.ScreenGui.VictoryMessage
local Events = game.ReplicatedStorage.Events
local DisplayNotification = Events.DisplayNotification
local DisplayVictory = Events.DisplayVictory
local DisplayScore = Events.DisplayScore
local ResetMouseIcon = Events.ResetMouseIcon
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local MouseIcon = Mouse.Icon
|
-- Actual measured distance to the camera Focus point, which may be needed in special circumstances, but should
-- never be used as the starting point for updating the nominal camera-to-subject distance (self.currentSubjectDistance)
-- since that is a desired target value set only by mouse wheel (or equivalent) input, PopperCam, and clamped to min max camera distance
|
function BaseCamera:GetMeasuredDistanceToFocus()
local camera = game.Workspace.CurrentCamera
if camera then
return (camera.CoordinateFrame.p - camera.Focus.p).magnitude
end
return nil
end
function BaseCamera:GetCameraLookVector()
return game.Workspace.CurrentCamera and game.Workspace.CurrentCamera.CFrame.lookVector or UNIT_Z
end
|
--------------------------------------------------------------------------------
|
while true do
while Humanoid.Health < Humanoid.MaxHealth and Humanoid.Health > 0 and Humanoid:GetState() ~= Enum.HumanoidStateType.Dead do
local dt = wait(REGEN_STEP)
local dh = dt * REGEN_RATE * Humanoid.MaxHealth
Humanoid.Health = math.min(Humanoid.Health + dh, Humanoid.MaxHealth)
end
Humanoid.HealthChanged:Wait()
end
|
-- setup emote chat hook
--game:GetService("Players").LocalPlayer.Chatted:connect(function(msg)
-- local emote = ""
-- if (string.sub(msg, 1, 3) == "/e ") then
-- emote = string.sub(msg, 4)
-- elseif (string.sub(msg, 1, 7) == "/emote ") then
-- emote = string.sub(msg, 8)
-- end
--
-- if (pose == "Standing" and emoteNames[emote] ~= nil) then
-- playAnimation(emote, 0.1, Humanoid)
-- end
--end)
| |
--used by checkTeams
|
local function tagHuman(human)
local tag = Tag:Clone()
tag.Parent = human
game:GetService("Debris"):AddItem(tag)
end
|
--Code--
|
local function PlayerTouched(Part)
local Parent = Part.Parent
if game.Players:GetPlayerFromCharacter(Parent) then
wait(0.8)
Brick.Transparency=Brick.Transparency+0.8
Brick.CanCollide=false
wait(2)
Brick.Transparency=0
Brick.CanCollide=true
end
end
Brick.Touched:connect(PlayerTouched)
|
-- 100 == 1 0 == 0 1/0.5
|
function JamCalculation()
local L_182_
if (math.random(1, 100) <= L_24_.JamChance) then
L_182_ = true
L_75_ = true
else
L_182_ = false
end
return L_182_
end
function TracerCalculation()
local L_183_
if (math.random(1, 100) <= L_24_.TracerChance) then
L_183_ = true
else
L_183_ = false
end
return L_183_
end
function ScreamCalculation()
local L_184_
if (math.random(1, 100) <= L_24_.SuppressCalloutChance) then
L_184_ = true
else
L_184_ = false
end
return L_184_
end
function SearchResupply(L_185_arg1)
local L_186_ = false
local L_187_ = nil
if L_185_arg1:FindFirstChild('ResupplyVal') or L_185_arg1.Parent:FindFirstChild('ResupplyVal') then
L_186_ = true
if L_185_arg1:FindFirstChild('ResupplyVal') then
L_187_ = L_185_arg1.ResupplyVal
elseif L_185_arg1.Parent:FindFirstChild('ResupplyVal') then
L_187_ = L_185_arg1.Parent.ResupplyVal
end
end
return L_186_, L_187_
end
function CheckReverb()
local L_188_, L_189_ = workspace:FindPartOnRayWithIgnoreList(Ray.new(L_6_.CFrame.p, (L_6_.CFrame.upVector).unit * 30), IgnoreList);
if L_188_ then
local L_190_ = L_59_:WaitForChild('Fire'):FindFirstChild('ReverbSoundEffect') or Instance.new("ReverbSoundEffect", L_59_:WaitForChild('Fire'))
elseif not L_188_ then
if L_59_:WaitForChild('Fire'):FindFirstChild('ReverbSoundEffect') then
L_59_.Fire.ReverbSoundEffect:Destroy()
end
end
end
function UpdateAmmo()
L_29_.Text = L_103_
L_30_.Text = L_29_.Text
L_31_.Text = '| ' .. math.ceil(L_104_ / L_24_.StoredAmmo)
L_32_.Text = L_31_.Text
if L_93_ == 0 then
L_40_.Image = 'rbxassetid://' .. 1868007495
elseif L_93_ == 1 then
L_40_.Image = 'rbxassetid://' .. 1868007947
elseif L_93_ == 2 then
L_40_.Image = 'rbxassetid://' .. 1868008584
end
if L_92_ == 1 then
L_35_.BackgroundTransparency = 0
L_36_.BackgroundTransparency = 0.7
L_37_.BackgroundTransparency = 0.7
L_38_.BackgroundTransparency = 0.7
L_39_.BackgroundTransparency = 0.7
elseif L_92_ == 2 then
L_35_.BackgroundTransparency = 0
L_36_.BackgroundTransparency = 0
L_37_.BackgroundTransparency = 0
L_38_.BackgroundTransparency = 0
L_39_.BackgroundTransparency = 0
elseif L_92_ == 3 then
L_35_.BackgroundTransparency = 0
L_36_.BackgroundTransparency = 0
L_37_.BackgroundTransparency = 0
L_38_.BackgroundTransparency = 0.7
L_39_.BackgroundTransparency = 0.7
elseif L_92_ == 4 then
L_35_.BackgroundTransparency = 0
L_36_.BackgroundTransparency = 0
L_37_.BackgroundTransparency = 0
L_38_.BackgroundTransparency = 0
L_39_.BackgroundTransparency = 0.7
elseif L_92_ == 5 then
L_35_.BackgroundTransparency = 0
L_36_.BackgroundTransparency = 0.7
L_37_.BackgroundTransparency = 0
L_38_.BackgroundTransparency = 0.7
L_39_.BackgroundTransparency = 0.7
elseif L_92_ == 6 then
L_35_.BackgroundTransparency = 0
L_36_.BackgroundTransparency = 0.7
L_37_.BackgroundTransparency = 0
L_38_.BackgroundTransparency = 0
L_39_.BackgroundTransparency = 0.7
end
end
|
-- Waits for script.childName to exist then returns it
|
local function scriptWaitForChild(childName)
while not script:FindFirstChild(childName) do wait() end
return script[childName]
end
local eatAnimation = scriptWaitForChild("EatAnimation")
|
-- A combo of table.find and table.keyOf -- This first attempts to find the ordinal index of your value, then attempts to find the lookup key if it can't find an ordinal index.
|
Table.indexOf = function (tbl, value)
local fromFind = table.find(tbl, value)
if fromFind then return fromFind end
return Table.keyOf(tbl, value)
end
|
--[[
Instantiates object fields
]]
|
function VehicleLightsComponent:setup()
local lights = self.model:FindFirstChild("Lights")
local headLights = lights:FindFirstChild("HeadLights")
local brakeLights = lights:FindFirstChild("BrakeLights")
self.headLights = headLights:GetChildren()
self.brakeLights = brakeLights:GetChildren()
end
|
--------------------------------------------------------------------------------------------
-- Popper uses the level geometry find an upper bound on subject-to-camera distance.
--
-- Hard limits are applied immediately and unconditionally. They are generally caused
-- when level geometry intersects with the near plane (with exceptions, see below).
--
-- Soft limits are only applied under certain conditions.
-- They are caused when level geometry occludes the subject without actually intersecting
-- with the near plane at the target distance.
--
-- Soft limits can be promoted to hard limits and hard limits can be demoted to soft limits.
-- We usually don"t want the latter to happen.
--
-- A soft limit will be promoted to a hard limit if an obstruction
-- lies between the current and target camera positions.
--------------------------------------------------------------------------------------------
|
local subjectRoot
local subjectPart
camera:GetPropertyChangedSignal("CameraSubject"):Connect(function()
local subject = camera.CameraSubject
if subject:IsA("Humanoid") then
subjectPart = subject.RootPart
elseif subject:IsA("BasePart") then
subjectPart = subject
else
subjectPart = nil
end
end)
local function canOcclude(part)
-- Occluders must be:
-- 1. Opaque
-- 2. Interactable
-- 3. Not in the same assembly as the subject
return
getTotalTransparency(part) < 0.25 and
part.CanCollide and
subjectRoot ~= (part:GetRootPart() or part) and
not part:IsA("TrussPart")
end
|
--- Cleans up all tasks.
-- @alias Destroy
|
function Maid:DoCleaning()
local tasks = self._tasks
-- Disconnect all events first as we know this is safe
for index, task in pairs(tasks) do
if typeof(task) == "RBXScriptConnection" then
tasks[index] = nil
task:Disconnect()
end
end
-- Clear out tasks table completely, even if clean up tasks add more tasks to the maid
local index, task = next(tasks)
while task ~= nil do
tasks[index] = nil
if type(task) == "function" then
task()
elseif typeof(task) == "RBXScriptConnection" then
task:Disconnect()
elseif task.Destroy then
task:Destroy()
end
index, task = next(tasks)
end
end
|
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
|
Target.Changed:Connect(function()
if Target.Value == "N/A" then
script.Parent.MedicineAberto.TratarFeridasAberto.PainKiller.Style = Enum.ButtonStyle.RobloxButton
script.Parent.MedicineAberto.TratarFeridasAberto.Energy.Style = Enum.ButtonStyle.RobloxButton
script.Parent.MedicineAberto.TratarFeridasAberto.Epinephrine.Style = Enum.ButtonStyle.RobloxButtonDefault
script.Parent.MedicineAberto.TratarFeridasAberto.Morphine.Style = Enum.ButtonStyle.RobloxButtonDefault
script.Parent.OtherAberto.TratarFeridasAberto.BloodBag.Style = Enum.ButtonStyle.RobloxButtonDefault
else
script.Parent.MedicineAberto.TratarFeridasAberto.PainKiller.Style = Enum.ButtonStyle.RobloxButtonDefault
script.Parent.MedicineAberto.TratarFeridasAberto.Energy.Style = Enum.ButtonStyle.RobloxButtonDefault
script.Parent.MedicineAberto.TratarFeridasAberto.Epinephrine.Style = Enum.ButtonStyle.RobloxButton
script.Parent.MedicineAberto.TratarFeridasAberto.Morphine.Style = Enum.ButtonStyle.RobloxButton
script.Parent.OtherAberto.TratarFeridasAberto.BloodBag.Style = Enum.ButtonStyle.RobloxButton
end
end)
script.Parent.BandagesAberto.TratarFeridasAberto.Comprimir.MouseButton1Down:Connect(function()
if Saude.Variaveis.Doer.Value == false then
if Target.Value == "N/A" then
Functions.Compress:FireServer()
Timer.Barra.Size = UDim2.new(0,0,1,0)
TS:Create(Timer.Barra, TweenInfo.new(5), {Size = UDim2.new(1,0,1,0)}):Play()
else
FunctionsMulti.Compress:FireServer()
Timer.Barra.Size = UDim2.new(0,0,1,0)
TS:Create(Timer.Barra, TweenInfo.new(5), {Size = UDim2.new(1,0,1,0)}):Play()
end
end
end)
script.Parent.BandagesAberto.TratarFeridasAberto.Bandagem.MouseButton1Down:Connect(function()
if Saude.Variaveis.Doer.Value == false then
if Target.Value == "N/A" then
Functions.Bandage:FireServer()
Timer.Barra.Size = UDim2.new(0,0,1,0)
TS:Create(Timer.Barra, TweenInfo.new(2), {Size = UDim2.new(1,0,1,0)}):Play()
else
FunctionsMulti.Bandage:FireServer()
Timer.Barra.Size = UDim2.new(0,0,1,0)
TS:Create(Timer.Barra, TweenInfo.new(2), {Size = UDim2.new(1,0,1,0)}):Play()
end
end
end)
script.Parent.BandagesAberto.TratarFeridasAberto.Tourniquet.MouseButton1Down:Connect(function()
if Saude.Variaveis.Doer.Value == false then
if Target.Value == "N/A" then
Functions.Tourniquet:FireServer()
Timer.Barra.Size = UDim2.new(0,0,1,0)
TS:Create(Timer.Barra, TweenInfo.new(2), {Size = UDim2.new(1,0,1,0)}):Play()
else
FunctionsMulti.Tourniquet:FireServer()
Timer.Barra.Size = UDim2.new(0,0,1,0)
TS:Create(Timer.Barra, TweenInfo.new(2), {Size = UDim2.new(1,0,1,0)}):Play()
end
end
end)
script.Parent.BandagesAberto.TratarFeridasAberto.Splint.MouseButton1Down:Connect(function()
if Saude.Variaveis.Doer.Value == false then
if Target.Value == "N/A" then
Functions.Splint:FireServer()
Timer.Barra.Size = UDim2.new(0,0,1,0)
TS:Create(Timer.Barra, TweenInfo.new(2), {Size = UDim2.new(1,0,1,0)}):Play()
else
FunctionsMulti.Splint:FireServer()
Timer.Barra.Size = UDim2.new(0,0,1,0)
TS:Create(Timer.Barra, TweenInfo.new(2), {Size = UDim2.new(1,0,1,0)}):Play()
end
end
end)
|
--[[
CameraShaker.CameraShakeInstance
cameraShaker = CameraShaker.new(renderPriority, callbackFunction)
CameraShaker:Start()
CameraShaker:Stop()
CameraShaker:Shake(shakeInstance)
CameraShaker:ShakeSustain(shakeInstance)
CameraShaker:ShakeOnce(magnitude, roughness [, fadeInTime, fadeOutTime, posInfluence, rotInfluence])
CameraShaker:StartShake(magnitude, roughness [, fadeInTime, posInfluence, rotInfluence])
EXAMPLE:
local camShake = CameraShaker.new(Enum.RenderPriority.Camera.Value, function(shakeCFrame)
camera.CFrame = playerCFrame * shakeCFrame
end)
camShake:Start()
-- Explosion shake:
camShake:Shake(CameraShaker.Presets.Explosion)
wait(1)
-- Custom shake:
camShake:ShakeOnce(3, 1, 0.2, 1.5)
NOTE:
This was based entirely on the EZ Camera Shake asset for Unity3D. I was given written
permission by the developer, Road Turtle Games, to port this to Roblox.
Original asset link: https://assetstore.unity.com/packages/tools/camera/ez-camera-shake-33148
--]]
|
local CameraShaker = {}
CameraShaker.__index = CameraShaker
local profileBegin = debug.profilebegin
local profileEnd = debug.profileend
local profileTag = "CameraShakerUpdate"
local V3 = Vector3.new
local CF = CFrame.new
local ANG = CFrame.Angles
local RAD = math.rad
local v3Zero = V3()
local CameraShakeInstance = require(script.Parent.CameraShakeInstance)
local CameraShakeState = CameraShakeInstance.CameraShakeState
local defaultPosInfluence = V3(0.15, 0.15, 0.15)
local defaultRotInfluence = V3(1, 1, 1)
CameraShaker.CameraShakeInstance = CameraShakeInstance
CameraShaker.Presets = require(script.Parent.CameraShakePresets)
function CameraShaker.new(renderPriority, callback)
assert(type(renderPriority) == "number", "RenderPriority must be a number (e.g.: Enum.RenderPriority.Camera.Value)")
assert(type(callback) == "function", "Callback must be a function")
local self = setmetatable({
_running = false;
_renderName = "CameraShaker";
_renderPriority = renderPriority;
_posAddShake = v3Zero;
_rotAddShake = v3Zero;
_camShakeInstances = {};
_removeInstances = {};
_callback = callback;
}, CameraShaker)
return self
end
function CameraShaker:Start()
if (self._running) then return end
self._running = true
local callback = self._callback
game:GetService("RunService"):BindToRenderStep(self._renderName, self._renderPriority, function(dt)
profileBegin(profileTag)
local cf = self:Update(dt)
profileEnd()
callback(cf)
end)
end
function CameraShaker:Stop()
if (not self._running) then return end
game:GetService("RunService"):UnbindFromRenderStep(self._renderName)
self._running = false
end
function CameraShaker:Update(dt)
local posAddShake = v3Zero
local rotAddShake = v3Zero
local instances = self._camShakeInstances
-- Update all instances:
for i = 1,#instances do
local c = instances[i]
local state = c:GetState()
if (state == CameraShakeState.Inactive and c.DeleteOnInactive) then
self._removeInstances[#self._removeInstances + 1] = i
elseif (state ~= CameraShakeState.Inactive) then
posAddShake = posAddShake + (c:UpdateShake(dt) * c.PositionInfluence)
rotAddShake = rotAddShake + (c:UpdateShake(dt) * c.RotationInfluence)
end
end
-- Remove dead instances:
for i = #self._removeInstances,1,-1 do
local instIndex = self._removeInstances[i]
table.remove(instances, instIndex)
self._removeInstances[i] = nil
end
return CF(posAddShake) *
ANG(0, RAD(rotAddShake.Y), 0) *
ANG(RAD(rotAddShake.X), 0, RAD(rotAddShake.Z))
end
function CameraShaker:Shake(shakeInstance)
assert(type(shakeInstance) == "table" and shakeInstance._camShakeInstance, "ShakeInstance must be of type CameraShakeInstance")
self._camShakeInstances[#self._camShakeInstances + 1] = shakeInstance
return shakeInstance
end
function CameraShaker:ShakeSustain(shakeInstance)
assert(type(shakeInstance) == "table" and shakeInstance._camShakeInstance, "ShakeInstance must be of type CameraShakeInstance")
self._camShakeInstances[#self._camShakeInstances + 1] = shakeInstance
shakeInstance:StartFadeIn(shakeInstance.fadeInDuration)
return shakeInstance
end
function CameraShaker:ShakeOnce(magnitude, roughness, fadeInTime, fadeOutTime, posInfluence, rotInfluence)
local shakeInstance = CameraShakeInstance.new(magnitude, roughness, fadeInTime, fadeOutTime)
shakeInstance.PositionInfluence = (typeof(posInfluence) == "Vector3" and posInfluence or defaultPosInfluence)
shakeInstance.RotationInfluence = (typeof(rotInfluence) == "Vector3" and rotInfluence or defaultRotInfluence)
self._camShakeInstances[#self._camShakeInstances + 1] = shakeInstance
return shakeInstance
end
function CameraShaker:StartShake(magnitude, roughness, fadeInTime, posInfluence, rotInfluence)
local shakeInstance = CameraShakeInstance.new(magnitude, roughness, fadeInTime)
shakeInstance.PositionInfluence = (typeof(posInfluence) == "Vector3" and posInfluence or defaultPosInfluence)
shakeInstance.RotationInfluence = (typeof(rotInfluence) == "Vector3" and rotInfluence or defaultRotInfluence)
shakeInstance:StartFadeIn(fadeInTime)
self._camShakeInstances[#self._camShakeInstances + 1] = shakeInstance
return shakeInstance
end
return CameraShaker
|
-- Set up the trigger event
|
script.Parent.Trigger.Touched:connect(function(obj)
if (game.Players:GetPlayerFromCharacter(obj.Parent)) then
local t = time()
if ((t-last) < 3) then return end -- 1-second debounce (time-based)
last = t
GoTo(open)
end
end)
|
-- Ensure tool mode is enabled, auto-updating is enabled, and version is outdated
|
if not (Tool:IsA 'Tool' and Tool.AutoUpdate.Value and IsVersionOutdated(Tool.Version.Value)) then
return;
end;
|
--[[--------------------------------------------------------------------
-- Notes:
-- * EOZ is implemented as a string, "EOZ"
-- * Format of z structure (ZIO)
-- z.n -- bytes still unread
-- z.p -- last read position position in buffer
-- z.reader -- chunk reader function
-- z.data -- additional data
-- * Current position, p, is now last read index instead of a pointer
--
-- Not implemented:
-- * luaZ_lookahead: used only in lapi.c:lua_load to detect binary chunk
-- * luaZ_read: used only in lundump.c:ezread to read +1 bytes
-- * luaZ_openspace: dropped; let Lua handle buffers as strings (used in
-- lundump.c:LoadString & lvm.c:luaV_concat)
-- * luaZ buffer macros: dropped; buffers are handled as strings
-- * lauxlib.c:getF reader implementation has an extraline flag to
-- skip over a shbang (#!) line, this is not implemented here
--
-- Added:
-- (both of the following are vaguely adapted from lauxlib.c)
-- * luaZ:make_getS: create Reader from a string
-- * luaZ:make_getF: create Reader that reads from a file
--
-- Changed in 5.1.x:
-- * Chunkreader renamed to Reader (ditto with Chunkwriter)
-- * Zio struct: no more name string, added Lua state for reader
-- (however, Yueliang readers do not require a Lua state)
----------------------------------------------------------------------]]
|
local luaZ = {}
|
--Retract FE code
|
F.Retract = function()
TS2:Play()
TS3:Play()
Sounds1.Off:Play()
Sounds2.Off:Play()
end
|
--[[Brakes]]
|
Tune.ABSEnabled = true -- Implements ABS
Tune.ABSThreshold = 20 -- Slip speed allowed before ABS starts working (in SPS)
Tune.FBrakeForce = 15000000 -- Front brake force
Tune.RBrakeForce = 10000000 -- Rear brake force
Tune.PBrakeForce = 50000000 -- Handbrake force
Tune.FLgcyBForce = 1500000 -- Front brake force [PGS OFF]
Tune.RLgcyBForce = 1000000 -- Rear brake force [PGS OFF]
Tune.LgcyPBForce = 2500000 -- Handbrake force [PGS OFF]
|
--DO NOT MESS WITH THIS
--DO NOT MESS WITH THIS
--DO NOT MESS WITH THIS
--DO NOT MESS WITH THIS
--DO NOT MESS WITH THIS
--DO NOT MESS WITH THIS
--DO NOT MESS WITH THIS
--DO NOT MESS WITH THIS
--DO NOT MESS WITH THIS
--DO NOT MESS WITH THIS
|
function onPlayerRespawned(newPlayer)
while true do
if newPlayer.Character ~= nil then break end
wait(.1)
end
local newJob = script.Health:Clone()
newJob.Disabled = false
newJob.Parent = newPlayer.Character
end
function onPlayerEntered(newPlayer)
newPlayer.Changed:connect(function (property)
if (property == "Character") then
onPlayerRespawned(newPlayer)
end
end)
end
game.Players.PlayerAdded:connect(onPlayerEntered)
|
--removes the dreidle on unequip
|
function onUnequipped()
if (dBody ~= nil) then
dBody:Remove()
end
if (dBase ~= nil) then
dBase:Remove()
end
end
|
-- services
|
local UserInputService = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local Workspace = game:GetService("Workspace")
local Players = game:GetService("Players")
|
--[=[
Holds utilty math functions not available on Roblox's math library.
@class Math
]=]
|
local Math = {}
|
--- Returns if the command bar is visible
|
function Window:IsVisible()
return Gui.Visible
end
|
----------------------------------------------------------------------
|
end
function computeLaunchAngle(dx,dy,grav)
-- arcane
-- http://en.wikipedia.org/wiki/Trajectory_of_a_projectile
local g = math.abs(grav)
local inRoot = (VELOCITY*VELOCITY*VELOCITY*VELOCITY) - (g * ((g*dx*dx) + (2*dy*VELOCITY*VELOCITY)))
if inRoot <= 0 then
return .25 * math.pi
end
local root = math.sqrt(inRoot)
local inATan1 = ((VELOCITY*VELOCITY) + root) / (g*dx)
local inATan2 = ((VELOCITY*VELOCITY) - root) / (g*dx)
local answer1 = math.atan(inATan1)
local answer2 = math.atan(inATan2)
if answer1 < answer2 then return answer1 end
return answer2
end
function computeDirection(vec)
local lenSquared = vec.magnitude * vec.magnitude
local invSqrt = 1 / math.sqrt(lenSquared)
return Vector3.new(vec.x * invSqrt, vec.y * invSqrt, vec.z * invSqrt)
end
Tool.Enabled = true
function onActivated()
if not Tool.Enabled then
local bewl = script.Parent:FindFirstChild("Bool")
if bewl then
bewl:Destroy()
end
return
end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
local targetPos = humanoid.TargetPoint
script.Parent.Handle.SlingshotSound:Play()
fire(targetPos)
Tool.Enabled = true
end
script.Parent.Activated:connect(onActivated)
|
--[[Member functions]]
|
function GunObject:Initialize()
self.Fire=WaitForChild(self.Handle, 'Fire')
self.Ammo = self.Tool:FindFirstChild("Ammo")
if self.Ammo ~= nil then
self.Ammo.Value = self.ClipSize
end
self.Clips = self.Tool:FindFirstChild("Clips")
if self.Clips ~= nil then
self.Clips.Value = self.StartingClips
end
self.Tool.Equipped:connect(function()
self.Tool.Handle.Fire:Stop()
self.Tool.Handle.Reload:Stop()
end)
self.Tool.Unequipped:connect(function()
self.Tool.Handle.Fire:Stop()
self.Tool.Handle.Reload:Stop()
end)
self.LaserObj = Instance.new("Part")
self.LaserObj.Name = "Bullet"
self.LaserObj.Anchored = true
self.LaserObj.CanCollide = false
self.LaserObj.Shape = "Block"
self.LaserObj.formFactor = "Custom"
self.LaserObj.Material = Enum.Material.Plastic
self.LaserObj.Locked = true
self.LaserObj.TopSurface = 0
self.LaserObj.BottomSurface = 0
--local tshellmesh=WaitForChild(script.Parent,'BulletMesh'):Clone()
--tshellmesh.Scale=Vector3.new(4,4,4)
--tshellmesh.Parent=self.LaserObj
local tSparkEffect = Instance.new("Part")
tSparkEffect.Name = "Effect"
tSparkEffect.Anchored = false
tSparkEffect.CanCollide = false
tSparkEffect.Shape = "Block"
tSparkEffect.formFactor = "Custom"
tSparkEffect.Material = Enum.Material.Plastic
tSparkEffect.Locked = true
tSparkEffect.TopSurface = 0
tSparkEffect.BottomSurface = 0
self.SparkEffect=tSparkEffect
local tshell = Instance.new('Part')
tshell.Name='effect'
tshell.FormFactor='Custom'
tshell.Size=Vector3.new(1, 0.4, 0.33)
tshell.BrickColor=BrickColor.new('Bright yellow')
tshellmesh=WaitForChild(script.Parent,'BulletMesh'):Clone()
tshellmesh.Parent=tshell
self.ShellPart = tshell
self.DownVal.Changed:connect(function()
while self.DownVal.Value and self.check and not self.Reloading do
self.check = false
local humanoid = self.Tool.Parent:FindFirstChild("Humanoid")
local plr1 = game.Players:GetPlayerFromCharacter(self.Tool.Parent)
if humanoid ~= nil and plr1 ~= nil then
if humanoid.Health > 0 then
local spos1 = (self.Tool.Handle.CFrame * self.BarrelPos).p
delay(0, function() self:SendBullet(spos1, self.AimVal.Value, self.Spread, self.SegmentLength, self.Tool.Parent, self.Colors[1], self.GunDamage, self.FadeDelayTime) end)
else
self.check = true
break
end
else
self.check = true
break
end
wait(self.FireRate)
self.check = true
if not self.Automatic then
break
end
end
end)
self.ReloadingVal.Changed:connect(function() if self.ReloadingVal.Value then self:Reload() end end)
end
function GunObject:Reload()
self.Reloading = true
self.ReloadingVal.Value = true
if self.Clips ~= nil then
if self.Clips.Value > 0 then
self.Clips.Value = Clips.Value - 1
else
self.Reloading = false
self.ReloadingVal.Value = false
return
end
end
self.Tool.Handle.Reload:Play()
for i = 1, self.ClipSize do
wait(self.ReloadTime/self.ClipSize)
self.Ammo.Value = i
end
self.Reloading = false
self.Tool.Reloading.Value = false
end
function GunObject:SpawnShell()
local tshell=self.ShellPart:Clone()
tshell.CFrame=self.Handle.CFrame
tshell.Parent=Workspace
game.Debris:AddItem(tshell,2)
end
function KnockOffHats(tchar)
for _,i in pairs(tchar:GetChildren()) do
if i:IsA('Hat') then
i.Parent=game.Workspace
end
end
end
function KnockOffTool(tchar)
for _,i in pairs(tchar:GetChildren()) do
if i:IsA('Tool') then
i.Parent=game.Workspace
end
end
end
function GunObject:SendBullet(boltstart, targetpos, fuzzyness, SegmentLength, ignore, clr, damage, fadedelay)
if self.Ammo.Value <=0 then return end
self.Ammo.Value = self.Ammo.Value - 1
--self:SpawnShell()
self.Fire.Pitch = (math.random() * .5) + .75
self.Fire:Play()
self.DoFireAni.Value = not self.DoFireAni.Value
print(self.Fire.Pitch)
local boltdist = self.Range
local clickdist = (boltstart - targetpos).magnitude
local targetpos = targetpos + (Vector3.new(math.random() - .5, math.random() - .5, math.random() - .5) * (clickdist/100))
local boltvec = (targetpos - boltstart).unit
local totalsegments = math.ceil(boltdist/SegmentLength)
local lastpos = boltstart
for i = 1, totalsegments do
local newpos = (boltstart + (boltvec * (boltdist * (i/totalsegments))))
local segvec = (newpos - lastpos).unit
local boltlength = (newpos - lastpos).magnitude
local bolthit, endpos = CastRay(lastpos, segvec, boltlength, ignore, false)
DrawBeam(lastpos, endpos, clr, fadedelay, self.LaserObj)
if bolthit ~= nil then
local h = bolthit.Parent:FindFirstChild("Humanoid")
if h ~= nil then
local plr = game.Players:GetPlayerFromCharacter(self.Tool.Parent)
if plr ~= nil then
local creator = Instance.new("ObjectValue")
creator.Name = "creator"
creator.Value = plr
creator.Parent = h
end
if hit.Parent:FindFirstChild("BlockShot") then
hit.Parent:FindFirstChild("BlockShot"):Fire(newpos)
delay(0, function() self:HitEffect(endpos, hit,5) end)
else
local enemyTorso = hit.Parent:FindFirstChild('Torso')
if(hit.Name=='Head') then
KnockOffHats(hit.Parent)
elseif hit.Name=='Left Leg' and enemyTorso:FindFirstChild('Left Hip') then
enemyTorso:FindFirstChild('Left Hip'):Destroy()
hit.Parent=Workspace
hit.CanCollide=true
game.Debris:AddItem(hit,10)
elseif hit.Name=='Right Leg' and enemyTorso:FindFirstChild('Right Hip') then
enemyTorso:FindFirstChild('Right Hip'):Destroy()
hit.Parent=Workspace
hit.CanCollide=true
game.Debris:AddItem(hit,10)
elseif hit.Name=='Left Arm' and enemyTorso:FindFirstChild('Left Shoulder') then
enemyTorso:FindFirstChild('Left Shoulder'):Destroy()
hit.Parent=Workspace
hit.CanCollide=true
game.Debris:AddItem(hit,10)
elseif hit.Name=='Right Arm' then
KnockOffTool(hit.Parent)
end
if GLib.IsTeammate(GLib.GetPlayerFromPart(script), GLib.GetPlayerFromPart(h))~=true then
GLib.TagHumanoid(GLib.GetPlayerFromPart(script), h, 1)
h:TakeDamage(damage)
end
end
else
delay(0, function() self:HitEffect(endpos, bolthit,5) end)
end
break
end
lastpos = endpos
wait(Rate)
end
if self.Ammo.Value < 1 then
self:Reload()
end
end
function GunObject:MakeSpark(pos,part)
local effect=self.SparkEffect:Clone()
effect.BrickColor = part.BrickColor
effect.Material = part.Material
effect.Transparency = part.Transparency
effect.Reflectance = part.Reflectance
effect.CFrame = CFrame.new(pos)
effect.Parent = game.Workspace
local effectVel = Instance.new("BodyVelocity")
effectVel.maxForce = Vector3.new(99999, 99999, 99999)
effectVel.velocity = Vector3.new(math.random() * 15 * SigNum(math.random( - 10, 10)), math.random() * 15 * SigNum(math.random( - 10, 10)), math.random() * 15 * SigNum(math.random( - 10, 10)))
effectVel.Parent = effect
effect.Size = Vector3.new(math.abs(effectVel.velocity.x)/30, math.abs(effectVel.velocity.y)/30, math.abs(effectVel.velocity.z)/30)
wait()
effectVel:Destroy()
local effecttime = .5
game.Debris:AddItem(effect, effecttime * 2)
local startTime = time()
while time() - startTime < effecttime do
if effect ~= nil then
effect.Transparency = (time() - startTime)/effecttime
end
wait()
end
if effect ~= nil then
effect.Parent = nil
end
end
function GunObject:HitEffect(pos,part,numSparks)
for i = 0, numSparks, 1 do
spawn(function() self:MakeSpark(pos,part) end)
end
end
|
--El sonido se encuentra dentro del Handle para que sólo se escuche cerca de quien lo lleva en mano.
| |
-- Decompiled with the Synapse X Luau decompiler.
|
client = nil;
cPcall = nil;
Pcall = nil;
Routine = nil;
service = nil;
return function(p1)
local l__Player__1 = service.Player;
local l__Toggle__2 = script.Parent.Parent.Toggle;
if client.Core.Get("Chat") then
l__Toggle__2.Position = UDim2.new(1, -85, 1, -45);
end;
l__Toggle__2.MouseButton1Down:Connect(function()
local v3 = client.Core.Get("UserPanel", nil, true);
if not v3 then
client.Core.Make("UserPanel", {});
return;
end;
v3.Object:Destroy();
end);
script.Parent.Parent.Parent = service.PlayerGui;
end;
|
-- ANimation
|
local Sound = script:WaitForChild("Haoshoku Sound")
UIS.InputBegan:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.X and Debounce == 1 and Tool.Equip.Value == true and Tool.Active.Value == "None" then
Debounce = 2
Track1 = plr.Character.Humanoid:LoadAnimation(script.AnimationCharge)
Track1:Play()
script.RemoteEventS:FireServer()
for i = 1,math.huge do
if Debounce == 2 then
plr.Character.HumanoidRootPart.Anchored = true
else
break
end
wait()
end
end
end)
UIS.InputEnded:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.X and Debounce == 2 and Tool.Equip.Value == true and Tool.Active.Value == "None" then
Debounce = 3
local Track2 = plr.Character.Humanoid:LoadAnimation(script.AnimationRelease)
Track2:Play()
Track1:Stop()
Sound:Play()
local camera = game.Workspace.CurrentCamera
local CameraShaker = require(game.ReplicatedStorage.CameraShaker)
local camshake = CameraShaker.new(Enum.RenderPriority.Camera.Value,function(shakeCFrame)
camera.CFrame = camera.CFrame * shakeCFrame
end)
camshake:Start()
camshake:Shake(CameraShaker.Presets.Explosion)
local mousepos = Mouse.Hit
script.RemoteEvent:FireServer(mousepos,Mouse.Hit.p)
wait(1)
plr.Character.LeftHand.EFhand:Destroy()
plr.Character.RightHand.EFhand:Destroy()
Track2:Stop()
wait(.5)
Tool.Active.Value = "None"
wait(1.5)
plr.Character.HumanoidRootPart.Anchored = false
wait(5)
Debounce = 1
end
end)
|
-- Head
|
character.Constraint.ConstraintHead.Attachment0 = Neck
character.Constraint.ConstraintHead.Attachment1 = Head
|
--[[
There is a bug where the Humanoid will enter RunningNoPhysics and pass though the barriers,
here we disable that state.
Also, set the character's Z velocity to match that of the platform when the character is in Freefall
]]
|
local function setupPlatformMinigame()
local localPlayer = Players.localPlayer
local character = localPlayer.Character
if character then
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid then
humanoid:SetStateEnabled(Enum.HumanoidStateType.RunningNoPhysics, false)
if humanoid:GetState() == Enum.HumanoidStateType.RunningNoPhysics then
humanoid:ChangeState(Enum.HumanoidStateType.Running)
end
local platformPart
connection =
RunService.Stepped:Connect(
function()
-- The platform part may not have replicated yet, so we need to make sure it exists
if not platformPart then
local map = workspace:FindFirstChild("Platform")
if map then
local platformModel = map:FindFirstChild("Platform")
if platformModel then
platformPart = platformModel.PrimaryPart
end
end
end
if not platformPart then
return
end
-- When the Humanoid is in Freefall it will no longer be governed by the platform's velocity
if humanoid.RootPart and humanoid:GetState() == Enum.HumanoidStateType.Freefall then
local rootPos = humanoid.RootPart.Position
-- Check if the character is in bounds of the platform
if not isVector3InBoundsOfPart(rootPos, platformPart) then
return
end
local rootVelocity = humanoid.RootPart.Velocity
humanoid.RootPart.Velocity = Vector3.new(rootVelocity.X, rootVelocity.Y, platformPart.Velocity.Z)
end
end
)
end
end
end
return function(minigameName)
if connection then
connection:Disconnect()
connection = nil
end
if minigameName == "Platform Panic" then
setupPlatformMinigame()
end
end
|
--Knife variables
|
local knife = script.Parent:WaitForChild("Knife")
local knifeWeld = knife:WaitForChild("Knife Weld")
|
--Button interface
|
function touch_button:Enable(id)
self.enabled = id and true or false
self.button.Active = id and true or false
self.button.Parent.Parent.Visible = self.enabled
end
return touch_button
|
--[[ Roblox Services ]]
|
--
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local VRService = game:GetService("VRService")
local UserGameSettings = UserSettings():GetService("UserGameSettings")
|
--
|
FLDisk.CanCollide = true
FRDisk.CanCollide = true
RLDisk.CanCollide = true
RRDisk.CanCollide = true
hitboxF.CanCollide = true
hitboxR.CanCollide = true
weight.CustomPhysicalProperties = PhysicalProperties.new((((VehicleWeight/90)*0.4)-6.2)+0.4,1,1,1,1)
engine.CustomPhysicalProperties = PhysicalProperties.new(0.04,1,1,1,1)
fuel.CustomPhysicalProperties = PhysicalProperties.new(0.06,1,1,1,1)
trans.CustomPhysicalProperties = PhysicalProperties.new(0.1,1,1,1,1)
diff.CustomPhysicalProperties = PhysicalProperties.new(0.1,1,1,1,1)
weight.Transparency = 1
engine.Transparency = 1
fuel.Transparency = 1
trans.Transparency = 1
diff.Transparency = 1
FLDisk.CustomPhysicalProperties = PhysicalProperties.new(1,2,0,100,0)
FRDisk.CustomPhysicalProperties = PhysicalProperties.new(1,2,0,100,0)
RLDisk.CustomPhysicalProperties = PhysicalProperties.new(1,2,0,100,0)
RRDisk.CustomPhysicalProperties = PhysicalProperties.new(1,2,0,100,0)
FLPad.CustomPhysicalProperties = PhysicalProperties.new(1,2,0,100,0)
FRPad.CustomPhysicalProperties = PhysicalProperties.new(1,2,0,100,0)
RLPad.CustomPhysicalProperties = PhysicalProperties.new(1,2,0,100,0)
RRPad.CustomPhysicalProperties = PhysicalProperties.new(1,2,0,100,0)
UFLPad.CustomPhysicalProperties = PhysicalProperties.new(1,2,0,100,0)
UFRPad.CustomPhysicalProperties = PhysicalProperties.new(1,2,0,100,0)
hitboxF.CanCollide = true
hitboxR.CanCollide = true
local GUISC = script.Assets.GUI:Clone()
GUISC.Parent = script.Parent
GUISC.Disabled = false
local Plugins = script.Plugins
for _,i in pairs(Plugins:GetChildren()) do i.Parent = script.Parent.Screen end
wait(1)
hitboxF.CanCollide = true
hitboxR.CanCollide = true
frontstiffness = 1290 * StiffnessFront
frontdamping = 40 * StiffnessFront
rearstiffness = 1290 * StiffnessRear
reardamping = 40 * StiffnessRear
springFL.Stiffness = frontstiffness
springFR.Stiffness = frontstiffness
springRL.Stiffness = rearstiffness
springRR.Stiffness = rearstiffness
wait(5)
hitboxF.CanCollide = true
hitboxR.CanCollide = true
wait(5)
hitboxF.CanCollide = true
hitboxR.CanCollide = true end
|
--Public functions
|
function DataStore:Get(defaultValue, dontAttemptGet)
if dontAttemptGet then
return self.value
end
local backupCount = 0
if not self.haveValue then
while not self.haveValue do
local success, error = self:_GetRaw():await()
if not success then
if self.backupRetries then
backupCount = backupCount + 1
if backupCount >= self.backupRetries then
self.backup = true
self.haveValue = true
self.value = self.backupValue
break
end
end
self:Debug("Get returned error:", error)
end
end
if self.value ~= nil then
for _,modifier in pairs(self.beforeInitialGet) do
self.value = modifier(self.value, self)
end
end
end
local value
if self.value == nil and defaultValue ~= nil then --not using "not" because false is a possible value
value = defaultValue
else
value = self.value
end
value = clone(value)
self.value = value
return value
end
function DataStore:GetAsync(...)
local args = { ... }
return Promise.async(function(resolve)
resolve(self:Get(unpack(args)))
end)
end
function DataStore:GetTable(default, ...)
local success, result = self:GetTableAsync(default, ...):await()
if not success then
error(result)
end
return result
end
function DataStore:GetTableAsync(default, ...)
assert(default ~= nil, "You must provide a default value.")
return self:GetAsync(default, ...):andThen(function(result)
local changed = false
assert(
typeof(result) == "table",
":GetTable/:GetTableAsync was used when the value in the data store isn't a table."
)
for defaultKey, defaultValue in pairs(default) do
if result[defaultKey] == nil then
result[defaultKey] = defaultValue
changed = true
end
end
if changed then
self:Set(result)
end
return result
end)
end
function DataStore:Set(value, _dontCallOnUpdate)
self.value = clone(value)
self:_Update(_dontCallOnUpdate)
end
function DataStore:Update(updateFunc)
self.value = updateFunc(self.value)
self:_Update()
end
function DataStore:Increment(value, defaultValue)
self:Set(self:Get(defaultValue) + value)
end
function DataStore:IncrementAsync(add, defaultValue)
self:GetAsync(defaultValue):andThen(function(value)
self:Set(value + add)
end)
end
function DataStore:OnUpdate(callback)
table.insert(self.callbacks, callback)
end
function DataStore:BeforeInitialGet(modifier)
table.insert(self.beforeInitialGet, modifier)
end
function DataStore:BeforeSave(modifier)
self.beforeSave = modifier
end
function DataStore:AfterSave(callback)
table.insert(self.afterSave, callback)
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.