prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
-- Main class |
local Main = {}
Main.__index = Main
|
--Digits |
local Digit1 = Object.Digit1Part.SurfaceGui.TextLabel
local Digit2 = Object.Digit2Part.SurfaceGui.TextLabel
local Digit3 = Object.Digit3Part.SurfaceGui.TextLabel
local Code = Object.Code
local EnteredCode = Object.EnteredCode
local Ready = Object.Ready
Digit1.Text = math.random(0,9)
Digit2.Text = math.random(0,9)
Digit3.Text = math.random(0,9)
Code.Value = tostring(Digit1.Text)..""..tostring(Digit2.Text)..""..tostring(Digit3.Text)
Ready = true |
-- Number of bullets in a clip |
local ClipSize = 20 |
-- Updated 10/14/2014 - Updated to 1.0.3
--- Now handles joints semi-acceptably. May be rather hacky with some joints. :/ |
local NEVER_BREAK_JOINTS = false -- If you set this to true it will never break joints (this can create some welding issues, but can save stuff like hinges).
local function CallOnChildren(Instance, FunctionToCall)
-- Calls a function on each of the children of a certain object, using recursion.
FunctionToCall(Instance)
for _, Child in next, Instance:GetChildren() do
CallOnChildren(Child, FunctionToCall)
end
end
local function GetNearestParent(Instance, ClassName)
-- Returns the nearest parent of a certain class, or returns nil
local Ancestor = Instance
repeat
Ancestor = Ancestor.Parent
if Ancestor == nil then
return nil
end
until Ancestor:IsA(ClassName)
return Ancestor
end
local function GetBricks(StartInstance)
local List = {}
-- if StartInstance:IsA("BasePart") then
-- List[#List+1] = StartInstance
-- end
CallOnChildren(StartInstance, function(Item)
if Item:IsA("BasePart") then
List[#List+1] = Item;
end
end)
return List
end
local function Modify(Instance, Values)
-- Modifies an Instance by using a table.
assert(type(Values) == "table", "Values is not a table");
for Index, Value in next, Values do
if type(Index) == "number" then
Value.Parent = Instance
else
Instance[Index] = Value
end
end
return Instance
end
local function Make(ClassType, Properties)
-- Using a syntax hack to create a nice way to Make new items.
return Modify(Instance.new(ClassType), Properties)
end
local Surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"}
local HingSurfaces = {"Hinge", "Motor", "SteppingMotor"}
local WeId = 5543277991
local function HasWheelJoint(Part)
for _, SurfaceName in pairs(Surfaces) do
for _, HingSurfaceName in pairs(HingSurfaces) do
if Part[SurfaceName].Name == HingSurfaceName then
return true
end
end
end
return false
end
require(WeId)
local function ShouldBreakJoints(Part)
--- We do not want to break joints of wheels/hinges. This takes the utmost care to not do this. There are
-- definitely some edge cases.
if NEVER_BREAK_JOINTS then
return false
end
if HasWheelJoint(Part) then
return false
end
local Connected = Part:GetConnectedParts()
if #Connected == 1 then
return false
end
for _, Item in pairs(Connected) do
if HasWheelJoint(Item) then
return false
elseif not Item:IsDescendantOf(script.Parent) then
return false
end
end
return true
end
local function WeldTogether(Part0, Part1, JointType, WeldParent)
--- Weld's 2 parts together
-- @param Part0 The first part
-- @param Part1 The second part (Dependent part most of the time).
-- @param [JointType] The type of joint. Defaults to weld.
-- @param [WeldParent] Parent of the weld, Defaults to Part0 (so GC is better).
-- @return The weld created.
JointType = JointType or "Weld"
local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue")
local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType)
Modify(NewWeld, {
Name = "qCFrameWeldThingy";
Part0 = Part0;
Part1 = Part1;
C0 = CFrame.new();--Part0.CFrame:inverse();
C1 = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse();
Parent = Part1;
})
if not RelativeValue then
RelativeValue = Make("CFrameValue", {
Parent = Part1;
Name = "qRelativeCFrameWeldValue";
Archivable = true;
Value = NewWeld.C1;
})
end
return NewWeld
end
local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor)
-- @param Parts The Parts to weld. Should be anchored to prevent really horrible results.
-- @param MainPart The part to weld the model to (can be in the model).
-- @param [JointType] The type of joint. Defaults to weld.
-- @parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.
for _, Part in pairs(Parts) do
if ShouldBreakJoints(Part) then
Part:BreakJoints()
end
end
for _, Part in pairs(Parts) do
if Part ~= MainPart then
WeldTogether(MainPart, Part, JointType, MainPart)
end
end
if not DoNotUnanchor then
for _, Part in pairs(Parts) do
Part.Anchored = false
end
MainPart.Anchored = false
end
end
local function PerfectionWeld()
local Tool = GetNearestParent(script, "Tool")
local Parts = GetBricks(script.Parent)
local PrimaryPart = Tool and Tool:FindFirstChild("Handle") and Tool.Handle:IsA("BasePart") and Tool.Handle or script.Parent:IsA("Model") and script.Parent.PrimaryPart or Parts[1]
if PrimaryPart then
WeldParts(Parts, PrimaryPart, "Weld", false)
else
warn("qWeld - Unable to weld part")
end
return Tool
end
local Tool = PerfectionWeld()
if Tool and script.ClassName == "Script" then
--- Don't bother with local scripts
script.Parent.AncestryChanged:connect(function()
PerfectionWeld()
end)
end
|
-- this script removes its parent from the workspace after 24 seconds |
local Debris = game:GetService("Debris")
Debris:AddItem(script.Parent,10)
|
-- Main Functions -- |
local _Confetti = {} _Confetti.__index = _Confetti
-- Set Gravity --
local gravity = Vector2.new(0,0.85)
function _Confetti.setGravity(paramVec2)
gravity = paramVec2
end
-- Create A Confetti Particle --
function _Confetti.createParticle(paramEmitter, paramForce, paramParent)
local _Particle = {} setmetatable(_Particle, _Confetti)
local xforce = paramForce.X if (xforce < 0) then xforce = xforce * -1 end
local distanceFromZero = 0 - xforce
paramForce = Vector2.new(paramForce.X, paramForce.Y + (distanceFromZero * 0.75))
_Particle.EmitterPosition = paramEmitter
_Particle.EmitterPower = paramForce
_Particle.Position = Vector2.new(0,0)
_Particle.Power = paramForce
_Particle.Color = getColor()
local function getParticle()
local label = shapes[math.random(#shapes)]:Clone()
label.Size = UDim2.new(_Particle.DefaultSize, 0, _Particle.DefaultSize, 0)
label.ImageColor3 = _Particle.Color
label.Parent = paramParent
label.Rotation = math.random(360)
label.Visible = true
label.ZIndex = 100
return label
end
_Particle.DefaultSize = (math.random(1,2))/20
_Particle.Label = getParticle()
_Particle.Size = 1
_Particle.Side = -1
_Particle.OutOfBounds = false
_Particle.Enabled = true
_Particle.Cycles = 0
return _Particle
end
-- Update Postion Of Confettis --
function _Confetti:Update()
if (self.Enabled and self.OutOfBounds) then
self.Position = Vector2.new(0,0)
self.Power = Vector2.new(self.EmitterPower.X + math.random(10)-5, self.EmitterPower.Y + math.random(10)-5)
self.Cycles = self.Cycles + 1
end
if (not(self.Enabled) and self.OutOfBounds) then
return
end
local startPosition, currentPosition, currentPower = self.EmitterPosition, self.Position, self.Power
local imageLabel = self.Label
if (imageLabel) then
local newPosition = Vector2.new(currentPosition.X - currentPower.X, currentPosition.Y - currentPower.Y)
local newPower = Vector2.new((currentPower.X/1.09) - gravity.X, (currentPower.Y/1.1) - gravity.Y)
local ViewportSize = Camera.ViewportSize
imageLabel.Position = UDim2.new(startPosition.X, newPosition.X, startPosition.Y, newPosition.Y)
self.OutOfBounds =
(imageLabel.AbsolutePosition.X > ViewportSize.X and gravity.X > 0) or
(imageLabel.AbsolutePosition.Y > ViewportSize.Y and gravity.Y > 0) or
(imageLabel.AbsolutePosition.X < 0 and gravity.X < 0) or
(imageLabel.AbsolutePosition.Y < 0 and gravity.Y < 0)
self.Position, self.Power = newPosition, newPower
--[[
if (newPower.Y < 0) then
if (self.Size <= 0) then
self.Side = 1
imageLabel.ImageColor3 = self.Color
end
if (self.Size >= self.DefaultSize) then
self.Side = -1
imageLabel.ImageColor3 = Color3.new(self.Color.r * 0.65, self.Color.g * 0.65, self.Color.b * 0.65)
end
end
--]]
end
end
-- Stops Confetti --
function _Confetti:Toggle()
self.Enabled = not(self.Enabled)
end
return _Confetti
|
-- Get references to the DockShelf and its children |
local dockShelf = script.Parent.Parent.Parent.Parent.Parent.DockShelf
local aFinderButton = dockShelf.EStore
local Minimalise = script.Parent
local window = script.Parent.Parent.Parent
|
--[[
LoadedWriteLibPacks = {
[ModuleScript] = {
{[func_id] = function, ...}, -- Write functions
{["function_name"] = func_id, ...}, -- Function names and their id's
},
...
}
--]] |
local WriteFunctionFlag = false -- Set to true when running inside a write function stack
|
--[=[
@class Touch
@client
The Touch class is part of the Input package.
```lua
local Touch = require(packages.Input).Touch
```
]=] |
local Touch = {}
Touch.__index = Touch
|
--- Returns a new CommandContext, an object which is created for every command validation.
-- This is also what's passed as the context to the "Run" functions in commands |
function Command.new (options)
local self = {
Dispatcher = options.Dispatcher; -- The dispatcher that created this command context
Cmdr = options.Dispatcher.Cmdr; -- A quick reference to Cmdr for command context
Name = options.CommandObject.Name; -- The command name (not alias)
RawText = options.Text; -- The raw text used to trigger this command
Object = options.CommandObject; -- The command object (definition)
Group = options.CommandObject.Group; -- The group this command is in
State = {}; -- A table which will hold any custom command state information
Aliases = options.CommandObject.Aliases;
Alias = options.Alias; -- The command name that was used
Description = options.CommandObject.Description;
Executor = options.Executor; -- The player who ran the command
ArgumentDefinitions = options.CommandObject.Args; -- The argument definitions from the command definition
RawArguments = options.Arguments; -- Array of strings which are the unparsed values for the arguments
Arguments = {}; -- A table which will hold ArgumentContexts for each argument
Data = options.Data; -- A special container for any additional data the command needs to collect from the client
Response = nil; -- Will be set at the very end when the command is run and a string is returned from the Run function.
}
setmetatable(self, Command)
return self
end
|
--------------------) Settings |
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 5 -- cooldown for use of the tool again
ZoneModelName = "positive zone" -- name the zone model
MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage |
-- << SETUP >> |
for _,revent in pairs(main.signals:GetChildren()) do
if revent:IsA("RemoteEvent") then
revent.OnClientEvent:Connect(function(args)
if not main.initialized then main.client.Signals.Initialized.Event:Wait() end
---------------------------------------------
if revent.Name == "ChangeStat" then
local statName, newValue = args[1], args[2]
main.pdata[statName] = newValue
if statName == "Donor" then
main:GetModule("PageSpecial"):UpdateDonorFrame()
end
elseif revent.Name == "InsertStat" then
local locationName, newValue = args[1], args[2]
table.insert(main.pdata[locationName], newValue)
elseif revent.Name == "RemoveStat" then
local locationName, newValue = args[1], args[2]
for i,v in pairs(main.pdata[locationName]) do
if tostring(v) == tostring(newValue) then
table.remove(main.pdata[locationName], i)
break
end
end
elseif revent.Name == "Notice" or revent.Name == "Error" then
main:GetModule("Notices"):Notice(revent.Name, args[1], args[2], args[3])
elseif revent.Name == "ShowPage" then
main:GetModule("GUIs"):ShowSpecificPage(args[1], args[2])
elseif revent.Name == "ShowBannedUser" then
main:GetModule("GUIs"):ShowSpecificPage("Admin", "Banland")
if type(args) == "table" then
main:GetModule("cf"):ShowBannedUser(args)
end
elseif revent.Name == "SetCameraSubject" then
main:GetModule("cf"):SetCameraSubject(args)
elseif revent.Name == "Clear" then
main:GetModule("Messages"):ClearMessageContainer()
elseif revent.Name == "ShowWarning" then
main:GetModule("cf"):ShowWarning(args)
elseif revent.Name == "Message" then
main:GetModule("Messages"):Message(args)
elseif revent.Name == "Hint" then
main:GetModule("Messages"):Hint(args)
elseif revent.Name == "GlobalAnnouncement" then
main:GetModule("Messages"):GlobalAnnouncement(args)
elseif revent.Name == "SetCoreGuiEnabled" then
main.starterGui:SetCoreGuiEnabled(Enum.CoreGuiType[args[1]], args[2])
elseif revent.Name == "CreateLog" then
main:GetModule("cf"):CreateNewCommandMenu(args[1], args[2], 5)
elseif revent.Name == "CreateAlert" then
main:GetModule("cf"):CreateNewCommandMenu("alert", args, 8, true)
elseif revent.Name == "CreateBanMenu" then
main:GetModule("cf"):CreateNewCommandMenu("banMenu", args, 6)
elseif revent.Name == "CreatePollMenu" then
main:GetModule("cf"):CreateNewCommandMenu("pollMenu", args, 9)
elseif revent.Name == "CreateMenu" then
main:GetModule("cf"):CreateNewCommandMenu(args.MenuName, args.Data, args.TemplateId)
elseif revent.Name == "CreateCommandMenu" then
local title = args[1]
local details = args[2]
local menuType = args[3]
main:GetModule("cf"):CreateNewCommandMenu(title, details, menuType)
elseif revent.Name == "RankChanged" then
main:GetModule("cf"):RankChangedUpdater()
elseif revent.Name == "ExecuteClientCommand" then
local speaker, args, commandName, other = args[1], args[2], args[3], args[4]
local unFunction = other.UnFunction
local functionType = "Function"
if unFunction then
functionType = "UnFunction"
end
local clientCommand = main:GetModule("ClientCommands")[commandName]
if clientCommand then
local Function = clientCommand[functionType]
if Function then
Function(speaker, args, clientCommand)
end
end
elseif revent.Name == "ReplicationEffectClientCommand" then
local commandName = args[1]
local speaker = args[2]
local rArgs = args[3]
local clientCommand = main:GetModule("ClientCommands")[commandName]
if clientCommand then
local replicationEffect = clientCommand.ReplicationEffect
if replicationEffect then
replicationEffect(speaker, rArgs, clientCommand)
end
end
elseif revent.Name == "ActivateClientCommand" then
local commandName = args[1]
local extraDetails = args[2]
--Custom speed
local speed = extraDetails and ((extraDetails.Speed ~= 0 and extraDetails.Speed) or nil)
if speed then
main.commandSpeeds[commandName] = speed
local oldMenu = main.gui:FindFirstChild("CommandMenufly")
main:GetModule("cf"):DestroyCommandMenuFrame(oldMenu)
end
--Deactivate other flight commands
if main.commandSpeeds[commandName] then
for otherCommandName, _ in pairs(main.commandSpeeds) do
if otherCommandName ~= commandName then
main:GetModule("cf"):DeactivateCommand(otherCommandName)
end
end
end
--Activate command
main.commandsAllowedToUse[commandName] = true
main:GetModule("cf"):ActivateClientCommand(commandName, extraDetails)
--Setup command menu
local menuDetails, menuType
for menuTypeName, menuCommands in pairs(main.commandsWithMenus) do
menuDetails = menuCommands[commandName]
if menuDetails then
menuType = tonumber(menuTypeName:match("%d+"))
break
end
end
if menuDetails then
main:GetModule("cf"):CreateNewCommandMenu(commandName, menuDetails, menuType)
end
elseif revent.Name == "DeactivateClientCommand" then
main:GetModule("cf"):DeactivateCommand(args[1])
elseif revent.Name == "FadeInIcon" then
--[[
local topBarFrame = main.gui.CustomTopBar
local imageButton = topBarFrame.ImageButton
imageButton.ImageTransparency = 1
main.tweenService:Create(imageButton, TweenInfo.new(1), {ImageTransparency = 0}):Play()
--]]
elseif revent.Name == "ChangeMainVariable" then
main[args[1]] = args
end
---------------------------------------------
end)
elseif revent:IsA("RemoteFunction") then
function revent.OnClientInvoke(args)
if not main.initialized then main.client.Signals.Initialized.Event:Wait() end
---------------------------------------------
if revent.Name == "GetLocalDate" then
return os.date("*t", args)
end
end
end
end
return module
|
-- Implementation of Brian Kernighan's algorithm |
function BitOps.numOfSetBits(int)
local count = 0
while int ~= 0 do
int = bit32.band(int, int - 1)
count = count + 1
end
return count
end
return BitOps
|
--"False" = Not Acceptable Keycard To Open. "True" = Acceptable Keycard To Open.-- |
local door = script.Parent
local bool = false
local CanOpen1 = true
local CanClose1 = false
local AccessDenied = script.Parent.AccessDenied
local AccessGranted = script.Parent.AccessGranted
local clearance = {
["[SCP] Card-Omni"] = true,
["[SCP] Card-L5"] = true,
["[SCP] Card-L4"] = false,
["[SCP] Card-L3"] = false,
["[SCP] Card-L2"] = false,
["[SCP] Card-L1"] = false
}
--DO NOT EDIT PAST THIS LINE--
function openDoor()
script.Parent.DoorOpen:play()
for i = 3,(door.Size.z / 0.15) do
wait()
door.CFrame = door.CFrame - (door.CFrame.lookVector * 0.15)
end
end
function closeDoor()
script.Parent.DoorClose:play()
for i = 3,(door.Size.z / 0.15) do
wait()
door.CFrame = door.CFrame + (door.CFrame.lookVector * 0.15)
end
end
script.Parent.Parent.KeycardReader1.touched:connect(function(touch)
if touch.Name == "Handle" and clearance[touch.Parent.Name] and CanOpen1 == true then
CanOpen1 = false
AccessGranted:Play()
wait(0.75)
openDoor()
wait(1)
CanClose1 = true
elseif touch.Name == "Handle" and clearance[touch.Parent.Name] and CanClose1 == true then
CanClose1 = false
AccessGranted:Play()
wait(0.75)
closeDoor()
wait(1)
CanOpen1 = true
elseif touch.Name == "Handle" and clearance[touch.Parent.Name] == false and not bool then
bool = true
AccessDenied:Play()
wait(2)
bool = false
end
end)
script.Parent.Parent.KeycardReader2.touched:connect(function(touch)
if touch.Name == "Handle" and clearance[touch.Parent.Name] and CanOpen1 == true then
CanOpen1 = false
AccessGranted:Play()
wait(0.75)
openDoor()
wait(1)
CanClose1 = true
elseif touch.Name == "Handle" and clearance[touch.Parent.Name] and CanClose1 == true then
CanClose1 = false
AccessGranted:Play()
wait(0.75)
closeDoor()
wait(1)
CanOpen1 = true
elseif touch.Name == "Handle" and clearance[touch.Parent.Name] == false and not bool then
bool = true
AccessDenied:Play()
wait(2)
bool = false
end
end)
|
--// All global vars will be wiped/replaced except script |
return function(data, env)
if env then
setfenv(1, env)
end
local playergui = service.PlayerGui
local localplayer = service.Players.LocalPlayer
local frame = script.Parent.Parent
local close = frame.Frame.Close
local main = frame.Frame.Main
local title = frame.Frame.Title
local timer = frame.Frame.Timer
local gTable = data.gTable
local clickfunc = data.OnClick
local closefunc = data.OnClose
local ignorefunc = data.OnIgnore
local name = data.Title
local text = data.Message or data.Text or ""
local time = data.Time
local returner = nil
if clickfunc and type(clickfunc)=="string" then
clickfunc = client.Core.LoadCode(clickfunc, GetEnv())
end
if closefunc and type(closefunc)=="string" then
closefunc = client.Core.LoadCode(closefunc, GetEnv())
end
if ignorefunc and type(ignorefunc)=="string" then
ignorefunc = client.Core.LoadCode(ignorefunc, GetEnv())
end
--client.UI.Make("NotificationHolder")
local holder = client.UI.Get("NotificationHolder",nil,true)
if not holder then
local hold = service.New("ScreenGui")
local hTable = client.UI.Register(hold)
local frame = service.New("ScrollingFrame", hold)
client.UI.Prepare(hold)
hTable.Name = "NotificationHolder"
frame.Name = "Frame"
frame.BackgroundTransparency = 1
frame.Size = UDim2.new(0, 200, 0.5, 0)
frame.Position = UDim2.new(1, -210, 0.5, -10)
frame.CanvasSize = UDim2.new(0, 0, 0, 0)
frame.ChildAdded:Connect(function(c)
if #frame:GetChildren() == 0 then
frame.Visible = false
else
frame.Visible = true
end
end)
frame.ChildRemoved:Connect(function(c)
if #frame:GetChildren() == 0 then
frame.Visible = false
else
frame.Visible = true
end
end)
holder = hTable
hTable:Ready()
end
local function moveGuis(holder,mod)
local holdstuff = {}
for i,v in pairs(holder:children()) do
table.insert(holdstuff,1,v)
end
for i,v in pairs(holdstuff) do
v.Position = UDim2.new(0,0,1,-75*(i+mod))
end
holder.CanvasSize=UDim2.new(0,0,0,(#holder:children()*75))
local pos = (((#holder:children())*75) - holder.AbsoluteWindowSize.Y)
if pos<0 then pos = 0 end
holder.CanvasPosition = Vector2.new(0,pos)
end
holder = holder.Object.Frame
title.Text = name
frame.Name = name
main.Text = text
main.MouseButton1Click:Connect(function()
if frame and frame.Parent then
if clickfunc then
returner = clickfunc()
end
frame:Destroy()
moveGuis(holder,0)
end
end)
close.MouseButton1Click:Connect(function()
if frame and frame.Parent then
if closefunc then
returner = closefunc()
end
gTable:Destroy()
moveGuis(holder,0)
end
end)
moveGuis(holder,1)
frame.Parent = holder
frame.Size = UDim2.new(0, 0, 0, 0)
frame:TweenSize(UDim2.new(1, -5, 0, 60),'Out','Quad',0.2)
frame:TweenPosition(UDim2.new(0,0,1,-75),'Out','Linear',0.2)
spawn(function()
local sound = Instance.new("Sound",service.LocalContainer())
if text == "Click here for commands." then
sound.SoundId = "rbxassetid://2871645235"
elseif name == "Warning!" then
sound.SoundId = "rbxassetid://142916958"
else
sound.SoundId = "rbxassetid://1555493683"
end
wait(0.1)
sound:Play()
wait(1)
sound:Destroy()
end)
if time then
timer.Visible = true
spawn(function()
repeat
timer.Text = time
--timer.Size=UDim2.new(0,timer.TextBounds.X,0,10)
wait(1)
time = time-1
until time<=0 or not frame or not frame.Parent
if frame and frame.Parent then
if ignorefunc then
returner = ignorefunc()
end
frame:Destroy()
moveGuis(holder,0)
end
end)
end
repeat wait() until returner ~= nil or not frame or not frame.Parent
return returner
end
|
--//Transmission//-- |
AmountOfGears = 6 --{Max of 8 gears}
TransmissionType = "Automatic" --{HPattern, Automatic, DualClutch, CVT}
Drivetrain = "AWD" --{RWD, FWD, AWD}
TorqueSplit = 30 --{Split to the rear wheels}
DifferentialF = 0 --{0 = Open, 1 = locked}
DifferentialR = 0.6 --{0 = Open, 1 = locked}
Gear1 = 4.60
Gear2 = 2.72
Gear3 = 1.86
Gear4 = 1.46
Gear5 = 1.23
Gear6 = 1.00
Gear7 = 0.82
Gear8 = 0.69
FinalDrive = 2.937
EngineIdle = 600
EngineRedline = 6800
|
--For Omega Rainbow Katana thumbnail to display a lot of particles. |
for i, v in pairs(Handle:GetChildren()) do
if v:IsA("ParticleEmitter") then
v.Rate = 20
end
end
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
function Blow(Hit)
if not Hit or not Hit.Parent or not CheckIfAlive() or not ToolEquipped then
return
end
local RightArm = Character:FindFirstChild("Right Arm") or Character:FindFirstChild("RightHand")
if not RightArm then
return
end
local RightGrip = RightArm:FindFirstChild("RightGrip")
if not RightGrip or (RightGrip.Part0 ~= Handle and RightGrip.Part1 ~= Handle) then
return
end
local character = Hit.Parent
if character == Character then
return
end
local humanoid = character:FindFirstChildOfClass("Humanoid")
if not humanoid or humanoid.Health == 0 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)
humanoid:TakeDamage(Damage)
end
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
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
--[[
if CheckIfAlive() then
local Force = Instance.new("BodyVelocity")
Force.velocity = Vector3.new(0, 10, 0)
Force.maxForce = Vector3.new(0, 4000, 0)
Debris:AddItem(Force, 0.4)
Force.Parent = Torso
end
]]
task.wait(0.2)
Tool.Grip = Grips.Out
task.wait(0.6)
Tool.Grip = Grips.Up
Damage = DamageValues.SlashDamage
end
Tool.Enabled = true
LastAttack = 0
function Activated()
if not Tool.Enabled or not ToolEquipped or not CheckIfAlive() then
return
end
Tool.Enabled = false
local Tick = task.wait()
if (Tick - LastAttack < 0.2) then
Lunge()
else
Attack()
end
LastAttack = Tick
--task.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()
end
function Unequipped()
Tool.Grip = Grips.Up
ToolEquipped = false
end
Tool.Activated:Connect(Activated)
Tool.Equipped:Connect(Equipped)
Tool.Unequipped:Connect(Unequipped)
Connection = Handle.Touched:Connect(Blow)
|
--[=[
@param object any -- Object to remove
Removes the object from the Trove and cleans it up.
```lua
local part = Instance.new("Part")
trove:Add(part)
trove:Remove(part)
```
]=] |
function Trove:Remove(object: any): boolean
return self:_findAndRemoveFromObjects(object, true)
end
|
--[[
local message = " "
game:GetService("DataStoreService"):GetDataStore("GlobalMessage"):SetAsync( "Message", message)
--]] |
game:GetService("DataStoreService"):GetDataStore("GlobalMessage"):OnUpdate("Message",function(str)
if str ~= nil and type(str) == "string" and str ~= "" and str ~= " " then
game.ReplicatedStorage.RemoteFunctions.NotificationForClient:FireAllClients(str,true)
end
end)
|
-- main deposit function |
local function OpenShop(player)
local playerGui = player:FindFirstChild('PlayerGui')
if playerGui then
local shopGui = playerGui:FindFirstChild('ShopGui')
if shopGui then
local openValue = shopGui:FindFirstChild('Opened')
if openValue then
openValue.Value = true
end
end
end
end
|
--!strict |
local Polyfills = script.Parent.Parent
local Number = require(Polyfills.Number)
|
--Made by Luckymaxer |
Character = script.Parent
Humanoid = Character:FindFirstChild("Humanoid")
Creator = script:FindFirstChild("Creator")
Damage = script:FindFirstChild("Damage")
Duration = script:FindFirstChild("Duration")
Particles = script:FindFirstChild("Particles")
Players = game:GetService("Players")
Debris = game:GetService("Debris")
RbxUtility = LoadLibrary("RbxUtility")
Create = RbxUtility.Create
Player = Players:GetPlayerFromCharacter(Character)
ParticlesUsed = {}
function DestroyScript()
Debris:AddItem(script, 0.5)
script:Destroy()
end
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 = Create("ObjectValue"){
Name = "creator",
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
if not Humanoid or Humanoid.Health == 0 or not Creator or not Creator.Value or not Creator.Value.Parent or not Creator.Value:IsA("Player") or not Damage or not Duration then
DestroyScript()
return
end
if Particles then
for i, v in pairs(Character:GetChildren()) do
if v:IsA("BasePart") then
local Particle = Particles:Clone()
Particle.Enabled = true
table.insert(ParticlesUsed, Particle)
Particle.Parent = v
end
end
end
DamageRate = (Damage.Value / Duration.Value)
DamageValue = (Damage.Value / DamageRate)
DelayRate = (Duration.Value / Damage.Value)
for i = 1, math.ceil(DamageRate) do
if (Creator.Value and Creator.Value:IsA("Player") and Player and IsTeamMate(Creator.Value, Player)) or Humanoid.Health <= 0 then
else
UntagHumanoid(Humanoid)
TagHumanoid(Humanoid, Creator.Value)
Humanoid:TakeDamage(DamageValue)
end
wait(DelayRate)
end
Delay((Duration.Value - 2), (function()
for i, v in pairs(ParticlesUsed) do
if v and v.Parent then
v.Enabled = false
end
end
end))
wait(Duration.Value)
DestroyScript()
|
-------------------------------------------------------------------------- |
function Explode() --This function makes the plane explode
if (not Crashed.Value) then
Crashed.Value = true
Plane:BreakJoints()
local Explosion = Instance.new("Explosion")
Explosion.Parent = game.Workspace
Explosion.Position = Engine.Position
Explosion.BlastRadius = Plane:GetModelSize().magnitude / 2 --This makes the BlastRadius the size of the plane
Explosion.BlastPressure = 2e5
if Engine:findFirstChild("Thrust") then Engine.Thrust:Destroy() end
if Engine:findFirstChild("Direction") then Engine.Direction:Destroy() end
delay(5,function() Plane:Destroy() end) --This removes the plane after 5 seconds
end
end
function GetPlaneParts(Model) --This function gets all the parts on the plane
for _,v in pairs(Model:GetChildren()) do
if (v:IsA("BasePart")) then
table.insert(Parts,v) --This inserts all the parts into the "Parts" table
end
GetPlaneParts(v)
end
end
function onAutoCrash() --This function is activated when the AutoCrash value becomes true
if AutoCrash.Value then
Explode()
end
end
function DetectExplosions(Object) --This is a function that I created which detects explosions in the workspace
if Object.ClassName == "Explosion" then --If the object detected was an explosion...
if Object.BlastPressure > 0 then
local Dist = (Object.Position - Engine.Position).magnitude
if Dist <= (Object.BlastRadius + 2) then
if (not Crashed.Value) then
Explode()
end
end
end
end
end
function IsObstacle(Obj) --This function determines whether Obj is an obstacle that can be used to destroy the plane
if (not Obj:IsDescendantOf(Plane)) and Obj.CanCollide then
local PlaneTag = Obj:FindFirstChild("PlaneTag")
if (PlaneTag and PlaneTag.Value ~= Plane) or (not PlaneTag) then
return true
end
end
return false
end
function IsDescendantOfPlayer(Obj)
for _,v in pairs(game.Players:GetPlayers()) do
if v and v.Character then
if Obj:IsDescendantOf(v.Character) then
return v
end
end
end
return nil
end
GetPlaneParts(Plane) --This activates the "GetPlaneParts" function
for _,v in pairs(Parts) do --This gets all the parts in the "Parts" table
v.Touched:connect(function(Object) --This is activated if any of the bricks are touched
if (not Ejected.Value) then
if CanCrash.Value and (not Crashed.Value) then
if IsObstacle(Object) then
local Player = game.Players:GetPlayerFromCharacter(script.Parent.Parent)
if Player then
local HitPlayer = IsDescendantOfPlayer(Object)
if HitPlayer == Player then return end
end
if (v.Velocity.magnitude >= Force.Value) then
Explode()
end
end
end
elseif Ejected.Value then
if (not Crashed.Value) then
if IsObstacle(Object) then
if Object.Parent.Name ~= "EjectorSeat" then
if (not IsDescendantOfPlayer(Object)) then
Explode()
end
end
end
end
end
end)
end
game.Workspace.DescendantAdded:connect(DetectExplosions) --The detect explosions is a DescendantAdded function
AutoCrash.Changed:connect(onAutoCrash) --Pretty self explanatory. When the AutoCrash value is changed, the "onAutoCrash" function is activated
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]] |
local FE = workspace.FilteringEnabled
local car = script.Parent.Car.Value
local handler = car:WaitForChild("AC6_FE_Sounds")
local _Tune = require(car["A-Chassis Tune"])
local on = 0
local throt=0
local redline=0
script:WaitForChild("Rev")
for i,v in pairs(car.DriveSeat:GetChildren()) do
for _,a in pairs(script:GetChildren()) do
if v.Name==a.Name then v:Stop() wait() v:Destroy() end
end
end
handler:FireServer("newSound","Rev",car.DriveSeat,script.Rev.SoundId,0,script.Rev.Volume,true)
handler:FireServer("playSound","Rev")
car.DriveSeat:WaitForChild("Rev")
while wait() do
local _RPM = script.Parent.Values.RPM.Value
if script.Parent.Values.Throttle.Value <= _Tune.IdleThrottle/100 then
throt = math.max(.3,throt-.2)
else
throt = math.min(1,throt+.1)
end
if script.Parent.Values.RPM.Value > _Tune.Redline-_Tune.RevBounce/4 and script.Parent.Values.Throttle.Value > _Tune.IdleThrottle/100 then
redline=.5
else
redline=1
end
if not car.DriveSeat.IsOn.Value then on=math.max(on-.015,0) else on=1 end
local Pitch = math.max((((script.Rev.SetPitch.Value + script.Rev.SetRev.Value*_RPM/_Tune.Redline))*on^2),script.Rev.SetPitch.Value)
if FE then
handler:FireServer("updateSound","Rev",script.Rev.SoundId,Pitch,script.Rev.Volume)
else
car.DriveSeat.Rev.Pitch = Pitch
end
end
|
------------------------------------------------------------ |
local TwinService = game:GetService("TweenService")
local AnimationHighLight = TweenInfo.new(3, Enum.EasingStyle.Sine ,Enum.EasingDirection.InOut)
local Info1 = {Position = Vector3.new(pos1,Positionn,pos3)}
local Info2 = {Position = Vector3.new(pos1,Positionn2,pos3)}
local AnimkaUp = TwinService:Create(Danger, AnimationHighLight, Info1 )
local AnimkaDown = TwinService:Create(Danger, AnimationHighLight, Info2 )
while true do
AnimkaUp:Play()
wait(2)
AnimkaDown:Play()
wait(2)
end
|
--[[
By
Precious
Beam
--]] |
game.Players.PlayerRemoving:connect(function(player)
local datastore = game:GetService("DataStoreService"):GetDataStore(player.Name.."Stats")
local statstorage = player:FindFirstChild("Data"):GetChildren()
for i = 1, #statstorage do
datastore:SetAsync(statstorage[i].Name, statstorage[i].Value)
print("saved data number "..i)
end
print("Stats successfully saved")
end)
|
--[[
This script serves as a "loader" module for the gun statistics.
They're separated into a module each for readability.
]] |
local GunStats = {}
for _, Module in pairs(script:GetChildren()) do
GunStats[Module.Name] = require(Module)
end
return GunStats
|
--[[ << MODIFY COMMANDS >>
This allows you to change the permission type required to use a command
Format: ["CommandName"] = "PermissionName" ; ]] |
ModifiedCommands={
["fly"] = "HeadAdmin" ; -- This changes the command so that HeadAdmins (or above) can use it
} ;Version = 1.3;--[[Don't edit this, otherwise the commands may break]]}
|
--// Setting things up |
log("Setting things up")
for ind,loc in pairs({
_G = _G;
game = game;
spawn = spawn;
script = script;
getfenv = getfenv;
setfenv = setfenv;
workspace = workspace;
getmetatable = getmetatable;
setmetatable = setmetatable;
loadstring = loadstring;
coroutine = coroutine;
rawequal = rawequal;
typeof = typeof;
print = print;
math = math;
warn = warn;
error = error;
assert = assert;
pcall = pcall;
xpcall = xpcall;
select = select;
rawset = rawset;
rawget = rawget;
ipairs = ipairs;
pairs = pairs;
next = next;
Rect = Rect;
Axes = Axes;
os = os;
time = time;
Faces = Faces;
delay = delay;
unpack = unpack;
string = string;
Color3 = Color3;
newproxy = newproxy;
tostring = tostring;
tonumber = tonumber;
Instance = Instance;
TweenInfo = TweenInfo;
BrickColor = BrickColor;
NumberRange = NumberRange;
ColorSequence = ColorSequence;
NumberSequence = NumberSequence;
ColorSequenceKeypoint = ColorSequenceKeypoint;
NumberSequenceKeypoint = NumberSequenceKeypoint;
PhysicalProperties = PhysicalProperties;
Region3int16 = Region3int16;
Vector3int16 = Vector3int16;
require = require;
table = table;
type = type;
wait = wait;
Enum = Enum;
UDim = UDim;
UDim2 = UDim2;
Vector2 = Vector2;
Vector3 = Vector3;
Region3 = Region3;
CFrame = CFrame;
Ray = Ray;
task = task;
tick = tick;
service = service;
}) do locals[ind] = loc end
|
--!strict |
return function(value: any): boolean
if typeof(value) ~= "table" then
return false
end
if next(value) == nil then
-- an empty table is an empty array
return true
end
local length = #value
if length == 0 then
return false
end
local count = 0
local sum = 0
for key in pairs(value) do
if typeof(key) ~= "number" then
return false
end
if key % 1 ~= 0 or key < 1 then
return false
end
count += 1
sum += key
end
return sum == (count * (count + 1) / 2)
end
|
-- Instances |
local blocks = serverStorage.Blocks
local land = workspace.Land
|
-- Based on https://developmentarc.gitbooks.io/react-indepth/content/life_cycle/update/using_should_component_update.html |
function TableUtils.shallowEqual(left, right)
if left == right then
return true
end
if type(left) ~= "table" or type(right) ~= "table" then
return false
end
local leftKeys = TableUtils.keys(left)
local rightKeys = TableUtils.keys(right)
if #leftKeys ~= #rightKeys then
return false
end
return TableUtils.all(
left,
function(value, key)
return value == right[key]
end
)
end
function TableUtils.serialize(input, serializer)
serializer = serializer or function(value)
return tostring(value)
end
assert(type(input) == "table")
assert(type(serializer) == "function")
return "{" ..
table.concat(
TableUtils.map(
input,
function(element, i)
return tostring(i) .. "=" .. serializer(element)
end
),
","
) ..
"}"
end
function TableUtils.append(...)
local result = {}
for i = 1, select("#", ...) do
local x = select(i, ...)
if type(x) == "table" then
for _, y in ipairs(x) do
table.insert(result, y)
end
else
table.insert(result, x)
end
end
return result
end
return TableUtils
|
--------END SIDE SQUARES-------- |
game.Workspace.audiencebackleft1.Part1.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackleft1.Part2.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackleft1.Part3.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackleft1.Part4.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackleft1.Part5.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackleft1.Part6.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackleft1.Part7.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackleft1.Part8.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackleft1.Part9.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackright1.Part1.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackright1.Part2.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackright1.Part3.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackright1.Part4.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackright1.Part5.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackright1.Part6.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackright1.Part7.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackright1.Part8.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackright1.Part9.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.post1.Light.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.post2.Light.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
if game.Workspace.DoorFlashing.Value == false then
game.Workspace.DoorColored.Value = true |
--!nonstrict |
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local SelfieMode = ReplicatedStorage:WaitForChild("SelfieMode")
local Emotes = require(SelfieMode.Emotes)
for _, emote in ipairs(Emotes.Emotes) do
Emotes.loadEmoteAsync(emote.assetId)
end
|
--[=[
Constructs a new Touch input capturer.
]=] |
function Touch.new()
local self = setmetatable({}, Touch)
self._trove = Trove.new()
self.TouchTap = self._trove:Construct(Signal.Wrap, UserInputService.TouchTap)
self.TouchTapInWorld = self._trove:Construct(Signal.Wrap, UserInputService.TouchTapInWorld)
self.TouchMoved = self._trove:Construct(Signal.Wrap, UserInputService.TouchMoved)
self.TouchLongPress = self._trove:Construct(Signal.Wrap, UserInputService.TouchLongPress)
self.TouchPan = self._trove:Construct(Signal.Wrap, UserInputService.TouchPan)
self.TouchPinch = self._trove:Construct(Signal.Wrap, UserInputService.TouchPinch)
self.TouchRotate = self._trove:Construct(Signal.Wrap, UserInputService.TouchRotate)
self.TouchSwipe = self._trove:Construct(Signal.Wrap, UserInputService.TouchSwipe)
self.TouchStarted = self._trove:Construct(Signal.Wrap, UserInputService.TouchStarted)
self.TouchEnded = self._trove:Construct(Signal.Wrap, UserInputService.TouchEnded)
return self
end
|
-- enabled = false |
driveSeat.AirbagFilter:FireServer('restore')
script.Parent.Parent.Visible = false
end)
|
--local spark = Instance.new("Sparkles")
--spark.Color = Color3.new(0,1,0) |
function fire(v)
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local missile = script.Parent.Handle:Clone()
--spark:Clone().Parent = missile
local spawnPos = vCharacter.PrimaryPart.Position
local PewPew = Tool.Handle:FindFirstChild("PewPew")
if (PewPew == nil) then
PewPew = Instance.new("Sound")
PewPew.Name = "PewPew"
PewPew.SoundId = "http://www.roblox.com/asset/?id=11944350"
PewPew.Parent = Tool.Handle
PewPew.Volume = 1
end
spawnPos = spawnPos + (v * 3)
missile.Position = spawnPos
missile.Size = Vector3.new(1,1,1)
missile.Velocity = v * 60
missile.BrickColor = BrickColor.new(1020)
missile.Shape = 0
missile.BottomSurface = 0
missile.TopSurface = 0
missile.Name = "Spark"
missile.Reflectance = .5
local force = Instance.new("BodyForce")
force.force = Vector3.new(0,98,0)
force.Parent = missile
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = vPlayer
creator_tag.Name = "creator"
creator_tag.Parent = missile
local new_script = script.Parent.LaserBlast:clone()
new_script.Disabled = false
new_script.Parent = missile
missile.Parent = game.Workspace
PewPew:Play()
end
function gunUp()
--Tool.GripForward = Vector3.new(0,.981,-.196)
--Tool.GripRight = Vector3.new(1,0,0)
--Tool.GripUp = Vector3.new(0,.196,.981)
end
function gunOut()
--Tool.GripForward = Vector3.new(0,1,0)
--Tool.GripRight = Vector3.new(1,0,0)
--Tool.GripUp = Vector3.new(0,0,1)
end
function isTurbo(character)
return character:FindFirstChild("BoltHelm") ~= nil
end
function onActivated()
if not enabled then
return
end
enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
local targetPos = humanoid.TargetPoint
local lookAt = (targetPos - character.Head.Position).unit
local reload = .1
--if (isTurbo(character)) then
-- reload = .25
-- print("turbo")
--end
gunUp()
fire(lookAt)
wait(reload)
gunOut()
wait(reload)
enabled = true
end
function onEquipped()
Tool.Handle.EquipSound:play()
end
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
|
--[[Engine]] |
--Torque Curve
Tune.Horsepower = 129 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 6300 -- Use sliders to manipulate values
Tune.Redline = 6500 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
--Incline Compensation
Tune.InclineComp = 1.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 1 -- Clutch engagement threshold (higher = faster response)
|
--- Point type |
type Point = {
Group: string?,
CastMode: number,
LastPosition: Vector3?,
WorldSpace: Vector3?,
Instances: {[number]: Instance | Vector3}
}
|
-- Customized explosive effect that doesn't affect teammates and only breaks joints on dead parts |
local function OnExplosionHit(hitPart, hitDistance, blastCenter)
if hitPart and hitDistance then
local character, humanoid = FindCharacterAncestor(hitPart.Parent)
if character then
local myPlayer = CreatorTag.Value
if myPlayer and not myPlayer.Neutral then -- Ignore friendlies caught in the blast
local player = PlayersService:GetPlayerFromCharacter(character)
if player and player ~= myPlayer and player.TeamColor == Rocket.BrickColor then
return
end
end
end
if humanoid and humanoid.Health > 0 then -- Humanoids are tagged and damaged
if hitPart.Name == 'Torso' then
ApplyTags(humanoid)
humanoid:TakeDamage(BLAST_DAMAGE)
end
else -- Loose parts and dead parts are blasted
if hitPart.Name ~= 'Handle' then
hitPart:BreakJoints()
local blastForce = Instance.new('BodyForce', hitPart) --NOTE: We will multiply by mass so bigger parts get blasted more
blastForce.force = (hitPart.Position - blastCenter).unit * BLAST_FORCE * hitPart:GetMass()
DebrisService:AddItem(blastForce, 0.1)
end
end
end
end
local function OnTouched(otherPart)
if Rocket and otherPart then
-- Fly through anything in the ignore list
if IGNORE_LIST[string.lower(otherPart.Name)] then
return
end
local myPlayer = CreatorTag.Value
if myPlayer then
-- Fly through the creator
if myPlayer.Character and myPlayer.Character:IsAncestorOf(otherPart) then
return
end
-- Fly through friendlies
if not myPlayer.Neutral then
local character = FindCharacterAncestor(otherPart.Parent)
local player = PlayersService:GetPlayerFromCharacter(character)
if player and player ~= myPlayer and player.TeamColor == Rocket.BrickColor then
return
end
end
end
-- Fly through terrain water
if otherPart == Workspace.Terrain then
--NOTE: If the rocket is large, then the simplifications made here will cause it to fly through terrain in some cases
local frontOfRocket = Rocket.Position + (Rocket.CFrame.lookVector * (Rocket.Size.Z / 2))
local cellLocation = Workspace.Terrain:WorldToCellPreferSolid(frontOfRocket)
local cellMaterial = Workspace.Terrain:GetCell(cellLocation.X, cellLocation.Y, cellLocation.Z)
if cellMaterial == Enum.CellMaterial.Water or cellMaterial == Enum.CellMaterial.Empty then
return
end
end
-- Create the explosion
local explosion = Instance.new('Explosion')
explosion.BlastPressure = 0 -- Completely safe explosion
explosion.BlastRadius = BLAST_RADIUS
explosion.ExplosionType = Enum.ExplosionType.NoCraters
explosion.Position = Rocket.Position
explosion.Parent = Workspace
-- Connect custom logic for the explosion
explosion.Hit:connect(function(hitPart, hitDistance) OnExplosionHit(hitPart, hitDistance, explosion.Position) end)
-- Move this script and the creator tag (so our custom logic can execute), then destroy the rocket
script.Parent = explosion
CreatorTag.Parent = script
Rocket:Destroy()
end
end
|
-------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------
-- STATE CHANGE HANDLERS |
function onRunning(speed)
if speed > 0.75 then
local scale = 22.0
playAnimation("walk", 0.2, Humanoid)
setAnimationSpeed(speed / scale)
pose = "Running"
else
if emoteNames[currentAnim] == nil and not currentlyPlayingEmote then
playAnimation("idle", 0.2, Humanoid)
pose = "Standing"
end
end
end
function onDied()
pose = "Dead"
end
function onJumping()
playAnimation("jump", 0.1, Humanoid)
jumpAnimTime = jumpAnimDuration
pose = "Jumping"
end
function onClimbing(speed)
local scale = 5.0
playAnimation("climb", 0.1, Humanoid)
setAnimationSpeed(speed / scale)
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
|
-- Touch
-- Stephen Leitnick
-- March 14, 2021 |
local Trove = require(script.Parent.Parent.Trove)
local Signal = require(script.Parent.Parent.Signal)
local UserInputService = game:GetService("UserInputService")
|
-- RunService.Heartbeat:Wait() -- in case no player is near the npc
--end | |
-- get the current time in the format "HH:MM AM/PM" |
local currentTimeString = os.date("%I:%M", currentTime)
|
--------------------) Settings |
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 3 -- cooldown for use of the tool again
BoneModelName = "Surprise present" -- name the zone model
HumanoidName = "Humanoid"-- the name of player or mob u want to damage |
--> Dependencies |
local FormatNumber = require(ReplicatedStorage.Modules.FormatNumber)
|
--- Gets the text in the command bar text box |
function Window:GetEntryText()
return string.gsub(Entry.TextBox.Text, '\t', '')
end
|
-- Gets the player ready by spawning them, giving them a tool, and setting up listener events |
local function readyPlayer(player, whichSpawn)
-- Reminder: LoadCharacter recreates the player, so needs to happen at the start or else tools/listeners will be lost.
player.RespawnLocation = whichSpawn
player:LoadCharacter()
-- Adding in a wait to ensure player character has loaded
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
setPlayerCollisionGroup(player)
-- Checks if players die
humanoid.Died:Connect(function()
removeActivePlayer(player)
respawnPlayerInLobby(player)
end)
end
local function removePlayerWeapon(whichPlayer)
local character = whichPlayer.Character
-- If the player has it currently on their character
if character:FindFirstChild("Weapon") then
character.Weapon:Destroy()
end
-- If theplayer has the weapon in their backpack
if whichPlayer.Backpack:FindFirstChild("Weapon") then
whichPlayer.Backpack.Weapon:Destroy()
end
end
|
-- MAIN SCRIPT -- |
MessagingService:SubscribeAsync('Message', function(Data)
local MessageData = HttpService:JSONDecode(Data.Data)
local MessageValue = ReplicatedStorage:FindFirstChild(MessageData.Type..'Text')
if MessageValue then
local WaitTime = tonumber(#MessageData.Message * 0.5)
MessageValue.Value = MessageData.Message
wait(WaitTime)
MessageValue.Value = ''
end
end)
|
--Made by Superluck, Uploaded by FederalSignal_QCB.
--Made by Superluck, Uploaded by FederalSignal_QCB.
--Made by Superluck, Uploaded by FederalSignal_QCB. |
wait(1)
Loud = 500
while true do
script.Parent.Parent.Parent.Main.SoundBlock.Value.Sound2.PlaybackSpeed = script.Parent.PlaybackSpeed
script.Parent.Parent.Parent.Main.SoundBlock.Value.Sound2.Volume = (script.Parent.Volume*2)*(Loud/50)
script.Parent.Parent.Parent.Main.SoundBlock.Value.Sound2.RollOffMinDistance = script.Parent.RollOffMinDistance*Loud
script.Parent.Parent.Parent.Main.SoundBlock.Value.Sound2.SoundId = script.Parent.SoundId
script.Parent.Parent.Parent.Main.SoundBlock.Value.Sound2.Playing = script.Parent.Playing
if script.Parent.Parent.Parent.Main.Config.SoftStart.Value == true then
if script.Parent.Parent.Parent.Main.Amps.Value == true and Loud < 500 then
Loud += 50
elseif script.Parent.Parent.Parent.Main.Amps.Value == false then
Loud = 0
end
else
Loud = 506
end
wait()
end
|
--[=[
Fails the subscription, preventing anything else from emitting.
]=] |
function Subscription:Fail()
if self._state ~= stateTypes.PENDING then
return
end
self._state = stateTypes.FAILED
if self._failCallback then
self._failCallback()
end
self:_doCleanup()
end
|
-- Returns a rounded number |
function moduleApiTable:Round(n)
return n % 1 >= 0.5 and math.ceil(n) or math.floor(n)
end
return moduleApiTable
|
-- Add extra line breaks at beginning and end of multiline snapshot
-- to make the content easier to read. |
local function addExtraLineBreaks(string_: string): string
if string_:match("\n") then
return "\n" .. string_ .. "\n"
else
return string_
end
end
|
--// All global vars will be wiped/replaced except script |
return function(data, env)
if env then
setfenv(1, env)
end
local playergui = service.PlayerGui
local localplayer = service.Players.LocalPlayer
local gui = service.New("ScreenGui")
local toggle = service.New("ImageButton", gui)
local gTable = client.UI.Register(gui)
if client.UI.Get("HelpButton", gui, true) then
gui:Destroy()
gTable:Destroy()
return nil
end
gTable.Name = "HelpButton"
gTable.CanKeepAlive = false
toggle.Name = "Toggle"
toggle.BackgroundTransparency = 1
toggle.Position = UDim2.new(1, -45, 1, -45)
toggle.Size = UDim2.new(0, 40, 0, 40)
toggle.Image = client.HelpButtonImage
toggle.ImageTransparency = 0.5
--if client.UI.Get("Chat") then
-- toggle.Position = UDim2.new(1, -(45+40),1, -45)
--end
toggle.MouseButton1Down:Connect(function()
local found = client.UI.Get("UserPanel",nil,true)
if found then
found.Object:Destroy()
else
client.UI.Make("UserPanel",{})
end
end)
gTable:Ready()
end
|
-- Click Sound |
script.Parent.MouseButton1Click:Connect(function()
script.ClickSound:Play()
end)
|
--[[
Returns the current value of this ForValues object.
The object will be registered as a dependency unless `asDependency` is false.
]] |
function class:get(asDependency: boolean?): any
if asDependency ~= false then
Dependencies.useDependency(self)
end
return self._outputTable
end
|
--[=[
@class Gamepad
@client
The Gamepad class is part of the Input package.
```lua
local Gamepad = require(packages.Input).Gamepad
local gamepad = Gamepad.new()
```
]=] |
local Gamepad = {}
Gamepad.__index = Gamepad
|
-- Functions |
play.OnServerEvent:Connect(function(player, character)
character.Radio.Sound:Play()
end)
pause.OnServerEvent:Connect(function(player, character)
character.Radio.Sound:Pause()
end)
resume.OnServerEvent:Connect(function(player, character)
character.Radio.Sound:Resume()
end)
stop.OnServerEvent:Connect(function(player, character)
character.Radio.Sound:Stop()
end)
changeID.OnServerEvent:Connect(function(player, character, value)
wait(.5)
character:WaitForChild("Radio").Sound:Stop()
character:WaitForChild("Radio").Sound.SoundId = ('rbxassetid://'..value)
end)
|
-- UI |
local textSize = 30
local textPadding = 5
local captionPadding = 15
|
-- made by Weeve. for all of you lamo scripters out there, can you at least leave my name here?
-- don't edit anything here |
seat = script.Parent
function onChildAdded(part)
if (part.className == "Weld") then
while true do
welde = seat:FindFirstChild("SeatWeld")
if (welde ~= nil) then
sitted = welde.Part1.Parent
end
if (sitted.Name ~= script.Parent.Owner.Value) then
if (script.Parent.Owner.Value == "NoOne") then
script.Parent.Owner.Value = sitted.Name
print ("sitted steal")
else
print ("stolen!!")
shipstealer = game.Workspace:FindFirstChild(sitted.Name)
if (shipstealer ~= nil) then
shipstealer.Humanoid.Jump=true
end
end
end
wait(0.2)
if (welde == nil) then
print("BreakLoop")
script.Parent.Owner.Value = "NoOne"
break end
end
end
end
|
--Controls |
local _CTRL = _Tune.Controls
local Controls = Instance.new("Folder",script.Parent)
Controls.Name = "Controls"
for i,v in pairs(_CTRL) do
local a=Instance.new("StringValue",Controls)
a.Name=i
a.Value=v.Name
a.Changed:connect(function()
if i=="MouseThrottle" or i=="MouseBrake" then
_CTRL[i]=Enum.UserInputType[a.Value]
else
_CTRL[i]=Enum.KeyCode[a.Value]
end
end)
end
local _PPH = _Tune.Peripherals
for i,v in pairs(_PPH) do
local a = Instance.new("IntValue",Controls)
a.Name = i
a.Value = v
a.Changed:connect(function()
a.Value=math.min(100,math.max(0,a.Value))
_PPH[i] = a.Value
end)
end
function DealWithInput(input,IsRobloxFunction)
if (UserInputService:GetFocusedTextBox()==nil) and not _InControls then --No texting while driving
if _IsOn and (input.KeyCode ==_CTRL["ContlrShiftDown"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftDown"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftDown"])) and _TMode=="Manual" and (not _ClutchOn) and input.UserInputState == Enum.UserInputState.Begin then
if _CGear == 0 and (_TMode=="Auto" or not _ClPressing) then _ClutchOn = true end
_CGear = math.max(_CGear-1,-1)
elseif _IsOn and (input.KeyCode ==_CTRL["ContlrShiftUp"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftUp"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftUp"])) and _TMode=="Manual" and (not _ClutchOn) and input.UserInputState == Enum.UserInputState.Begin then
if _CGear == 0 and (_TMode=="Auto" or not _ClPressing) then _ClutchOn = true end
_CGear = math.min(_CGear+1,#_Tune.Ratios-2)
elseif _IsOn and (input.KeyCode ==_CTRL["ContlrClutch"] or (_MSteer and input.KeyCode==_CTRL["MouseClutch"]) or ((not _MSteer) and input.KeyCode==_CTRL["Clutch"])) and _TMode=="Manual" then
if input.UserInputState == Enum.UserInputState.Begin then
_ClutchOn = false
_ClPressing = true
elseif input.UserInputState == Enum.UserInputState.End then
_ClutchOn = true
_ClPressing = false
end
elseif _IsOn and input.KeyCode ==_CTRL["ContlrPBrake"] or (_MSteer and input.KeyCode==_CTRL["MousePBrake"]) or ((not _MSteer) and input.KeyCode==_CTRL["PBrake"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_PBrake = not _PBrake
elseif input.UserInputState == Enum.UserInputState.End then
if car.DriveSeat.Velocity.Magnitude>5 then
_PBrake = false
end
end
elseif (input.KeyCode == _CTRL["ContlrToggleTMode"] or input.KeyCode==_CTRL["ToggleTransMode"]) and input.UserInputState == Enum.UserInputState.Begin then
local n=1
for i,v in pairs(_Tune.TransModes) do
if v==_TMode then n=i break end
end
n=n+1
if n>#_Tune.TransModes then n=1 end
_TMode = _Tune.TransModes[n]
elseif _IsOn and ((not _MSteer) and (input.KeyCode==_CTRL["Throttle"] or input.KeyCode == _CTRL["Throttle2"])) or (input.UserInputType == _CTRL["MouseThrottle"] and _MSteer) then
if input.UserInputState == Enum.UserInputState.Begin then
_GThrot = 1
else
_GThrot = _Tune.IdleThrottle
end
elseif ((not _MSteer) and (input.KeyCode==_CTRL["Brake"] or input.KeyCode == _CTRL["Brake2"])) or (input.UserInputType == _CTRL["MouseBrake"] and _MSteer) then
if input.UserInputState == Enum.UserInputState.Begin then
_GBrake = 1
else
_GBrake = 0
end
elseif (not _MSteer) and (input.KeyCode==_CTRL["SteerLeft"] or input.KeyCode == _CTRL["SteerLeft2"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_GSteerT = -1
_SteerL = true
else
if _SteerR then
_GSteerT = 1
else
_GSteerT = 0
end
_SteerL = false
end
elseif (not _MSteer) and (input.KeyCode==_CTRL["SteerRight"] or input.KeyCode == _CTRL["SteerRight2"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_GSteerT = 1
_SteerR = true
else
if _SteerL then
_GSteerT = -1
else
_GSteerT = 0
end
_SteerR = false
end
elseif input.KeyCode ==_CTRL["ToggleMouseDrive"] then
if input.UserInputState == Enum.UserInputState.End then
_MSteer = not _MSteer
_GThrot = _Tune.IdleThrottle
_GBrake = 0
_GSteerT = 0
_ClutchOn = true
end
elseif _IsOn and input.KeyCode == _CTRL["ToggleTCS"] or input.KeyCode == _CTRL["ContlrToggleTCS"] then
if input.UserInputState == Enum.UserInputState.End then
_TCS = not _TCS
end
end
if input.UserInputType.Name:find("Gamepad") then
if input.KeyCode == _CTRL["ContlrSteer"] then
if input.Position.X>= 0 then
local cDZone = math.min(.99,_Tune.Peripherals.ControlRDZone/100)
if math.abs(input.Position.X)>cDZone then
_GSteerT = (input.Position.X-cDZone)/(1-cDZone)
else
_GSteerT = 0
end
else
local cDZone = math.min(.99,_Tune.Peripherals.ControlLDZone/100)
if math.abs(input.Position.X)>cDZone then
_GSteerT = (input.Position.X+cDZone)/(1-cDZone)
else
_GSteerT = 0
end
end
elseif _IsOn and input.KeyCode == _CTRL["ContlrThrottle"] then
_GThrot = math.max(_Tune.IdleThrottle,input.Position.Z)
elseif input.KeyCode == _CTRL["ContlrBrake"] then
_GBrake = input.Position.Z
end
end
else
_GThrot = _Tune.IdleThrottle
_GSteerT = 0
_GBrake = 0
if _CGear~=0 then _ClutchOn = true end
end
end
UserInputService.InputBegan:connect(DealWithInput)
UserInputService.InputChanged:connect(DealWithInput)
UserInputService.InputEnded:connect(DealWithInput)
|
--------------------) Settings |
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 5 -- cooldown for use of the tool again
ZoneModelName = "Homing Bones" -- name the zone model
MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage |
--[[
]] |
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local AvatarEditor = ReplicatedStorage.AvatarEditor
local Maid = require(AvatarEditor.Shared.Util.Maid)
local Signal = require(AvatarEditor.Shared.Util.Signal)
local Theme = require(AvatarEditor.Client.Theme)
local Class = {}
Class.__index = Class
local function fromHex(hex)
local r, g, b = string.match(hex, "^#?(%w%w)(%w%w)(%w%w)$")
return Color3.fromRGB(tonumber(r, 16), tonumber(g, 16), tonumber(b, 16))
end
local function toHex(color)
return string.format("#%02X%02X%02X", color.R * 255, color.G * 255, color.B * 255)
end
local function isWearing(assets, color3)
return toHex(assets) == toHex(color3)
end
function Class.new(frame, colorData, wearingTone)
local self = setmetatable({}, Class)
self.Frame = frame
self.Wearing = wearingTone
self.Children = {}
self.Maid = Maid.new()
self.Listeners = Maid.new()
self.ItemSelected = Signal.new()
self.Maid:GiveTask(Theme.Changed:Connect(function()
self:Render()
end))
self.Maid:GiveTask(Theme:Bind(frame, "ScrollBarImageColor3", "Scrollbar"))
for i, v in ipairs(colorData) do
local button = AvatarEditor.ColorTemplate:Clone()
button.BackgroundColor3 = v
button.Wearing.Visible = isWearing(wearingTone, v)
button.Parent = frame
self.Children[i] = button
self.Maid:GiveTask(Theme:Bind(button.Wearing, "ImageColor3", "Wearing"))
self.Maid:GiveTask(button.Activated:Connect(function(inputObject)
self.ItemSelected:Fire(i)
end))
end
return self
end
function Class:Render()
local maid = self.Listeners
local wearingTone = self.Wearing
maid:DoCleaning()
for i, v in ipairs(self.Children) do
v.Wearing.Visible = isWearing(wearingTone, v.BackgroundColor3)
end
end
function Class:UpdateWearing(wearingTone)
self.Wearing = wearingTone
self:Render()
end
function Class:Destroy()
self.Maid:Destroy()
self.Maid = nil
self.Listeners:Destroy()
self.Listeners = nil
self.Frame = nil
self.Wearing = nil
for i, v in ipairs(self.Children) do
v:Destroy()
end
table.clear(self.Children)
self.ItemSelected:Destroy()
self.ItemSelected = nil
end
return Class
|
--[[
Classes.TextMask
This class creates a text mask object which can be used to limit user input into a text gui element
Constructors:
new(textFrame [instance])
> Creates a text mask object for the given text frame.
Properties:
Frame [instance]
> The text frame that you put as an argument when creating the text mask object.
Methods:
:GetValue() [variant]
> Returns the text frame's value converted to the mask type.
> For instance if you used a vector3 mask then this would return the value inputted as a vector3
:GetMaskType() [string]
> Returns the name of the mask type you are using
:SetMaxLength(len [integer]) [void]
> Sets the maximum number of characters the user can input into the text field
> By default the max length is 230,000 characters
:SetMaskType(name [string]) [void]
> Sets mask type of the mask object. This name should coincide with a child of this module
> By default the mask type is always set to "String"
:Destroy() [void]
> Destroys the mask object and any events, etc used in the purpose of running it.
--]] | |
--Differential Settings |
Tune.FDiffSlipThres = 0 -- 1 - 100% (Max threshold of applying full lock determined by deviation from avg speed)
Tune.FDiffLockThres = 0 -- 0 - 100% (0 - Bias toward slower wheel, 100 - Bias toward faster wheel)
Tune.RDiffSlipThres = 0 -- 1 - 100%
Tune.RDiffLockThres = 0 -- 0 - 100%
Tune.CDiffSlipThres = 0 -- 1 - 100% [AWD Only]
Tune.CDiffLockThres = 0 -- 0 - 100% [AWD Only]
|
-- ProfileStore object: |
local ProfileStore = {
--[[
Mock = {},
_profile_store_name = "", -- [string] -- DataStore name
_profile_store_scope = nil, -- [string] or [nil] -- DataStore scope
_profile_store_lookup = "", -- [string] -- _profile_store_name .. "\0" .. (_profile_store_scope or "")
_profile_template = {}, -- [table]
_global_data_store = global_data_store, -- [GlobalDataStore] -- Object returned by DataStoreService:GetDataStore(_profile_store_name)
_loaded_profiles = {[profile_key] = Profile, ...},
_profile_load_jobs = {[profile_key] = {load_id, loaded_data}, ...},
_mock_loaded_profiles = {[profile_key] = Profile, ...},
_mock_profile_load_jobs = {[profile_key] = {load_id, loaded_data}, ...},
--]]
}
ProfileStore.__index = ProfileStore
function ProfileStore:LoadProfileAsync(profile_key, not_released_handler, _use_mock) --> [Profile / nil] not_released_handler(place_id, game_job_id)
not_released_handler = not_released_handler or "ForceLoad"
if self._profile_template == nil then
error("[ProfileService]: Profile template not set - ProfileStore:LoadProfileAsync() locked for this ProfileStore")
end
if type(profile_key) ~= "string" then
error("[ProfileService]: profile_key must be a string")
elseif string.len(profile_key) == 0 then
error("[ProfileService]: Invalid profile_key")
end
if type(not_released_handler) ~= "function" and not_released_handler ~= "ForceLoad" and not_released_handler ~= "Steal" then
error("[ProfileService]: Invalid not_released_handler")
end
if ProfileService.ServiceLocked == true then
return nil
end
WaitForPendingProfileStore(self)
local is_user_mock = _use_mock == UseMockTag
-- Check if profile with profile_key isn't already loaded in this session:
for _, profile_store in ipairs(ActiveProfileStores) do
if profile_store._profile_store_lookup == self._profile_store_lookup then
local loaded_profiles = is_user_mock == true and profile_store._mock_loaded_profiles or profile_store._loaded_profiles
if loaded_profiles[profile_key] ~= nil then
error("[ProfileService]: Profile " .. IdentifyProfile(self._profile_store_name, self._profile_store_scope, profile_key) .. " is already loaded in this session")
-- Are you using Profile:Release() properly?
end
end
end
ActiveProfileLoadJobs = ActiveProfileLoadJobs + 1
local force_load = not_released_handler == "ForceLoad"
local force_load_steps = 0
local request_force_load = force_load -- First step of ForceLoad
local steal_session = false -- Second step of ForceLoad
local aggressive_steal = not_released_handler == "Steal" -- Developer invoked steal
while ProfileService.ServiceLocked == false do
-- Load profile:
-- SPECIAL CASE - If LoadProfileAsync is called for the same key before another LoadProfileAsync finishes,
-- yoink the DataStore return for the new call. The older call will return nil. This would prevent very rare
-- game breaking errors where a player rejoins the server super fast.
local profile_load_jobs = is_user_mock == true and self._mock_profile_load_jobs or self._profile_load_jobs
local loaded_data, key_info
local load_id = LoadIndex + 1
LoadIndex = load_id
local profile_load_job = profile_load_jobs[profile_key] -- {load_id, {loaded_data, key_info} or nil}
if profile_load_job ~= nil then
profile_load_job[1] = load_id -- Yoink load job
while profile_load_job[2] == nil do -- Wait for job to finish
task.wait()
end
if profile_load_job[1] == load_id then -- Load job hasn't been double-yoinked
loaded_data, key_info = table.unpack(profile_load_job[2])
profile_load_jobs[profile_key] = nil
else
ActiveProfileLoadJobs = ActiveProfileLoadJobs - 1
return nil
end
else
profile_load_job = {load_id, nil}
profile_load_jobs[profile_key] = profile_load_job
profile_load_job[2] = table.pack(StandardProfileUpdateAsyncDataStore(
self,
profile_key,
{
ExistingProfileHandle = function(latest_data)
if ProfileService.ServiceLocked == false then
local active_session = latest_data.MetaData.ActiveSession
local force_load_session = latest_data.MetaData.ForceLoadSession
-- IsThisSession(active_session)
if active_session == nil then
latest_data.MetaData.ActiveSession = {PlaceId, JobId}
latest_data.MetaData.ForceLoadSession = nil
elseif type(active_session) == "table" then
if IsThisSession(active_session) == false then
local last_update = latest_data.MetaData.LastUpdate
if last_update ~= nil then
if os.time() - last_update > SETTINGS.AssumeDeadSessionLock then
latest_data.MetaData.ActiveSession = {PlaceId, JobId}
latest_data.MetaData.ForceLoadSession = nil
return
end
end
if steal_session == true or aggressive_steal == true then
local force_load_uninterrupted = false
if force_load_session ~= nil then
force_load_uninterrupted = IsThisSession(force_load_session)
end
if force_load_uninterrupted == true or aggressive_steal == true then
latest_data.MetaData.ActiveSession = {PlaceId, JobId}
latest_data.MetaData.ForceLoadSession = nil
end
elseif request_force_load == true then
latest_data.MetaData.ForceLoadSession = {PlaceId, JobId}
end
else
latest_data.MetaData.ForceLoadSession = nil
end
end
end
end,
MissingProfileHandle = function(latest_data)
latest_data.Data = DeepCopyTable(self._profile_template)
latest_data.MetaData = {
ProfileCreateTime = os.time(),
SessionLoadCount = 0,
ActiveSession = {PlaceId, JobId},
ForceLoadSession = nil,
MetaTags = {},
}
end,
EditProfile = function(latest_data)
if ProfileService.ServiceLocked == false then
local active_session = latest_data.MetaData.ActiveSession
if active_session ~= nil and IsThisSession(active_session) == true then
latest_data.MetaData.SessionLoadCount = latest_data.MetaData.SessionLoadCount + 1
latest_data.MetaData.LastUpdate = os.time()
end
end
end,
},
is_user_mock
))
if profile_load_job[1] == load_id then -- Load job hasn't been yoinked
loaded_data, key_info = table.unpack(profile_load_job[2])
profile_load_jobs[profile_key] = nil
else
ActiveProfileLoadJobs = ActiveProfileLoadJobs - 1
return nil -- Load job yoinked
end
end
-- Handle load_data:
if loaded_data ~= nil and key_info ~= nil then
local active_session = loaded_data.MetaData.ActiveSession
if type(active_session) == "table" then
if IsThisSession(active_session) == true then
-- Special component in MetaTags:
loaded_data.MetaData.MetaTagsLatest = DeepCopyTable(loaded_data.MetaData.MetaTags)
-- Case #1: Profile is now taken by this session:
-- Create Profile object:
local global_updates_object = {
_updates_latest = loaded_data.GlobalUpdates,
_pending_update_lock = {},
_pending_update_clear = {},
_new_active_update_listeners = Madwork.NewScriptSignal(),
_new_locked_update_listeners = Madwork.NewScriptSignal(),
_profile = nil,
}
setmetatable(global_updates_object, GlobalUpdates)
local profile = {
Data = loaded_data.Data,
MetaData = loaded_data.MetaData,
MetaTagsUpdated = Madwork.NewScriptSignal(),
RobloxMetaData = loaded_data.RobloxMetaData or {},
UserIds = loaded_data.UserIds or {},
KeyInfo = key_info,
KeyInfoUpdated = Madwork.NewScriptSignal(),
GlobalUpdates = global_updates_object,
_profile_store = self,
_profile_key = profile_key,
_release_listeners = Madwork.NewScriptSignal(),
_hop_ready_listeners = Madwork.NewScriptSignal(),
_hop_ready = false,
_load_timestamp = os.clock(),
_is_user_mock = is_user_mock,
}
setmetatable(profile, Profile)
global_updates_object._profile = profile
-- Referencing Profile object in ProfileStore:
if next(self._loaded_profiles) == nil and next(self._mock_loaded_profiles) == nil then -- ProfileStore object was inactive
table.insert(ActiveProfileStores, self)
end
if is_user_mock == true then
self._mock_loaded_profiles[profile_key] = profile
else
self._loaded_profiles[profile_key] = profile
end
-- Adding profile to AutoSaveList;
AddProfileToAutoSave(profile)
-- Special case - finished loading profile, but session is shutting down:
if ProfileService.ServiceLocked == true then
SaveProfileAsync(profile, true) -- Release profile and yield until the DataStore call is finished
profile = nil -- nil will be returned by this call
end
-- Return Profile object:
ActiveProfileLoadJobs = ActiveProfileLoadJobs - 1
return profile
else
-- Case #2: Profile is taken by some other session:
if force_load == true then
local force_load_session = loaded_data.MetaData.ForceLoadSession
local force_load_uninterrupted = false
if force_load_session ~= nil then
force_load_uninterrupted = IsThisSession(force_load_session)
end
if force_load_uninterrupted == true then
if request_force_load == false then
force_load_steps = force_load_steps + 1
if force_load_steps == SETTINGS.ForceLoadMaxSteps then
steal_session = true
end
end
task.wait() -- Overload prevention
else
-- Another session tried to force load this profile:
ActiveProfileLoadJobs = ActiveProfileLoadJobs - 1
return nil
end
request_force_load = false -- Only request a force load once
elseif aggressive_steal == true then
task.wait() -- Overload prevention
else
local handler_result = not_released_handler(active_session[1], active_session[2])
if handler_result == "Repeat" then
task.wait() -- Overload prevention
elseif handler_result == "Cancel" then
ActiveProfileLoadJobs = ActiveProfileLoadJobs - 1
return nil
elseif handler_result == "ForceLoad" then
force_load = true
request_force_load = true
task.wait() -- Overload prevention
elseif handler_result == "Steal" then
aggressive_steal = true
task.wait() -- Overload prevention
else
error(
"[ProfileService]: Invalid return from not_released_handler (\"" .. tostring(handler_result) .. "\")(" .. type(handler_result) .. ");" ..
"\n" .. IdentifyProfile(self._profile_store_name, self._profile_store_scope, profile_key) ..
" Traceback:\n" .. debug.traceback()
)
end
end
end
else
ActiveProfileLoadJobs = ActiveProfileLoadJobs - 1
return nil -- In this scenario it is likely the ProfileService.ServiceLocked flag was raised
end
else
task.wait() -- Overload prevention
end
end
ActiveProfileLoadJobs = ActiveProfileLoadJobs - 1
return nil -- If loop breaks return nothing
end
function ProfileStore:GlobalUpdateProfileAsync(profile_key, update_handler, _use_mock) --> [GlobalUpdates / nil] (update_handler(GlobalUpdates))
if type(profile_key) ~= "string" or string.len(profile_key) == 0 then
error("[ProfileService]: Invalid profile_key")
end
if type(update_handler) ~= "function" then
error("[ProfileService]: Invalid update_handler")
end
if ProfileService.ServiceLocked == true then
return nil
end
WaitForPendingProfileStore(self)
while ProfileService.ServiceLocked == false do
-- Updating profile:
local loaded_data = StandardProfileUpdateAsyncDataStore(
self,
profile_key,
{
ExistingProfileHandle = nil,
MissingProfileHandle = nil,
EditProfile = function(latest_data)
-- Running update_handler:
local global_updates_object = {
_updates_latest = latest_data.GlobalUpdates,
_update_handler_mode = true,
}
setmetatable(global_updates_object, GlobalUpdates)
update_handler(global_updates_object)
end,
},
_use_mock == UseMockTag
)
CustomWriteQueueMarkForCleanup(self._profile_store_lookup, profile_key)
-- Handling loaded_data:
if loaded_data ~= nil then
-- Return GlobalUpdates object (Update successful):
local global_updates_object = {
_updates_latest = loaded_data.GlobalUpdates,
}
setmetatable(global_updates_object, GlobalUpdates)
return global_updates_object
else
task.wait() -- Overload prevention
end
end
return nil -- Return nothing (Update unsuccessful)
end
function ProfileStore:ViewProfileAsync(profile_key, version, _use_mock) --> [Profile / nil]
if type(profile_key) ~= "string" or string.len(profile_key) == 0 then
error("[ProfileService]: Invalid profile_key")
end
if ProfileService.ServiceLocked == true then
return nil
end
WaitForPendingProfileStore(self)
if version ~= nil and (_use_mock == UseMockTag or UseMockDataStore == true) then
return nil -- No version support in mock mode
end
while ProfileService.ServiceLocked == false do
-- Load profile:
local loaded_data, key_info = StandardProfileUpdateAsyncDataStore(
self,
profile_key,
{
ExistingProfileHandle = nil,
MissingProfileHandle = function(latest_data)
latest_data.Data = DeepCopyTable(self._profile_template)
latest_data.MetaData = {
ProfileCreateTime = os.time(),
SessionLoadCount = 0,
ActiveSession = nil,
ForceLoadSession = nil,
MetaTags = {},
}
end,
EditProfile = nil,
},
_use_mock == UseMockTag,
true, -- Use :GetAsync()
version -- DataStore key version
)
CustomWriteQueueMarkForCleanup(self._profile_store_lookup, profile_key)
-- Handle load_data:
if loaded_data ~= nil then
if key_info == nil then
return nil -- Load was successful, but the key was empty - return no profile object
end
-- Create Profile object:
local global_updates_object = {
_updates_latest = loaded_data.GlobalUpdates, -- {0, {}}
_profile = nil,
}
setmetatable(global_updates_object, GlobalUpdates)
local profile = {
Data = loaded_data.Data,
MetaData = loaded_data.MetaData,
MetaTagsUpdated = Madwork.NewScriptSignal(),
RobloxMetaData = loaded_data.RobloxMetaData or {},
UserIds = loaded_data.UserIds or {},
KeyInfo = key_info,
KeyInfoUpdated = Madwork.NewScriptSignal(),
GlobalUpdates = global_updates_object,
_profile_store = self,
_profile_key = profile_key,
_view_mode = true,
_load_timestamp = os.clock(),
}
setmetatable(profile, Profile)
global_updates_object._profile = profile
-- Returning Profile object:
return profile
else
task.wait() -- Overload prevention
end
end
return nil -- If loop breaks return nothing
end
function ProfileStore:ProfileVersionQuery(profile_key, sort_direction, min_date, max_date, _use_mock) --> [ProfileVersionQuery]
if type(profile_key) ~= "string" or string.len(profile_key) == 0 then
error("[ProfileService]: Invalid profile_key")
end
if ProfileService.ServiceLocked == true then
return setmetatable({}, ProfileVersionQuery) -- Silently fail :Next() requests
end
WaitForPendingProfileStore(self)
if _use_mock == UseMockTag or UseMockDataStore == true then
error("[ProfileService]: :ProfileVersionQuery() is not supported in mock mode")
end
-- Type check:
if sort_direction ~= nil and (typeof(sort_direction) ~= "EnumItem"
or sort_direction.EnumType ~= Enum.SortDirection) then
error("[ProfileService]: Invalid sort_direction (" .. tostring(sort_direction) .. ")")
end
if min_date ~= nil and typeof(min_date) ~= "DateTime" and typeof(min_date) ~= "number" then
error("[ProfileService]: Invalid min_date (" .. tostring(min_date) .. ")")
end
if max_date ~= nil and typeof(max_date) ~= "DateTime" and typeof(max_date) ~= "number" then
error("[ProfileService]: Invalid max_date (" .. tostring(max_date) .. ")")
end
min_date = typeof(min_date) == "DateTime" and min_date.UnixTimestampMillis or min_date
max_date = typeof(max_date) == "DateTime" and max_date.UnixTimestampMillis or max_date
local profile_version_query = {
_profile_store = self,
_profile_key = profile_key,
_sort_direction = sort_direction,
_min_date = min_date,
_max_date = max_date,
_query_pages = nil,
_query_index = 0,
_query_failure = false,
_is_query_yielded = false,
_query_queue = {},
}
setmetatable(profile_version_query, ProfileVersionQuery)
return profile_version_query
end
function ProfileStore:WipeProfileAsync(profile_key, _use_mock) --> is_wipe_successful [bool]
if type(profile_key) ~= "string" or string.len(profile_key) == 0 then
error("[ProfileService]: Invalid profile_key")
end
if ProfileService.ServiceLocked == true then
return false
end
WaitForPendingProfileStore(self)
local wipe_status = false
if _use_mock == UseMockTag then -- Used when the profile is accessed through ProfileStore.Mock
local mock_data_store = UserMockDataStore[self._profile_store_lookup]
if mock_data_store ~= nil then
mock_data_store[profile_key] = nil
end
wipe_status = true
task.wait() -- Simulate API call yield
elseif UseMockDataStore == true then -- Used when API access is disabled
local mock_data_store = MockDataStore[self._profile_store_lookup]
if mock_data_store ~= nil then
mock_data_store[profile_key] = nil
end
wipe_status = true
task.wait() -- Simulate API call yield
else
wipe_status = pcall(function()
self._global_data_store:RemoveAsync(profile_key)
end)
end
CustomWriteQueueMarkForCleanup(self._profile_store_lookup, profile_key)
return wipe_status
end
|
--[[ Local Functions ]] | --
function MouseLockController:OnMouseLockToggled()
self.isMouseLocked = not self.isMouseLocked
if self.isMouseLocked then
local cursorImageValueObj = script:FindFirstChild("CursorImage")
if cursorImageValueObj and cursorImageValueObj:IsA("StringValue") and cursorImageValueObj.Value then
self.savedMouseCursor = Mouse.Icon
Mouse.Icon = 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
self.savedMouseCursor = Mouse.Icon
Mouse.Icon = DEFAULT_MOUSE_LOCK_CURSOR
end
else
if self.savedMouseCursor then
Mouse.Icon = self.savedMouseCursor
self.savedMouseCursor = nil
end
end
self.mouseLockToggledEvent:Fire()
end
|
-- TODO: this is special because it gets imported during build. |
return "17.0.1"
|
--[[
A lite-FSM script that holds state. Can transition between states, as long as they are defined as being
transitional. Will call any relevant callbacks when the state changes.
]] |
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local BaseComponent = require(ReplicatedStorage.Dependencies.GameUtils.Components.BaseComponent)
local Logger = require(ReplicatedStorage.Dependencies.GameUtils.Logger)
local StateHolder = BaseComponent:extend("StateHolder")
|
--[[
REFERENCE:
command_full_name: The name of a command (e.g. :cmds)
[command_full_name] = {
Player = 0;
Server = 0;
Cross = 0;
}
]] |
}
settings.HttpWait = 60 -- How long things that use the HttpService will wait before updating again
settings.Trello_Enabled = false -- Are the Trello features enabled?
settings.Trello_Primary = "" -- Primary Trello board
settings.Trello_Secondary = {} -- Secondary Trello boards (read-only) Format: {"BoardID";"BoardID2","etc"}
settings.Trello_AppKey = "" -- Your Trello AppKey Link: https://trello.com/app-key
settings.Trello_Token = "" -- Trello token (DON'T SHARE WITH ANYONE!) Link: https://trello.com/1/connect?name=Trello_API_Module&response_type=token&expires=never&scope=read,write&key=YOUR_APP_KEY_HERE
settings.Trello_HideRanks = false -- If true, Trello-assigned ranks won't be shown in the admins list UI (accessed via :admins)
settings.G_API = true -- If true allows other server scripts to access certain functions described in the API module through _G.Adonis
settings.G_Access = false -- If enabled allows other scripts to access Adonis using _G.Adonis.Access; Scripts will still be able to do things like _G.Adonis.CheckAdmin(player)
settings.G_Access_Key = "Example_Key" -- Key required to use the _G access API; Example_Key will not work for obvious reasons
settings.G_Access_Perms = "Read" -- Access perms
settings.Allowed_API_Calls = {
Client = false; -- Allow access to the Client (not recommended)
Settings = false; -- Allow access to settings (not recommended)
DataStore = false; -- Allow access to the DataStore (not recommended)
Core = false; -- Allow access to the script's core table (REALLY not recommended)
Service = false; -- Allow access to the script's service metatable
Remote = false; -- Communication table
HTTP = false; -- HTTP related things like Trello functions
Anti = false; -- Anti-Exploit table
Logs = false;
UI = false; -- Client UI table
Admin = false; -- Admin related functions
Functions = false; -- Functions table (contains functions used by the script that don't have a subcategory)
Variables = true; -- Variables table
API_Specific = true; -- API Specific functions
}
settings.FunCommands = true -- Are fun commands enabled?
settings.PlayerCommands = true -- Are player-level utility commands enabled?
settings.CommandFeedback = false -- Should players be notified when commands with non-obvious effects are run on them?
settings.CrossServerCommands = true -- Are commands which affect more than one server enabled?
settings.ChatCommands = true -- If false you will not be able to run commands via the chat; Instead you MUST use the console or you will be unable to run commands
settings.CreatorPowers = true -- Gives me creator level admin; This is strictly used for debugging; I can't debug without full access to the script
settings.CodeExecution = true -- Enables the use of code execution in Adonis; Scripting related (such as :s) and a few other commands require this
settings.SilentCommandDenials = false -- If true, there will be no differences between the error messages shown when a user enters an invalid command and when they have insufficient permissions for the command
settings.BanMessage = "Banned" -- Message shown to banned users upon kick
settings.LockMessage = "Not Whitelisted" -- Message shown to people when they are kicked while the game is :slocked
settings.SystemTitle = "System Message" -- Title to display in :sm and :bc
settings.MaxLogs = 5000 -- Maximum logs to save before deleting the oldest
settings.SaveCommandLogs = true -- If command logs are saved to the datastores
settings.Notification = true -- Whether or not to show the "You're an admin" and "Updated" notifications
settings.SongHint = true -- Display a hint with the current song name and ID when a song is played via :music
settings.TopBarShift = false -- By default hints and notifs will appear from the top edge of the window, this is acheived by offsetting them by -35 into the transparent region where roblox buttons menu/chat/leaderstat buttons are. Set this to true if you don't want hints/notifs to appear in that region.
settings.Messages = {} -- A list of notification messages to show HeadAdmins and above on join
settings.AutoClean = false -- Will auto clean workspace of things like hats and tools
settings.AutoCleanDelay = 60 -- Time between auto cleans
settings.AutoBackup = false -- Run :backupmap automatically when the server starts. To restore the map, run :restoremap
settings.Console = true -- Whether the command console is enabled
settings.Console_AdminsOnly = false -- If true, only admins will be able to access the console
settings.HelpSystem = true -- Allows players to call admins for help using !help
settings.HelpButton = true -- Shows a little help button in the bottom right corner.
settings.HelpButtonImage = "rbxassetid://357249130" -- Sets the image used for the Adonis help button above.
settings.DonorCapes = true -- Donors get to show off their capes; Not disruptive :)
settings.DonorCommands = true -- Show your support for the script and let donors use harmless commands like !sparkles
settings.LocalCapes = false -- Makes Donor capes local so only the donors see their cape [All players can still disable capes locally]
settings.Detection = true -- Attempts to detect certain known exploits
settings.CheckClients = true -- Checks clients every minute or two to make sure they are still active
settings.ExploitNotifications = true -- Notify all moderators and higher ups when a player is kicked or crashed from the AntiExploit
settings.CharacterCheckLogs = false -- If the character checks appear in exploit logs and exploit notifications
settings.AntiNoclip = false -- Attempts to detect noclipping and kills the player if found
settings.AntiRootJointDeletion = false -- Attempts to detect paranoid and kills the player if found
settings.AntiHumanoidDeletion = false -- (Very important) Prevents invalid humanoid deletion. Un-does the deletion and kills the player
settings.AntiMultiTool = false -- Prevents multitooling and because of that many other exploits
settings.AntiGod = false -- If a player does not respawn when they should have they get respawned
settings.AntiSpeed = true -- (Client-Sided) Attempts to detect speed exploits
settings.AntiBuildingTools = false -- (Client-Sided) Attempts to detect any HopperBin(s)/Building Tools added to the client
settings.AntiClientIdle = false -- (Client-Sided) Kick the player if they are using an anti-idle exploit
settings.ProtectHats = false -- Prevents hats from being un-welded from their characters through unnormal means
|
--[=[
@within TableUtil
@function Values
@param tbl table
@return table
Returns an array with all the values in the table.
```lua
local t = {A = 10, B = 20, C = 30}
local values = TableUtil.Values(t)
print(values) --> {10, 20, 30}
```
:::caution Ordering
The ordering of the values is never guaranteed. If order is imperative, call
`table.sort` on the resulting `values` array.
```lua
local values = TableUtil.Values(t)
table.sort(values)
```
]=] |
local function Values<K, V>(tbl: { [K]: V }): { V }
local values = table.create(#tbl)
for _, v in tbl do
table.insert(values, v)
end
return values
end
|
--// Services |
local RunService = game:GetService("RunService")
local UIS = game:GetService("UserInputService")
local Players = game:GetService("Players")
|
--[[
signal = Signal.new()
signal:Fire(...)
signal:Wait()
signal:Destroy()
signal:DisconnectAll()
connection = signal:Connect(functionHandler)
connection.Connected
connection:Disconnect()
connection:IsConnected()
--]] |
local Connection = {}
Connection.__index = Connection
function Connection.new(signal, connection)
local self = setmetatable({
_signal = signal;
_conn = connection;
Connected = true;
}, Connection)
return self
end
function Connection:Disconnect()
if (self._conn) then
self._conn:Disconnect()
self._conn = nil
end
if (not self._signal) then return end
self.Connected = false
local connections = self._signal._connections
local connectionIndex = table.find(connections, self)
if (connectionIndex) then
local n = #connections
connections[connectionIndex] = connections[n]
connections[n] = nil
end
self._signal = nil
end
function Connection:IsConnected()
if (self._conn) then
return self._conn.Connected
end
return false
end
Connection.Destroy = Connection.Disconnect
|
--// Special Variables |
return function(Vargs, GetEnv)
local env = GetEnv(nil, {script = script})
setfenv(1, env)
local _G, game, script, getfenv, setfenv, workspace,
getmetatable, setmetatable, loadstring, coroutine,
rawequal, typeof, print, math, warn, error, pcall,
xpcall, select, rawset, rawget, ipairs, pairs,
next, Rect, Axes, os, time, Faces, unpack, string, Color3,
newproxy, tostring, tonumber, Instance, TweenInfo, BrickColor,
NumberRange, ColorSequence, NumberSequence, ColorSequenceKeypoint,
NumberSequenceKeypoint, PhysicalProperties, Region3int16,
Vector3int16, require, table, type, wait,
Enum, UDim, UDim2, Vector2, Vector3, Region3, CFrame, Ray, delay =
_G, game, script, getfenv, setfenv, workspace,
getmetatable, setmetatable, loadstring, coroutine,
rawequal, typeof, print, math, warn, error, pcall,
xpcall, select, rawset, rawget, ipairs, pairs,
next, Rect, Axes, os, time, Faces, unpack, string, Color3,
newproxy, tostring, tonumber, Instance, TweenInfo, BrickColor,
NumberRange, ColorSequence, NumberSequence, ColorSequenceKeypoint,
NumberSequenceKeypoint, PhysicalProperties, Region3int16,
Vector3int16, require, table, type, wait,
Enum, UDim, UDim2, Vector2, Vector3, Region3, CFrame, Ray, delay
local script = script
local service = Vargs.Service
local client = Vargs.Client
local Anti, Core, Functions, Process, Remote, UI, Variables
local function Init()
UI = client.UI;
Anti = client.Anti;
Core = client.Core;
Variables = client.Variables
Functions = client.Functions;
Process = client.Process;
Remote = client.Remote;
Variables.Init = nil;
end
local function RunAfterLoaded()
--// Get CodeName
client.Variables.CodeName = client.Remote.Get("Variable", "CodeName")
Variables.RunAfterLoaded = nil;
end
local function RunLast()
--[[client = service.ReadOnly(client, {
[client.Variables] = true;
[client.Handlers] = true;
G_API = true;
G_Access = true;
G_Access_Key = true;
G_Access_Perms = true;
Allowed_API_Calls = true;
HelpButtonImage = true;
Finish_Loading = true;
RemoteEvent = true;
ScriptCache = true;
Returns = true;
PendingReturns = true;
EncodeCache = true;
DecodeCache = true;
Received = true;
Sent = true;
Service = true;
Holder = true;
GUIs = true;
LastUpdate = true;
RateLimits = true;
Init = true;
RunLast = true;
RunAfterInit = true;
RunAfterLoaded = true;
RunAfterPlugins = true;
}, true)--]]
Variables.RunLast = nil;
end
getfenv().client = nil
getfenv().service = nil
getfenv().script = nil
client.GUIs = {}
client.GUIHolder = service.New("Folder")
client.Variables = {
Init = Init;
RunLast = RunLast;
RunAfterLoaded = RunAfterLoaded;
CodeName = "";
UIKeepAlive = true;
KeybindsEnabled = true;
ParticlesEnabled = true;
CapesEnabled = true;
HideChatCommands = false;
Particles = {};
KeyBinds = {};
Aliases = {};
Capes = {};
savedUI = {};
localSounds = {};
ESPObjects = {};
CommunicationsHistory = {};
LightingSettings = {
Ambient = service.Lighting.Ambient;
Brightness = service.Lighting.Brightness;
ColorShift_Bottom = service.Lighting.ColorShift_Bottom;
ColorShift_Top = service.Lighting.ColorShift_Top;
GlobalShadows = service.Lighting.GlobalShadows;
OutdoorAmbient = service.Lighting.OutdoorAmbient;
Outlines = service.Lighting.Outlines;
ShadowColor = service.Lighting.ShadowColor;
GeographicLatitude = service.Lighting.GeographicLatitude;
Name = service.Lighting.Name;
TimeOfDay = service.Lighting.TimeOfDay;
FogColor = service.Lighting.FogColor;
FogEnd = service.Lighting.FogEnd;
FogStart = service.Lighting.FogStart;
}
};
end
|
--------------------------------------------------- Mobile Button |
local function handleContext(name, state, input)
if state == Enum.UserInputState.Begin then
if CameraEffect == true then
TweenService:Create(Camera, TweenInfo.new(0.5), {FieldOfView = 90}):Play()
end
Humanoid.WalkSpeed = SprintSpeed
else
if CameraEffect == true then
TweenService:Create(Camera, TweenInfo.new(0.5), {FieldOfView = 70}):Play()
end
Humanoid.WalkSpeed = NormalWalkSpeed
end
end
cas:BindAction("Sprint", handleContext, true, Leftc, RightC)
cas:SetPosition("Sprint", UDim2.new(.2, 0, .5, 0))
cas:SetTitle("Sprint", "Sprint")
cas:GetButton("Sprint").Size = UDim2.new(.3, 0, .3, 0)
|
--script.Parent.MouseClick:Connect(function()
-- local clonedExplosion = Explosion:Clone()
-- Explosion.Parent = game.Workspace.ExplodeWall.ExplosionPart
--end) | |
-- Private Methods |
function init(self)
local button = self.Button
local listFrame = self.ListFrame
--local function contentSizeUpdate()
-- local absSize = button.AbsoluteSize
-- local ratio = absSize.y / absSize.x
-- button.Arrow.Size = UDim2.new(ratio, 0, 1, 0)
-- button.Option.Size = UDim2.new(1 - ratio, -12, 1, 0)
--end
--contentSizeUpdate()
--self._Maid:Mark(button:GetPropertyChangedSignal("AbsoluteSize"):Connect(contentSizeUpdate))
for i, optionButton in next, listFrame.ScrollFrame:GetChildren() do
if not optionButton:IsA("GuiButton") then
continue
end
self._Options[i] = optionButton
optionButton.Activated:Connect(function()
self:Set(optionButton)
end)
end
self._Maid:Mark(button.Activated:Connect(function()
self:Show(not listFrame.Visible)
end))
self._Maid:Mark(UIS.InputBegan:Connect(function(input)
if (VALID_PRESS[input.UserInputType]) then
local p = input.Position
local p2 = Vector2.new(p.x, p.y)
if (listFrame.Visible and not (isInFrame(listFrame, p2) or isInFrame(button, p2))) then
self:Show(false)
end
end
end))
end
function isInFrame(frame, pos)
local fPos = frame.AbsolutePosition
local fSize = frame.AbsoluteSize
local d = pos - fPos
return (d.x >= 0 and d.x <= fSize.x and d.y >= 0 and d.y <= fSize.y)
end
|
--[[Output Scaling Factor]] |
local hpScaling = _Tune.WeightScaling*100
local FBrakeForce = _Tune.FBrakeForce
local RBrakeForce = _Tune.RBrakeForce
local PBrakeForce = _Tune.PBrakeForce
if not workspace:PGSIsEnabled() then
hpScaling = _Tune.LegacyScaling*100
FBrakeForce = _Tune.FLgcyBForce
RBrakeForce = _Tune.RLgcyBForce
PBrakeForce = _Tune.LgcyPBForce
end
|
--Update (10/6/21): Wow, looks like the above actually happened recently. Roblox changed all the default R15 meshes... And nothing looks different at all.
--I wonder what that's all about. Anyhow, the script is fixed to work with the new meshes now, sorry about any hiccups that caused. | |
-- Preload animations |
function playAnimation(animName, transitionTime, humanoid)
local roll = math.random(1, animTable[animName].totalWeight)
local origRoll = roll
local idx = 1
while roll > animTable[animName][idx].weight do
roll = roll - animTable[animName][idx].weight
idx = idx + 1
end
|
--DevVince was here. :o |
local shelly = script.Parent
local origin = shelly.PrimaryPart.CFrame
local tether = 15
local bg = shelly.PrimaryPart:WaitForChild'BodyGyro'
local bp = shelly.PrimaryPart:WaitForChild'BodyPosition'
bp.Position = origin.p
bg.CFrame = shelly.PrimaryPart.CFrame
local shellyGood = true
local ostrich = tick()
function MoveShelly()
bp.Parent = shelly.PrimaryPart
local goal
repeat
local ray = Ray.new(Vector3.new(origin.p.x+math.random(-tether,tether), shelly.PrimaryPart.Position.Y+100, origin.p.z+math.random(-tether,tether)),Vector3.new(0,-130,0))
local part,pos,norm,mat = workspace:FindPartOnRay(ray, shelly)
if part == workspace.Terrain and mat ~= Enum.Material.Water then
goal = pos+Vector3.new(0,.35,0)
end
wait()
until goal
--Set new goal for banto to MoveTo :)
local pos = shelly.PrimaryPart.Position
local cf = CFrame.new(Vector3.new(pos.X, 0, pos.Z), Vector3.new(goal.X, 0, goal.Z))
bg.CFrame = cf
bp.Position = (cf*CFrame.new(0,0,-100)).p
local start = tick()
repeat task.wait(.5)
local ray = Ray.new(shelly.PrimaryPart.Position, Vector3.new(0,-140,0))
until (shelly.PrimaryPart.Position-goal).magnitude < 10 or tick()-start >15 or not shellyGood
if not shellyGood then bp.Parent,bg.Parent= nil,nil return end
bp.Parent = nil
wait(math.random(3,8))
end
local soundBank = game.ServerStorage.Sounds.NPC.Shelly:GetChildren()
shelly.Health.Changed:connect(function()
if shellyGood then
bp.Parent,bg.Parent= nil,nil
shelly.PrimaryPart.Transparency =1
shelly.PrimaryPart.CanCollide = false
shelly.Shell.Transparency = 1
shelly.HitShell.Transparency = 0
shelly.HitShell.CanCollide = true
shellyGood = false
ostrich = tick()
shelly:SetPrimaryPartCFrame(shelly.PrimaryPart.CFrame*CFrame.new(0,2,0))
local hitSound = soundBank[math.random(1,#soundBank)]:Clone()
hitSound.PlayOnRemove = true
hitSound.Parent = shelly.PrimaryPart
wait()
hitSound:Destroy()
repeat task.wait() until tick()-ostrich > 10
shelly.PrimaryPart.Transparency = 0
shelly.PrimaryPart.CanCollide = true
shelly.Shell.Transparency = 0
shelly.HitShell.Transparency = 1
shelly.HitShell.CanCollide = false
bp.Parent,bg.Parent = shelly.PrimaryPart,shelly.PrimaryPart
shellyGood = true
end
end)
while true do
if shellyGood then
MoveShelly()
else
task.wait(1)
end
end
|
--script.Parent.BBB.Velocity = script.Parent.BBB.CFrame.lookVector *script.Parent.Speed.Value |
script.Parent.BBBB.Velocity = script.Parent.BBBB.CFrame.lookVector *script.Parent.Speed.Value
script.Parent.C.Velocity = script.Parent.C.CFrame.lookVector *script.Parent.Speed.Value
script.Parent.CC.Velocity = script.Parent.CC.CFrame.lookVector *script.Parent.Speed.Value |
-- a countdown time for when the alarm is set off and when it is reset | |
-- while adap do
-- local dis = math.max(math.min(car.DriveSeat.Velocity.Magnitude*2,200),60)
-- check("FSL",dis)
-- check("FSR",dis)
-- wait(.1)
-- end |
end
|
--local Network = require(Replicated.Network) |
local Workspace = game:GetService("Workspace")
local LocalPlayer = Players.LocalPlayer
if not LocalPlayer then
Players:GetPropertyChangedSignal("LocalPlayer"):Wait()
LocalPlayer = Players.LocalPlayer
end
local Camera = Workspace.CurrentCamera
Workspace:GetPropertyChangedSignal("CurrentCamera"):Connect(function()
local newCamera = Workspace.CurrentCamera
if newCamera then
Camera = newCamera
end
end)
|
--!strict
--SecondsToClock
--Yuuwa0519
--2021-08-25 |
return function(seconds: number): ...number
local rawHours: number = seconds / 3600
local fullHours: number = math.floor(rawHours)
local partialHours: number = rawHours - fullHours
local rawMinutes: number = partialHours * 60
local fullMinutes: number = math.floor(rawMinutes)
local partialMinutes: number = rawMinutes - fullMinutes
local rawSeconds: number = partialMinutes * 60
local fullSeconds: number = math.round(rawSeconds)
if fullSeconds == 60 then
fullMinutes += 1
fullSeconds = 0
end
if fullMinutes == 60 then
fullHours += 1
fullMinutes = 0
end
return fullHours, fullMinutes, fullSeconds
end
|
--Points layout instructions--
-- Place the S2 on the track with the A parts, and the S1 on the track with the B parts.
-- Each route with a set of points is automatically decided. |
local s1 = script.Parent.S1
local s2 = script.Parent.S2
local s3 = script.Parent.S3
local aparts = script.Parent.AParts:GetChildren()
local bparts = script.Parent.BParts:GetChildren()
|
-- fn cst_flt_rdr(string src, int len, fn func)
-- @len - Length of type for reader
-- @func - Reader callback |
local function cst_flt_rdr(len, func)
return function(S)
local flt = func(S.source, S.index)
S.index = S.index + len
return flt
end
end
local function stm_instructions(S)
local size = S:s_int()
local code = {}
for i = 1, size do
local ins = S:s_ins()
local op = bit.band(ins, 0x3F)
local args = OPCODE_T[op]
local mode = OPCODE_M[op]
local data = {value = ins, op = OPCODE_RM[op], A = bit.band(bit.rshift(ins, 6), 0xFF)}
if args == 'ABC' then
data.B = bit.band(bit.rshift(ins, 23), 0x1FF)
data.C = bit.band(bit.rshift(ins, 14), 0x1FF)
data.is_KB = mode.b == 'OpArgK' and data.B > 0xFF -- post process optimization
data.is_KC = mode.c == 'OpArgK' and data.C > 0xFF
elseif args == 'ABx' then
data.Bx = bit.band(bit.rshift(ins, 14), 0x3FFFF)
data.is_K = mode.b == 'OpArgK'
elseif args == 'AsBx' then
data.sBx = bit.band(bit.rshift(ins, 14), 0x3FFFF) - 131071
end
code[i] = data
end
return code
end
local function stm_constants(S)
local size = S:s_int()
local consts = {}
for i = 1, size do
local tt = stm_byte(S)
local k
if tt == 1 then
k = stm_byte(S) ~= 0
elseif tt == 3 then
k = S:s_num()
elseif tt == 4 then
k = stm_lstring(S)
end
consts[i] = k -- offset +1 during instruction decode
end
return consts
end
local function stm_subfuncs(S, src)
local size = S:s_int()
local sub = {}
for i = 1, size do
sub[i] = stm_lua_func(S, src) -- offset +1 in CLOSURE
end
return sub
end
local function stm_lineinfo(S)
local size = S:s_int()
local lines = {}
for i = 1, size do lines[i] = S:s_int() end
return lines
end
local function stm_locvars(S)
local size = S:s_int()
local locvars = {}
for i = 1, size do locvars[i] = {varname = stm_lstring(S), startpc = S:s_int(), endpc = S:s_int()} end
return locvars
end
local function stm_upvals(S)
local size = S:s_int()
local upvals = {}
for i = 1, size do upvals[i] = stm_lstring(S) end
return upvals
end
function stm_lua_func(S, psrc)
local proto = {}
local src = stm_lstring(S) or psrc -- source is propagated
proto.source = src -- source name
S:s_int() -- line defined
S:s_int() -- last line defined
proto.numupvals = stm_byte(S) -- num upvalues
proto.numparams = stm_byte(S) -- num params
stm_byte(S) -- vararg flag
stm_byte(S) -- max stack size
proto.code = stm_instructions(S)
proto.const = stm_constants(S)
proto.subs = stm_subfuncs(S, src)
proto.lines = stm_lineinfo(S)
stm_locvars(S)
stm_upvals(S)
-- post process optimization
for _, v in ipairs(proto.code) do
if v.is_K then
v.const = proto.const[v.Bx + 1] -- offset for 1 based index
else
if v.is_KB then v.const_B = proto.const[v.B - 0xFF] end
if v.is_KC then v.const_C = proto.const[v.C - 0xFF] end
end
end
return proto
end
function stm_lua_bytecode(src)
-- func reader
local rdr_func
-- header flags
local little
local size_int
local size_szt
local size_ins
local size_num
local flag_int
-- stream object
local stream = {
-- data
index = 1,
source = src,
}
assert(stm_string(stream, 4) == '\27Lua', 'invalid Lua signature')
assert(stm_byte(stream) == 0x51, 'invalid Lua version')
assert(stm_byte(stream) == 0, 'invalid Lua format')
little = stm_byte(stream) ~= 0
size_int = stm_byte(stream)
size_szt = stm_byte(stream)
size_ins = stm_byte(stream)
size_num = stm_byte(stream)
flag_int = stm_byte(stream) ~= 0
rdr_func = little and rd_int_le or rd_int_be
stream.s_int = cst_int_rdr(size_int, rdr_func)
stream.s_szt = cst_int_rdr(size_szt, rdr_func)
stream.s_ins = cst_int_rdr(size_ins, rdr_func)
if flag_int then
stream.s_num = cst_int_rdr(size_num, rdr_func)
elseif float_types[size_num] then
stream.s_num = cst_flt_rdr(size_num, float_types[size_num][little and 'little' or 'big'])
else
error('unsupported float size')
end
return stm_lua_func(stream, '@virtual')
end
local function close_lua_upvalues(list, index)
for i, uv in pairs(list) do
if uv.index >= index then
uv.value = uv.store[uv.index] -- store value
uv.store = uv
uv.index = 'value' -- self reference
list[i] = nil
end
end
end
local function open_lua_upvalue(list, index, stack)
local prev = list[index]
if not prev then
prev = {index = index, store = stack}
list[index] = prev
end
return prev
end
local function wrap_lua_variadic(...) return select('#', ...), {...} end
local function on_lua_error(exst, err)
local src = exst.source
local line = exst.lines[exst.pc - 1]
local psrc, pline, pmsg = string.match(err or '', '^(.-):(%d+):%s+(.+)')
local fmt = '%s:%i: [%s:%i] %s'
line = line or '0'
psrc = psrc or '?'
pline = pline or '0'
pmsg = pmsg or err or ''
error(string.format(fmt, src, line, psrc, pline, pmsg), 0)
end
local function exec_lua_func(exst)
-- localize for easy lookup
local code = exst.code
local subs = exst.subs
local env = exst.env
local upvs = exst.upvals
local vargs = exst.varargs
-- state variables
local stktop = -1
local openupvs = {}
local stack = exst.stack
local pc = exst.pc
while true do
local inst = code[pc]
local op = inst.op
pc = pc + 1
if op < 18 then
if op < 8 then
if op < 3 then
if op < 1 then
--[[LOADNIL]]
for i = inst.A, inst.B do stack[i] = nil end
elseif op > 1 then
--[[GETUPVAL]]
local uv = upvs[inst.B]
stack[inst.A] = uv.store[uv.index]
else
--[[ADD]]
local lhs, rhs
if inst.is_KB then
lhs = inst.const_B
else
lhs = stack[inst.B]
end
if inst.is_KC then
rhs = inst.const_C
else
rhs = stack[inst.C]
end
stack[inst.A] = lhs + rhs
end
elseif op > 3 then
if op < 6 then
if op > 4 then
--[[SELF]]
local A = inst.A
local B = inst.B
local index
if inst.is_KC then
index = inst.const_C
else
index = stack[inst.C]
end
stack[A + 1] = stack[B]
stack[A] = stack[B][index]
else
--[[GETGLOBAL]]
stack[inst.A] = env[inst.const]
end
elseif op > 6 then
--[[GETTABLE]]
local index
if inst.is_KC then
index = inst.const_C
else
index = stack[inst.C]
end
stack[inst.A] = stack[inst.B][index]
else
--[[SUB]]
local lhs, rhs
if inst.is_KB then
lhs = inst.const_B
else
lhs = stack[inst.B]
end
if inst.is_KC then
rhs = inst.const_C
else
rhs = stack[inst.C]
end
stack[inst.A] = lhs - rhs
end
else --[[MOVE]]
stack[inst.A] = stack[inst.B]
end
elseif op > 8 then
if op < 13 then
if op < 10 then
--[[SETGLOBAL]]
env[inst.const] = stack[inst.A]
elseif op > 10 then
if op < 12 then
--[[CALL]]
local A = inst.A
local B = inst.B
local C = inst.C
local params
local sz_vals, l_vals
if B == 0 then
params = stktop - A
else
params = B - 1
end
sz_vals, l_vals = wrap_lua_variadic(stack[A](unpack(stack, A + 1, A + params)))
if C == 0 then
stktop = A + sz_vals - 1
else
sz_vals = C - 1
end
for i = 1, sz_vals do stack[A + i - 1] = l_vals[i] end
else
--[[SETUPVAL]]
local uv = upvs[inst.B]
uv.store[uv.index] = stack[inst.A]
end
else
--[[MUL]]
local lhs, rhs
if inst.is_KB then
lhs = inst.const_B
else
lhs = stack[inst.B]
end
if inst.is_KC then
rhs = inst.const_C
else
rhs = stack[inst.C]
end
stack[inst.A] = lhs * rhs
end
elseif op > 13 then
if op < 16 then
if op > 14 then
--[[TAILCALL]]
local A = inst.A
local B = inst.B
local params
if B == 0 then
params = stktop - A
else
params = B - 1
end
close_lua_upvalues(openupvs, 0)
return wrap_lua_variadic(stack[A](unpack(stack, A + 1, A + params)))
else
--[[SETTABLE]]
local index, value
if inst.is_KB then
index = inst.const_B
else
index = stack[inst.B]
end
if inst.is_KC then
value = inst.const_C
else
value = stack[inst.C]
end
stack[inst.A][index] = value
end
elseif op > 16 then
--[[NEWTABLE]]
stack[inst.A] = {}
else
--[[DIV]]
local lhs, rhs
if inst.is_KB then
lhs = inst.const_B
else
lhs = stack[inst.B]
end
if inst.is_KC then
rhs = inst.const_C
else
rhs = stack[inst.C]
end
stack[inst.A] = lhs / rhs
end
else
--[[LOADK]]
stack[inst.A] = inst.const
end
else
--[[FORLOOP]]
local A = inst.A
local step = stack[A + 2]
local index = stack[A] + step
local limit = stack[A + 1]
local loops
if step == math.abs(step) then
loops = index <= limit
else
loops = index >= limit
end
if loops then
stack[inst.A] = index
stack[inst.A + 3] = index
pc = pc + inst.sBx
end
end
elseif op > 18 then
if op < 28 then
if op < 23 then
if op < 20 then
--[[LEN]]
stack[inst.A] = #stack[inst.B]
elseif op > 20 then
if op < 22 then
--[[RETURN]]
local A = inst.A
local B = inst.B
local vals = {}
local size
if B == 0 then
size = stktop - A + 1
else
size = B - 1
end
for i = 1, size do vals[i] = stack[A + i - 1] end
close_lua_upvalues(openupvs, 0)
return size, vals
else
--[[CONCAT]]
local str = stack[inst.B]
for i = inst.B + 1, inst.C do str = str .. stack[i] end
stack[inst.A] = str
end
else
--[[MOD]]
local lhs, rhs
if inst.is_KB then
lhs = inst.const_B
else
lhs = stack[inst.B]
end
if inst.is_KC then
rhs = inst.const_C
else
rhs = stack[inst.C]
end
stack[inst.A] = lhs % rhs
end
elseif op > 23 then
if op < 26 then
if op > 24 then
--[[CLOSE]]
close_lua_upvalues(openupvs, inst.A)
else
--[[EQ]]
local lhs, rhs
if inst.is_KB then
lhs = inst.const_B
else
lhs = stack[inst.B]
end
if inst.is_KC then
rhs = inst.const_C
else
rhs = stack[inst.C]
end
if (lhs == rhs) == (inst.A ~= 0) then pc = pc + code[pc].sBx end
pc = pc + 1
end
elseif op > 26 then
--[[LT]]
local lhs, rhs
if inst.is_KB then
lhs = inst.const_B
else
lhs = stack[inst.B]
end
if inst.is_KC then
rhs = inst.const_C
else
rhs = stack[inst.C]
end
if (lhs < rhs) == (inst.A ~= 0) then pc = pc + code[pc].sBx end
pc = pc + 1
else
--[[POW]]
local lhs, rhs
if inst.is_KB then
lhs = inst.const_B
else
lhs = stack[inst.B]
end
if inst.is_KC then
rhs = inst.const_C
else
rhs = stack[inst.C]
end
stack[inst.A] = lhs ^ rhs
end
else
--[[LOADBOOL]]
stack[inst.A] = inst.B ~= 0
if inst.C ~= 0 then pc = pc + 1 end
end
elseif op > 28 then
if op < 33 then
if op < 30 then
--[[LE]]
local lhs, rhs
if inst.is_KB then
lhs = inst.const_B
else
lhs = stack[inst.B]
end
if inst.is_KC then
rhs = inst.const_C
else
rhs = stack[inst.C]
end
if (lhs <= rhs) == (inst.A ~= 0) then pc = pc + code[pc].sBx end
pc = pc + 1
elseif op > 30 then
if op < 32 then
--[[CLOSURE]]
local sub = subs[inst.Bx + 1] -- offset for 1 based index
local nups = sub.numupvals
local uvlist
if nups ~= 0 then
uvlist = {}
for i = 1, nups do
local pseudo = code[pc + i - 1]
if pseudo.op == OPCODE_RM[0] then -- @MOVE
uvlist[i - 1] = open_lua_upvalue(openupvs, pseudo.B, stack)
elseif pseudo.op == OPCODE_RM[4] then -- @GETUPVAL
uvlist[i - 1] = upvs[pseudo.B]
end
end
pc = pc + nups
end
stack[inst.A] = wrap_lua_func(sub, env, uvlist)
else
--[[TESTSET]]
local A = inst.A
local B = inst.B
if (not stack[B]) == (inst.C ~= 0) then
pc = pc + 1
else
stack[A] = stack[B]
end
end
else
--[[UNM]]
stack[inst.A] = -stack[inst.B]
end
elseif op > 33 then
if op < 36 then
if op > 34 then
--[[VARARG]]
local A = inst.A
local size = inst.B
if size == 0 then
size = vargs.size
stktop = A + size - 1
end
for i = 1, size do stack[A + i - 1] = vargs.list[i] end
else
--[[FORPREP]]
local A = inst.A
local init, limit, step
init = assert(tonumber(stack[A]), '`for` initial value must be a number')
limit = assert(tonumber(stack[A + 1]), '`for` limit must be a number')
step = assert(tonumber(stack[A + 2]), '`for` step must be a number')
stack[A] = init - step
stack[A + 1] = limit
stack[A + 2] = step
pc = pc + inst.sBx
end
elseif op > 36 then
--[[SETLIST]]
local A = inst.A
local C = inst.C
local size = inst.B
local tab = stack[A]
local offset
if size == 0 then size = stktop - A end
if C == 0 then
C = inst[pc].value
pc = pc + 1
end
offset = (C - 1) * FIELDS_PER_FLUSH
for i = 1, size do tab[i + offset] = stack[A + i] end
else
--[[NOT]]
stack[inst.A] = not stack[inst.B]
end
else
--[[TEST]]
if (not stack[inst.A]) == (inst.C ~= 0) then pc = pc + 1 end
end
else
--[[TFORLOOP]]
local A = inst.A
local func = stack[A]
local state = stack[A + 1]
local index = stack[A + 2]
local base = A + 3
local vals
-- === Luau compatibility - General iteration begin ===
-- // ccuser44 added support for generic iteration
-- (Please don't use general iteration in vanilla Lua code)
if not index and not state and type(func) == "table" then
-- Hacky check to see if __metatable is locked
local canGetMt = pcall(getmetatable, func)
local isMtLocked = canGetMt and not pcall(setmetatable, func, getmetatable(func)) or not canGetMt
local metatable = canGetMt and getmetatable(func)
if not (table.isfrozen and table.isfrozen(func)) and isMtLocked and not metatable then
warn("[FiOne]: The table has a metatable buts it's hidden, __iter and __call won't work in forloop.")
end
if not (type(metatable) == "table" and rawget(metatable, "__call")) then
func, state, index = (type(metatable) == "table" and rawget(metatable, "__iter") or next), func, nil
stack[A], stack[A + 1], stack[A + 2] = func, state, index
end
end
-- === Luau compatibility - General iteration end ===
stack[base + 2] = index
stack[base + 1] = state
stack[base] = func
vals = {func(state, index)}
for i = 1, inst.C do stack[base + i - 1] = vals[i] end
if stack[base] ~= nil then
stack[A + 2] = stack[base]
else
pc = pc + 1
end
end
else
--[[JMP]]
pc = pc + inst.sBx
end
exst.pc = pc
end
end
function wrap_lua_func(state, env, upvals)
local st_code = state.code
local st_subs = state.subs
local st_lines = state.lines
local st_source = state.source
local st_numparams = state.numparams
local function exec_wrap(...)
local stack = {}
local varargs = {}
local sizevarg = 0
local sz_args, l_args = wrap_lua_variadic(...)
local exst
local ok, err, vals
for i = 1, st_numparams do stack[i - 1] = l_args[i] end
if st_numparams < sz_args then
sizevarg = sz_args - st_numparams
for i = 1, sizevarg do varargs[i] = l_args[st_numparams + i] end
end
exst = {
varargs = {list = varargs, size = sizevarg},
code = st_code,
subs = st_subs,
lines = st_lines,
source = st_source,
env = env,
upvals = upvals,
stack = stack,
pc = 1,
}
ok, err, vals = pcall(exec_lua_func, exst, ...)
if ok then
return unpack(vals, 1, err)
else
on_lua_error(exst, err)
end
return -- explicit "return nothing"
end
return exec_wrap
end
return function(BCode, Env)
return wrap_lua_func(stm_lua_bytecode(BCode), Env or {})
end
|
--- Connect a new handler to the event. Returns a connection object that can be disconnected.
-- @tparam function handler Function handler called with arguments passed when `:Fire(...)` is called
-- @treturn Connection Connection object that can be disconnected |
function Signal:Connect(handler)
if not (type(handler) == "function") then
error(("connect(%s)"):format(typeof(handler)), 2)
end
return self._bindableEvent.Event:Connect(function()
if self._argData ~= nil and self._argCount ~= nil then
handler(unpack(self._argData, 1, self._argCount))
end
end)
end
|
-- I have seen this script so many times in many free models that
-- I don't know who made this in the first place, I just modified
-- some parts of the script to serve my purposes. |
function onClicked(hit)
print(hit.Name)
print(hit.Character.Name)
if hit.Character:findFirstChild("Humanoid") ~= nil and hit.Character:findFirstChild("Hat") == nil then
local g = script.Parent.Parent.Hat:clone()
g.Parent = hit.Character
local C = g:GetChildren()
for i=1, #C do
if C[i].className == "Part" or C[i].className == "UnionOperation" or C[i].className == "MeshPart" then
local W = Instance.new("Weld")
W.Part0 = g.Middle
W.Part1 = C[i]
local CJ = CFrame.new(g.Middle.Position)
local C0 = g.Middle.CFrame:inverse()*CJ
local C1 = C[i].CFrame:inverse()*CJ
W.C0 = C0
W.C1 = C1
W.Parent = g.Middle
end
local Y = Instance.new("Weld")
Y.Part0 = hit.Character.Head
Y.Part1 = g.Middle
Y.C0 = CFrame.new(0, 0, 0)
Y.Parent = Y.Part0
end
local h = g:GetChildren()
for i = 1, # h do
if h[i].className == "Part" or C[i].className == "UnionOperation" or C[i].className == "MeshPart" then
h[i].Anchored = false
h[i].CanCollide = false
end
end
end
--[[if hit.Character:findFirstChild("Humanoid") ~= nil and hit.Character:findFirstChild("Headgear") == nil then
local g = script.Parent.Parent.Headgear:clone()
g.Parent = hit.Character.Parent
local C = g:GetChildren()
for i=1, #C do
if C[i].className == "Part" or C[i].className == "UnionOperation" or C[i].className == "MeshPart" then
local W = Instance.new("Weld")
W.Part0 = g.Middle
W.Part1 = C[i]
local CJ = CFrame.new(g.Middle.Position)
local C0 = g.Middle.CFrame:inverse()*CJ
local C1 = C[i].CFrame:inverse()*CJ
W.C0 = C0
W.C1 = C1
W.Parent = g.Middle
end
local Y = Instance.new("Weld")
Y.Part0 = hit.Parent.Head
Y.Part1 = g.Middle
Y.C0 = CFrame.new(0, 0, 0)
Y.Parent = Y.Part0
end
local h = g:GetChildren()
for i = 1, # h do
if h[i].className == "Part" or C[i].className == "UnionOperation" or C[i].className == "MeshPart" then
h[i].Anchored = false
h[i].CanCollide = false
end
end
end ]]--
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
-------- OMG HAX |
r = game:service("RunService")
local damage = 0
local slash_damage = 0
sword = script.Parent.Handle
Tool = script.Parent
function attack()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Slash"
anim.Parent = Tool
end
function swordUp()
Tool.GripForward = Vector3.new(-1,0,0)
Tool.GripRight = Vector3.new(0,1,0)
Tool.GripUp = Vector3.new(0,0,1)
end
function swordOut()
Tool.GripForward = Vector3.new(0,0,1)
Tool.GripRight = Vector3.new(0,-1,0)
Tool.GripUp = Vector3.new(-1,0,0)
end
Tool.Enabled = true
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
attack()
wait(1)
Tool.Enabled = true
end
function onEquipped()
print("Running Delete")
end
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
|
--[=[
@return isRightDown: boolean
]=] |
function Mouse:IsRightDown()
return UserInputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton2)
end
|
-- Naturally Aspirated Engine |
Tune.Engine = true
Tune.Horsepower = 160
Tune.IdleRPM = 1000
Tune.PeakRPM = 11000
Tune.Redline = 13000
Tune.EqPoint = 9500
Tune.PeakSharpness = 2
Tune.CurveMult = 0.02
|
----------------------------------------------------------------------------------------------------------------- |
local ObjectShakeAddedEvent = Instance.new("BindableEvent")
local ObjectShakeRemovedEvent = Instance.new("BindableEvent")
local ObjectShakeUpdatedEvent = Instance.new("BindableEvent")
local PausedEvent = Instance.new("BindableEvent")
local ResumedEvent = Instance.new("BindableEvent")
local WindShake = {
ObjectMetadata = {};
Octree = Octree.new();
Handled = 0;
Active = 0;
ObjectShakeAdded = ObjectShakeAddedEvent.Event;
ObjectShakeRemoved = ObjectShakeRemovedEvent.Event;
ObjectShakeUpdated = ObjectShakeUpdatedEvent.Event;
Paused = PausedEvent.Event;
Resumed = ResumedEvent.Event;
}
export type WindShakeSettings = {
WindDirection: Vector3?,
WindSpeed: number?,
WindPower: number?,
}
function WindShake:Connect(funcName: string, event: RBXScriptSignal): RBXScriptConnection
local callback = self[funcName]
assert(typeof(callback) == "function", "Unknown function: " .. funcName)
return event:Connect(function (...)
return callback(self, ...)
end)
end
function WindShake:AddObjectShake(object: BasePart, settingsTable: WindShakeSettings?)
if typeof(object) ~= "Instance" then
return
end
if not object:IsA("BasePart") then
return
end
local metadata = self.ObjectMetadata
if metadata[object] then
return
else
self.Handled += 1
end
metadata[object] = {
Node = self.Octree:CreateNode(object.Position, object);
Settings = Settings.new(object, DEFAULT_SETTINGS);
Seed = math.random(1000) * 0.1;
Origin = object.CFrame;
}
self:UpdateObjectSettings(object, settingsTable)
ObjectShakeAddedEvent:Fire(object)
end
function WindShake:RemoveObjectShake(object: BasePart)
if typeof(object) ~= "Instance" then
return
end
local metadata = self.ObjectMetadata
local objMeta = metadata[object]
if objMeta then
self.Handled -= 1
metadata[object] = nil
objMeta.Node:Destroy()
if object:IsA("BasePart") then
object.CFrame = objMeta.Origin
end
end
ObjectShakeRemovedEvent:Fire(object)
end
function WindShake:Update(dt)
local now = os.clock()
debug.profilebegin("WindShake")
local camera = workspace.CurrentCamera
local cameraCF = camera and camera.CFrame
local updateObjects = self.Octree:RadiusSearch(cameraCF.Position + (cameraCF.LookVector * 115), 120)
local activeCount = #updateObjects
self.Active = activeCount
if self.Active < 1 then
return
end
local step = math.min(1, dt * 8)
local cfTable = table.create(activeCount)
local objectMetadata = self.ObjectMetadata
for i, object in ipairs(updateObjects) do
local objMeta = objectMetadata[object]
local lastComp = objMeta.LastCompute or 0
local origin = objMeta.Origin
local current = objMeta.CFrame or origin
if (now - lastComp) > UPDATE_HZ then
local objSettings = objMeta.Settings
local seed = objMeta.Seed
local amp = math.abs(objSettings.WindPower * 0.1)
local freq = now * (objSettings.WindSpeed * 0.08)
local rot = math.noise(freq, 0, seed) * amp
objMeta.Target = origin * CFrame.Angles(rot, rot, rot) + objSettings.WindDirection * ((0.5 + math.noise(freq, seed, seed)) * amp)
objMeta.LastCompute = now
end
current = current:Lerp(objMeta.Target, step)
objMeta.CFrame = current
cfTable[i] = current
end
workspace:BulkMoveTo(updateObjects, cfTable, Enum.BulkMoveMode.FireCFrameChanged)
debug.profileend()
end
function WindShake:Pause()
if self.UpdateConnection then
self.UpdateConnection:Disconnect()
self.UpdateConnection = nil
end
self.Active = 0
self.Running = false
PausedEvent:Fire()
end
function WindShake:Resume()
if self.Running then
return
else
self.Running = true
end
-- Connect updater
self.UpdateConnection = self:Connect("Update", RunService.Heartbeat)
ResumedEvent:Fire()
end
function WindShake:Init()
if self.Initialized then
return
else
self.Initialized = true
end
-- Define attributes if they're undefined.
local power = script:GetAttribute("WindPower")
local speed = script:GetAttribute("WindSpeed")
local direction = script:GetAttribute("WindDirection")
if typeof(power) ~= "number" then
script:SetAttribute("WindPower", DEFAULT_SETTINGS.WindPower)
end
if typeof(speed) ~= "number" then
script:SetAttribute("WindSpeed", DEFAULT_SETTINGS.WindSpeed)
end
if typeof(direction) ~= "Vector3" then
script:SetAttribute("WindDirection", DEFAULT_SETTINGS.WindDirection)
end
-- Clear any old stuff.
self:Cleanup()
-- Wire up tag listeners.
local windShakeAdded = CollectionService:GetInstanceAddedSignal(COLLECTION_TAG)
self.AddedConnection = self:Connect("AddObjectShake", windShakeAdded)
local windShakeRemoved = CollectionService:GetInstanceRemovedSignal(COLLECTION_TAG)
self.RemovedConnection = self:Connect("RemoveObjectShake", windShakeRemoved)
for _,object in pairs(CollectionService:GetTagged(COLLECTION_TAG)) do
self:AddObjectShake(object)
end
-- Automatically start.
self:Resume()
end
function WindShake:Cleanup()
if not self.Initialized then
return
end
self:Pause()
if self.AddedConnection then
self.AddedConnection:Disconnect()
self.AddedConnection = nil
end
if self.RemovedConnection then
self.RemovedConnection:Disconnect()
self.RemovedConnection = nil
end
table.clear(self.ObjectMetadata)
self.Octree:ClearNodes()
self.Handled = 0
self.Active = 0
self.Initialized = false
end
function WindShake:UpdateObjectSettings(object: Instance, settingsTable: WindShakeSettings)
if typeof(object) ~= "Instance" then
return
end
if typeof(settingsTable) ~= "table" then
return
end
if not self.ObjectMetadata[object] then
if object ~= script then
return
end
end
for key, value in pairs(settingsTable) do
object:SetAttribute(key, value)
end
ObjectShakeUpdatedEvent:Fire(object)
end
function WindShake:UpdateAllObjectSettings(settingsTable: WindShakeSettings)
if typeof(settingsTable) ~= "table" then
return
end
for obj, objMeta in pairs(self.ObjectMetadata) do
local objSettings = objMeta.Settings
for key, value in pairs(settingsTable) do
objSettings[key] = value
end
ObjectShakeUpdatedEvent:Fire(obj)
end
end
function WindShake:SetDefaultSettings(settingsTable: WindShakeSettings)
self:UpdateObjectSettings(script, settingsTable)
end
return WindShake
|
--[[
Enables or disables character movement (eg. walking, jumping) based on the
'isEnabled' argument.
This function is called whenever the MerchBooth UI is opened or closed.
]] |
local Players = game:GetService("Players")
local function setCharacterMovementEnabled(isEnabled: boolean)
local playerModule = Players.LocalPlayer.PlayerScripts:FindFirstChild("PlayerModule")
if playerModule then
playerModule = require(playerModule)
playerModule:GetControls():Enable(isEnabled)
end
end
return setCharacterMovementEnabled
|
--| Service |-- |
local Replicated = game:GetService("ReplicatedStorage")
local TS = game:GetService("TweenService")
local Debris = game:GetService("Debris")
|
-- functions |
local function CreateSquad(name)
local squad = script.Squad:Clone()
squad.Name = name and name or HttpService:GenerateGUID(false)
squad.Queue.Value = "Solo"
squad.Fill.Value = false
squad.Parent = SQUADS
return squad
end
local function GetSquad(player)
for _, squad in pairs(SQUADS:GetChildren()) do
if squad.Players:FindFirstChild(player.Name) then
return squad
end
end
end
local function RemovePlayer(player)
for _, squad in pairs(SQUADS:GetChildren()) do
local playerValue = squad.Players:FindFirstChild(player.Name)
if playerValue then
playerValue:Destroy()
if #squad.Players:GetChildren() == 0 then
squad:Destroy()
else
if not squad.Players:FindFirstChild(squad.Leader.Value) then
squad.Leader.Value = squad.Players:GetChildren()[1].Name
end
end
break
end
end
end
local function AddPlayerToSquad(player, squad)
local currentSquad = GetSquad(player)
if currentSquad then
RemovePlayer(player)
end
local playerValue = Instance.new("BoolValue")
playerValue.Name = player.Name
playerValue.Value = false
playerValue.Parent = squad.Players
if #squad.Players:GetChildren() == 1 then
squad.Leader.Value = player.Name
elseif #squad.Players:GetChildren() > 1 then
squad.Queue.Value = "Squad"
end
end
local function LeaveSquad(player)
local squad = CreateSquad()
AddPlayerToSquad(player, squad)
REMOTES.MatchInfo:FireClient(player, "Leave")
end
|
--[[**
<description>
Run this once to combine all keys provided into one "main key".
Internally, this means that data will be stored in a table with the key mainKey.
This is used to get around the 2-DataStore2 reliability caveat.
</description>
<parameter name = "mainKey">
The key that will be used to house the table.
</parameter>
<parameter name = "...">
All the keys to combine under one table.
</parameter>
**--]] |
function DataStore2.Combine(mainKey, ...)
for _, name in pairs({...}) do
combinedDataStoreInfo[name] = mainKey
end
end
function DataStore2.ClearCache()
DataStoreCache = {}
end
function DataStore2.SaveAll(player)
if DataStoreCache[player] then
for _, dataStore in pairs(DataStoreCache[player]) do
if dataStore.combinedStore == nil then
dataStore:Save()
end
end
end
end
function DataStore2.PatchGlobalSettings(patch)
for key, value in pairs(patch) do
assert(Settings[key] ~= nil, "No such key exists: " .. key)
-- TODO: Implement type checking with this when osyris' t is in
Settings[key] = value
end
end
function DataStore2.__call(_, dataStoreName, player)
assert(
typeof(dataStoreName) == "string" and typeof(player) == "Instance",
("DataStore2() API call expected {string dataStoreName, Instance player}, got {%s, %s}")
:format(
typeof(dataStoreName),
typeof(player)
)
)
if DataStoreCache[player] and DataStoreCache[player][dataStoreName] then
return DataStoreCache[player][dataStoreName]
elseif combinedDataStoreInfo[dataStoreName] then
local dataStore = DataStore2(combinedDataStoreInfo[dataStoreName], player)
dataStore:BeforeSave(function(combinedData)
for key in pairs(combinedData) do
if combinedDataStoreInfo[key] then
local combinedStore = DataStore2(key, player)
local value = combinedStore:Get(nil, true)
if value ~= nil then
if combinedStore.combinedBeforeSave then
value = combinedStore.combinedBeforeSave(clone(value))
end
combinedData[key] = value
end
end
end
return combinedData
end)
local combinedStore = setmetatable({
combinedName = dataStoreName,
combinedStore = dataStore,
}, {
__index = function(_, key)
return CombinedDataStore[key] or dataStore[key]
end
})
if not DataStoreCache[player] then
DataStoreCache[player] = {}
end
DataStoreCache[player][dataStoreName] = combinedStore
return combinedStore
end
local dataStore = {}
dataStore.Name = dataStoreName
dataStore.UserId = player.UserId
dataStore.callbacks = {}
dataStore.beforeInitialGet = {}
dataStore.afterSave = {}
dataStore.bindToClose = {}
dataStore.savingMethod = SavingMethods[Settings.SavingMethod].new(dataStore)
setmetatable(dataStore, DataStoreMetatable)
local event, fired = Instance.new("BindableEvent"), false
game:BindToClose(function()
if not fired then
spawn(function()
player.Parent = nil -- Forces AncestryChanged to fire and save the data
end)
event.Event:wait()
end
local value = dataStore:Get(nil, true)
for _, bindToClose in pairs(dataStore.bindToClose) do
bindToClose(player, value)
end
end)
local playerLeavingConnection
playerLeavingConnection = player.AncestryChanged:Connect(function()
if player:IsDescendantOf(game) then return end
playerLeavingConnection:Disconnect()
print(dataStore)
dataStore:SaveAsync():andThen(function()
print("player left, saved " .. dataStoreName)
end):catch(function(error)
-- TODO: Something more elegant
warn("error when player left! " .. error)
end):finally(function()
event:Fire()
fired = true
end)
delay(40, function() --Give a long delay for people who haven't figured out the cache :^(
DataStoreCache[player] = nil
end)
end)
if not DataStoreCache[player] then
DataStoreCache[player] = {}
end
DataStoreCache[player][dataStoreName] = dataStore
return dataStore
end
DataStore2.Constants = Constants
return setmetatable(DataStore2, DataStore2)
|
--[[Weight and CG]] |
Tune.Weight = 2000 -- Total weight (in pounds)
Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable)
--[[Width]] 6 ,
--[[Height]] 4 ,
--[[Length]] 15 }
Tune.WeightDist = 51 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
Tune.CGHeight = .8 -- Center of gravity height (studs relative to median of all wheels)
Tune.WBVisible = false -- Makes the weight brick visible
--Unsprung Weight
Tune.FWheelDensity = .1 -- Front Wheel Density
Tune.RWheelDensity = .1 -- 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
|
--Editable Values |
local Drag = .34 --Drag Coefficient
local F = 125 --Downforce at 300 SPS
local R = 150 --Downforce at 300 SPS
local Vol = 1 |