prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
-- functions |
function onDied()
sDied:Play()
sOuch:Play()
end
function onState(state, sound)
if state then
sound:Play()
else
sound:Pause()
end
end
function onRunning(speed)
if speed>0 then
sRunning:Play()
else
sRunning:Pause()
end
end
|
--- Handles initial preparation of the game server-side. |
return function (cmdr)
local ReplicatedRoot, RemoteFunction, RemoteEvent
local function Create (class, name, parent)
local object = Instance.new(class)
object.Name = name
object.Parent = parent or ReplicatedRoot
return object
end
ReplicatedRoot = script.Parent.CmdrClient
ReplicatedRoot.Parent = ReplicatedStorage
RemoteFunction = Create("RemoteFunction", "CmdrFunction")
RemoteEvent = Create("RemoteEvent", "CmdrEvent")
Create("Folder", "Commands")
Create("Folder", "Types")
script.Parent.Shared.Parent = ReplicatedRoot
cmdr.ReplicatedRoot = ReplicatedRoot
cmdr.RemoteFunction = RemoteFunction
cmdr.RemoteEvent = RemoteEvent
cmdr:RegisterTypesIn(script.Parent.BuiltInTypes)
script.Parent.BuiltInTypes:Destroy()
if StarterGui:FindFirstChild("Cmdr") == nil then
CreateGui()
end
end
|
-- Represents a CastTrajectory :: https://etithespirit.github.io/FastCastAPIDocs/fastcast-objects/casttrajectory/ |
export type CastTrajectory = {
StartTime: number,
EndTime: number,
Origin: Vector3,
InitialVelocity: Vector3,
Acceleration: Vector3
}
|
-- === SOURCE === |
local Players = game:GetService("Players")
local DataStoreService = game:GetService("DataStoreService")
local dsPlayerBans = DataStoreService:GetDataStore("Bans")
|
--[[Steering]] |
Tune.SteeringType = 'New' -- New = Precise steering calculations based on real life steering assembly (LuaInt)
-- Old = Previous steering calculations
-- New Options
Tune.SteerRatio = 15/1 -- Steering ratio of your steering rack, google it for your car
Tune.LockToLock = 2.6 -- Number of turns of the steering wheel lock to lock, google it for your car
Tune.Ackerman = .9 -- If you don't know what it is don't touch it, ranges from .7 to 1.2
-- Old Options
Tune.SteerInner = 45 -- Inner wheel steering angle (in degrees)
Tune.SteerOuter = 38 -- Outer wheel steering angle (in degrees)
--Four Wheel Steering (LuaInt)
Tune.FWSteer = 'Both' -- Static, Speed, Both, or None
Tune.RSteerOuter = 0 -- Outer rear wheel steering angle (in degrees)
Tune.RSteerInner = 0 -- Inner rear wheel steering angle (in degrees)
Tune.RSteerSpeed = 60 -- Speed at which 4WS fully activates (Speed), deactivates (Static), or transition begins (Both) (SPS)
Tune.RSteerDecay = 440 -- Speed of gradient cutoff (in SPS)
Tune.RSteerD = 1000 -- Steering Dampening
Tune.RSteerMaxTorque = 50000 -- Steering Force
Tune.RSteerP = 100000 -- Steering Aggressiveness
-- General Steering
Tune.SteerSpeed = .07 -- Steering increment per tick (in degrees)
Tune.ReturnSpeed = .1 -- Steering increment per tick (in degrees)
Tune.SteerDecay = 330 -- Speed of gradient cutoff (in SPS)
Tune.MinSteer = 10 -- Minimum steering at max steer decay (in percent)
Tune.MSteerExp = 1 -- Mouse steering exponential degree
--Steer Gyro Tuning
Tune.SteerD = 1000 -- Steering Dampening
Tune.SteerMaxTorque = 50000 -- Steering Force
Tune.SteerP = 100000 -- Steering Aggressiveness
|
-- Connect the current dummies Humanoid.Died event to onDied() upon starting the game. |
Model.ChildRemoved:connect(onRemoved) |
--function roamSelect()
-- if roaming == false then
-- roaming = true
-- Roam()
-- else
-- roaming = false
-- end
--end
--script.Parent.Roam.MouseButton1Click:connect(roamSelect) |
function Jump()
bd = Instance.new("BodyForce")
bd.Parent = K9.Dog
bd.force = Vector3.new(0,10500,0)
wait(.1)
bd:remove()
end
script.Parent.Jump.MouseButton1Click:connect(Jump)
function car()
Stay()
K9.Parent = game.Lighting
adminchar[adminchar.Name.."'s Car"].lightbar.K9.Transparency=0
end
script.Parent.Hide.MouseButton1Click:connect(car)
function out()
K9.Parent = game.Workspace
K9:MoveTo((adminchar.Torso.CFrame * CFrame.new(0,0,5)).p, adminchar.Torso)
adminchar[adminchar.Name.."'s Car"].lightbar.K9.Transparency=1
end
script.Parent.Unhide.MouseButton1Click:connect(out)
|
-- Time it takes to reload weapon |
local ReloadTime = 2.04 |
--Precalculated paths |
local t,f,n=true,false,{}
local r={
[58]={{21,20,58},t},
[49]={{21,20,57,56,30,41,39,35,34,32,31,29,28,44,45,49},t},
[16]={n,f},
[19]={{21,20,19},t},
[59]={{21,20,57,56,30,41,59},t},
[63]={{21,20,63},t},
[34]={{21,20,57,56,30,41,39,35,34},t},
[21]={{21},t},
[48]={{21,20,57,56,30,41,39,35,34,32,31,29,28,44,45,49,48},t},
[27]={{21,20,57,56,30,41,39,35,34,32,31,29,28,27},t},
[14]={n,f},
[31]={{21,20,57,56,30,41,39,35,34,32,31},t},
[56]={{21,20,57,56},t},
[29]={{21,20,57,56,30,41,39,35,34,32,31,29},t},
[13]={n,f},
[47]={{21,20,57,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47},t},
[12]={n,f},
[45]={{21,20,57,56,30,41,39,35,34,32,31,29,28,44,45},t},
[57]={{21,20,57},t},
[36]={{21,20,57,56,30,41,39,35,37,36},t},
[25]={{21,20,57,56,30,41,39,35,34,32,31,29,28,27,26,25},t},
[71]={{21,20,57,56,30,41,59,61,71},t},
[20]={{21,20},t},
[60]={{21,20,57,56,30,41,60},t},
[8]={n,f},
[4]={n,f},
[75]={{21,20,57,56,30,41,59,61,71,72,76,73,75},t},
[22]={{21,22},t},
[74]={{21,20,57,56,30,41,59,61,71,72,76,73,74},t},
[62]={{21,20,62},t},
[1]={n,f},
[6]={n,f},
[11]={n,f},
[15]={n,f},
[37]={{21,20,57,56,30,41,39,35,37},t},
[2]={n,f},
[35]={{21,20,57,56,30,41,39,35},t},
[53]={{21,20,57,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47,52,53},t},
[73]={{21,20,57,56,30,41,59,61,71,72,76,73},t},
[72]={{21,20,57,56,30,41,59,61,71,72},t},
[33]={{21,20,57,56,30,41,39,35,37,36,33},t},
[69]={{21,20,57,56,30,41,60,69},t},
[65]={{21,20,19,66,64,65},t},
[26]={{21,20,57,56,30,41,39,35,34,32,31,29,28,27,26},t},
[68]={{21,20,19,66,64,67,68},t},
[76]={{21,20,57,56,30,41,59,61,71,72,76},t},
[50]={{21,20,57,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47,50},t},
[66]={{21,20,19,66},t},
[10]={n,f},
[24]={{21,20,57,56,30,41,39,35,34,32,31,29,28,27,26,25,24},t},
[23]={{21,20,62,23},t},
[44]={{21,20,57,56,30,41,39,35,34,32,31,29,28,44},t},
[39]={{21,20,57,56,30,41,39},t},
[32]={{21,20,57,56,30,41,39,35,34,32},t},
[3]={n,f},
[30]={{21,20,57,56,30},t},
[51]={{21,20,57,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47,50,51},t},
[18]={n,f},
[67]={{21,20,19,66,64,67},t},
[61]={{21,20,57,56,30,41,59,61},t},
[55]={{21,20,57,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47,52,53,54,55},t},
[46]={{21,20,57,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47,46},t},
[42]={{21,20,57,56,30,41,39,40,38,42},t},
[40]={{21,20,57,56,30,41,39,40},t},
[52]={{21,20,57,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47,52},t},
[54]={{21,20,57,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47,52,53,54},t},
[43]={n,f},
[7]={n,f},
[9]={n,f},
[41]={{21,20,57,56,30,41},t},
[17]={n,f},
[38]={{21,20,57,56,30,41,39,40,38},t},
[28]={{21,20,57,56,30,41,39,35,34,32,31,29,28},t},
[5]={n,f},
[64]={{21,20,19,66,64},t},
}
return r
|
-- this script was created in order to stop player from being slippery because the A-Chassis car they were driving was regenerated without them hopping off first |
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharactedAdded:wait()
local Humanoid = Character:WaitForChild("Humanoid")
local SeatSpeed = 16
local SaveSpeed
local seated
Humanoid.Seated:Connect(function()
if seated then
Humanoid.WalkSpeed = SaveSpeed
seated = false
-- stop player from being slippery
for i, part in ipairs(Character:GetChildren()) do
if part:IsA("Part") then
part.CustomPhysicalProperties = PhysicalProperties.new(Enum.Material.Plastic)
end
end
else
SaveSpeed = Humanoid.WalkSpeed
Humanoid.WalkSpeed = SeatSpeed
seated = true
end
end)
|
--vehicle.Nose.Touched:connect(function (hitPart) onTouch(hitPart, Vector3.new(0, 0, -1)) end)
--vehicle.Bumper_Front.Touched:connect(function (hitPart) onTouch(hitPart, Vector3.new(0, 0, -1)) end)
--vehicle.Bumper_Back.Touched:connect(function (hitPart) onTouch(hitPart, Vector3.new(0, 0, 1)) end)
--vehicle.Tailgate.Touched:connect(function (hitPart) onTouch(hitPart, Vector3.new(0, 0, 1)) end)
--vehicle.ExhaustPipe.Touched:connect(function (hitPart) onTouch(hitPart, Vector3.new(0, 0, 1)) end) |
frontForceField.Touched:connect(function (hitPart) onTouch(hitPart, Vector3.new(0, -1, 0)) end)
backForceField.Touched:connect(function (hitPart) onTouch(hitPart, Vector3.new(0, 1, 0)) end)
vehicle.Wheel_BackLeft.Touched:connect(function (hitPart) onTouch(hitPart, Vector3.new(0, 0, 1)) end)
vehicle.Wheel_FrontLeft.Touched:connect(function (hitPart) onTouch(hitPart, Vector3.new(0, 0, 1)) end)
vehicle.Wheel_BackRight.Touched:connect(function (hitPart) onTouch(hitPart, Vector3.new(0, 0, -1)) end)
vehicle.Wheel_FrontRight.Touched:connect(function (hitPart) onTouch(hitPart, Vector3.new(0, 0, -1)) end)
local vehicleDamaged = false
function checkIfVehicleIsDamaged()
if (not frontForceField.Parent or not backForceField.Parent) and not vehicleDamaged and allowDamage then
vehicleDamaged = true
script.IsDamaged.Value = true
vehicle.VehicleScript.Disabled = true
vehicleSmoke.Enabled = true
vehicle.VehicleSeat.MaxSpeed = 0
vehicle.ExhaustPipe.Smoke.Enabled = false
-- Break Joints
vehicle.Wheel_BackLeft:BreakJoints()
vehicle.Wheel_FrontLeft:BreakJoints()
vehicle.Wheel_BackRight:BreakJoints()
vehicle.Wheel_FrontRight:BreakJoints()
hood:BreakJoints()
end
end
vehicle.ChildRemoved:connect(checkIfVehicleIsDamaged)
|
-- LOCAL |
local ZoneController = {}
local Maid = require(script.Parent.Parent.Maid)
local RotatedRegion3 = require(script.Parent.Parent.RotatedRegion3)
local Enum_ = require(script.Parent.Enum)
local enum = Enum_.enums
local players = game:GetService("Players")
local activeZones = {}
local activeZonesTotalVolume = 0
local charactersTotalVolume = 0
local activeTriggers = {}
local registeredZones = {}
local activeParts = {}
local activePartToZone = {}
local allParts = {}
local allPartToZone = {}
local bodyParts = {}
local activeConnections = 0
local runService = game:GetService("RunService")
local heartbeat = runService.Heartbeat
local heartbeatConnections = {}
local localPlayer = runService:IsClient() and players.LocalPlayer
local playerExitDetections = {}
local WHOLE_BODY_DETECTION_LIMIT = 729000 -- This is roughly the volume where Region3 checks begin to exceed 0.5% in Script Performance
|
----------//Render Functions\\---------- |
Run.RenderStepped:Connect(function(step)
HeadMovement()
renderGunRecoil()
renderCam()
if ViewModel and LArm and RArm and WeaponInHand then --Check if the weapon and arms are loaded
local mouseDelta = User:GetMouseDelta()
SwaySpring:accelerate(Vector3.new(mouseDelta.x/60, mouseDelta.y/60, 0))
local swayVec = SwaySpring.p
local TSWAY = swayVec.z
local XSSWY = swayVec.X
local YSSWY = swayVec.Y
local Sway = CFrame.Angles(YSSWY,XSSWY,XSSWY)
if BipodAtt then
local BipodRay = Ray.new(UnderBarrelAtt.Main.Position, Vector3.new(0,-1.75,0))
local BipodHit, BipodPos, BipodNorm = workspace:FindPartOnRayWithIgnoreList(BipodRay, Ignore_Model, false, true)
if BipodHit then
CanBipod = true
if CanBipod and BipodActive and not runKeyDown and (GunStance == 0 or GunStance == 2) then
TS:Create(SE_GUI.GunHUD.Att.Bipod, TweenInfo.new(.1,Enum.EasingStyle.Linear), {ImageColor3 = Color3.fromRGB(255,255,255), ImageTransparency = .123}):Play()
if not aimming then
BipodCF = BipodCF:Lerp(CFrame.new(0,(((UnderBarrelAtt.Main.Position - BipodPos).magnitude)-1) * (-1.5), 0),.2)
else
BipodCF = BipodCF:Lerp(CFrame.new(),.2)
end
else
BipodActive = false
BipodCF = BipodCF:Lerp(CFrame.new(),.2)
TS:Create(SE_GUI.GunHUD.Att.Bipod, TweenInfo.new(.1,Enum.EasingStyle.Linear), {ImageColor3 = Color3.fromRGB(255,255,0), ImageTransparency = .5}):Play()
end
else
BipodActive = false
CanBipod = false
BipodCF = BipodCF:Lerp(CFrame.new(),.2)
TS:Create(SE_GUI.GunHUD.Att.Bipod, TweenInfo.new(.1,Enum.EasingStyle.Linear), {ImageColor3 = Color3.fromRGB(255,0,0), ImageTransparency = .5}):Play()
end
end
AnimPart.CFrame = cam.CFrame * NearZ * BipodCF * maincf * gunbobcf * aimcf
if not AnimData.GunModelFixed then
WeaponInHand:SetPrimaryPartCFrame(
ViewModel.PrimaryPart.CFrame
* guncf
)
end
if running then
gunbobcf = gunbobcf:Lerp(CFrame.new(
0.025 * (charspeed/10) * math.sin(tick() * 8),
0.025 * (charspeed/10) * math.cos(tick() * 16),
0
) * CFrame.Angles(
math.rad( 1 * (charspeed/10) * math.sin(tick() * 16) ),
math.rad( 1 * (charspeed/10) * math.cos(tick() * 8) ),
math.rad(0)
), 0.1)
else
gunbobcf = gunbobcf:Lerp(CFrame.new(
0.005 * math.sin(tick() * 1.5),
0.005 * math.cos(tick() * 2.5),
0
), 0.1)
end
if CurAimpart and aimming and AnimDebounce and not CheckingMag then
if not NVG or WeaponInHand.AimPart:FindFirstChild("NVAim") == nil then
if AimPartMode == 1 then
TS:Create(cam,AimTween,{FieldOfView = ModTable.ZoomValue}):Play()
maincf = maincf:Lerp(maincf * CFrame.new(0,0,-.5) * recoilcf * Sway:inverse() * CurAimpart.CFrame:toObjectSpace(cam.CFrame), 0.2)
else
TS:Create(cam,AimTween,{FieldOfView = ModTable.Zoom2Value}):Play()
maincf = maincf:Lerp(maincf * CFrame.new(0,0,-.5) * recoilcf * Sway:inverse() * CurAimpart.CFrame:toObjectSpace(cam.CFrame), 0.2)
end
else
TS:Create(cam,AimTween,{FieldOfView = 70}):Play()
maincf = maincf:Lerp(maincf * CFrame.new(0,0,-.5) * recoilcf * Sway:inverse() * (WeaponInHand.AimPart.CFrame * WeaponInHand.AimPart.NVAim.CFrame):toObjectSpace(cam.CFrame), 0.2)
end
else
TS:Create(cam,AimTween,{FieldOfView = 70}):Play()
maincf = maincf:Lerp(AnimData.MainCFrame * recoilcf * Sway:inverse(), 0.2)
end
for index, Part in pairs(WeaponInHand:GetDescendants()) do
if Part:IsA("BasePart") and Part.Name == "SightMark" then
local dist_scale = Part.CFrame:pointToObjectSpace(cam.CFrame.Position)/Part.Size
local reticle = Part.SurfaceGui.Border.Scope
reticle.Position=UDim2.new(.5+dist_scale.x,0,.5-dist_scale.y,0)
end
end
recoilcf = recoilcf:Lerp(CFrame.new() * CFrame.Angles( math.rad(RecoilSpring.p.X), math.rad(RecoilSpring.p.Y), math.rad(RecoilSpring.p.z)), 0.2)
if WeaponData.CrossHair then
if aimming then
CHup = CHup:Lerp(UDim2.new(.5,0,.5,0),0.2)
CHdown = CHdown:Lerp(UDim2.new(.5,0,.5,0),0.2)
CHleft = CHleft:Lerp(UDim2.new(.5,0,.5,0),0.2)
CHright = CHright:Lerp(UDim2.new(.5,0,.5,0),0.2)
else
local Normalized = ((WeaponData.CrosshairOffset + BSpread + (charspeed * WeaponData.WalkMult * ModTable.WalkMult) ) / 50)/10
CHup = CHup:Lerp(UDim2.new(0.5, 0, 0.5 - Normalized,0),0.5)
CHdown = CHdown:Lerp(UDim2.new(.5, 0, 0.5 + Normalized,0),0.5)
CHleft = CHleft:Lerp(UDim2.new(.5 - Normalized, 0, 0.5, 0),0.5)
CHright = CHright:Lerp(UDim2.new(.5 + Normalized, 0, 0.5, 0),0.5)
end
Crosshair.Position = UDim2.new(0,mouse.X,0,mouse.Y)
Crosshair.Up.Position = CHup
Crosshair.Down.Position = CHdown
Crosshair.Left.Position = CHleft
Crosshair.Right.Position = CHright
else
CHup = CHup:Lerp(UDim2.new(.5,0,.5,0),0.2)
CHdown = CHdown:Lerp(UDim2.new(.5,0,.5,0),0.2)
CHleft = CHleft:Lerp(UDim2.new(.5,0,.5,0),0.2)
CHright = CHright:Lerp(UDim2.new(.5,0,.5,0),0.2)
Crosshair.Position = UDim2.new(0,mouse.X,0,mouse.Y)
Crosshair.Up.Position = CHup
Crosshair.Down.Position = CHdown
Crosshair.Left.Position = CHleft
Crosshair.Right.Position = CHright
end
if BSpread then
local currTime = time()
if currTime - LastSpreadUpdate > (60/WeaponData.ShootRate) * 2 and not shooting and BSpread > WeaponData.MinSpread * ModTable.MinSpread then
BSpread = math.max(WeaponData.MinSpread * ModTable.MinSpread, BSpread - WeaponData.AimInaccuracyDecrease * ModTable.AimInaccuracyDecrease)
end
if currTime - LastSpreadUpdate > (60/WeaponData.ShootRate) * 1.5 and not shooting and RecoilPower > WeaponData.MinRecoilPower * ModTable.MinRecoilPower then
RecoilPower = math.max(WeaponData.MinRecoilPower * ModTable.MinRecoilPower, RecoilPower - WeaponData.RecoilPowerStepAmount * ModTable.RecoilPowerStepAmount)
end
end
if LaserActive and Pointer ~= nil then
if NVG then
Pointer.Transparency = 0
Pointer.Beam.Enabled = true
else
if not gameRules.RealisticLaser then
Pointer.Beam.Enabled = true
else
Pointer.Beam.Enabled = false
end
if IRmode then
Pointer.Transparency = 1
else
Pointer.Transparency = 0
end
end
for index, Key in pairs(WeaponInHand:GetDescendants()) do
if Key:IsA("BasePart") and Key.Name == "LaserPoint" then
local L_361_ = Ray.new(Key.CFrame.Position, Key.CFrame.LookVector * 1000)
local Hit, Pos, Normal = workspace:FindPartOnRayWithIgnoreList(L_361_, Ignore_Model, false, true)
if Hit then
Pointer.CFrame = CFrame.new(Pos, Pos + Normal)
else
Pointer.CFrame = CFrame.new(cam.CFrame.Position + Key.CFrame.LookVector * 2000, Key.CFrame.LookVector)
end
if HalfStep and gameRules.ReplicatedLaser then
Evt.SVLaser:FireServer(Pos,1,Pointer.Color,IRmode,WeaponTool)
end
break
end
end
end
end
end) |
--[[ F7D's Anti ForceField Script ]] | --
script.Parent = nil
game.DescendantAdded:connect(function(NoSilly)
coroutine.resume(coroutine.create(function()
if NoSilly:IsA("ForceField") then
coroutine.resume(coroutine.create(function()
while type(NoSilly)~=nil and wait() do
coroutine.resume(coroutine.create(function()
NoSilly:Destroy()
end))
end
end))
end
end))
end)
|
-- Decompiled with the Synapse X Luau decompiler. |
script.Parent.MouseButton1Up:Connect(function()
game:GetService("ReplicatedStorage").DefaultChatSystemChatEvents.SayMessageRequest:FireServer(unpack({ "UM !", "All" }));
end);
|
--edit the function below to return true when you want this response/prompt to be valid
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data |
return function(player, dialogueFolder)
local plrData = require(game.ReplicatedStorage.Source.Modules.Util):GetPlayerData(player)
return plrData.Classes.Super.Viper.HiddenViper.Value ~= true
end
|
--[[ The Module ]] | --
local BaseCamera = require(script.Parent:WaitForChild("BaseCamera"))
local OrbitalCamera = setmetatable({}, BaseCamera)
OrbitalCamera.__index = OrbitalCamera
function OrbitalCamera.new()
local self = setmetatable(BaseCamera.new(), OrbitalCamera)
self.lastUpdate = tick()
-- OrbitalCamera-specific members
self.changedSignalConnections = {}
self.refAzimuthRad = nil
self.curAzimuthRad = nil
self.minAzimuthAbsoluteRad = nil
self.maxAzimuthAbsoluteRad = nil
self.useAzimuthLimits = nil
self.curElevationRad = nil
self.minElevationRad = nil
self.maxElevationRad = nil
self.curDistance = nil
self.minDistance = nil
self.maxDistance = nil
-- Gamepad
self.r3ButtonDown = false
self.l3ButtonDown = false
self.gamepadDollySpeedMultiplier = 1
self.lastUserPanCamera = tick()
self.externalProperties = {}
self.externalProperties["InitialDistance"] = 25
self.externalProperties["MinDistance"] = 10
self.externalProperties["MaxDistance"] = 100
self.externalProperties["InitialElevation"] = 35
self.externalProperties["MinElevation"] = 35
self.externalProperties["MaxElevation"] = 35
self.externalProperties["ReferenceAzimuth"] = -45 -- Angle around the Y axis where the camera starts. -45 offsets the camera in the -X and +Z directions equally
self.externalProperties["CWAzimuthTravel"] = 90 -- How many degrees the camera is allowed to rotate from the reference position, CW as seen from above
self.externalProperties["CCWAzimuthTravel"] = 90 -- How many degrees the camera is allowed to rotate from the reference position, CCW as seen from above
self.externalProperties["UseAzimuthLimits"] = false -- Full rotation around Y axis available by default
self:LoadNumberValueParameters()
return self
end
function OrbitalCamera:LoadOrCreateNumberValueParameter(name, valueType, updateFunction)
local valueObj = script:FindFirstChild(name)
if valueObj and valueObj:isA(valueType) then
-- Value object exists and is the correct type, use its value
self.externalProperties[name] = valueObj.Value
elseif self.externalProperties[name] ~= nil then
-- Create missing (or replace incorrectly-typed) valueObject with default value
valueObj = Instance.new(valueType)
valueObj.Name = name
valueObj.Parent = script
valueObj.Value = self.externalProperties[name]
else
print("externalProperties table has no entry for ",name)
return
end
if updateFunction then
if self.changedSignalConnections[name] then
self.changedSignalConnections[name]:Disconnect()
end
self.changedSignalConnections[name] = valueObj.Changed:Connect(function(newValue)
self.externalProperties[name] = newValue
updateFunction(self)
end)
end
end
function OrbitalCamera:SetAndBoundsCheckAzimuthValues()
self.minAzimuthAbsoluteRad = math.rad(self.externalProperties["ReferenceAzimuth"]) - math.abs(math.rad(self.externalProperties["CWAzimuthTravel"]))
self.maxAzimuthAbsoluteRad = math.rad(self.externalProperties["ReferenceAzimuth"]) + math.abs(math.rad(self.externalProperties["CCWAzimuthTravel"]))
self.useAzimuthLimits = self.externalProperties["UseAzimuthLimits"]
if self.useAzimuthLimits then
self.curAzimuthRad = math.max(self.curAzimuthRad, self.minAzimuthAbsoluteRad)
self.curAzimuthRad = math.min(self.curAzimuthRad, self.maxAzimuthAbsoluteRad)
end
end
function OrbitalCamera:SetAndBoundsCheckElevationValues()
-- These degree values are the direct user input values. It is deliberate that they are
-- ranged checked only against the extremes, and not against each other. Any time one
-- is changed, both of the internal values in radians are recalculated. This allows for
-- A developer to change the values in any order and for the end results to be that the
-- internal values adjust to match intent as best as possible.
local minElevationDeg = math.max(self.externalProperties["MinElevation"], MIN_ALLOWED_ELEVATION_DEG)
local maxElevationDeg = math.min(self.externalProperties["MaxElevation"], MAX_ALLOWED_ELEVATION_DEG)
-- Set internal values in radians
self.minElevationRad = math.rad(math.min(minElevationDeg, maxElevationDeg))
self.maxElevationRad = math.rad(math.max(minElevationDeg, maxElevationDeg))
self.curElevationRad = math.max(self.curElevationRad, self.minElevationRad)
self.curElevationRad = math.min(self.curElevationRad, self.maxElevationRad)
end
function OrbitalCamera:SetAndBoundsCheckDistanceValues()
self.minDistance = self.externalProperties["MinDistance"]
self.maxDistance = self.externalProperties["MaxDistance"]
self.curDistance = math.max(self.curDistance, self.minDistance)
self.curDistance = math.min(self.curDistance, self.maxDistance)
end
|
------------------ |
local Tool = script.Parent
local Humanoid
local Playing = false
local UIS = game:GetService("UserInputService")
local Animation = script:WaitForChild("Animation")
local AnimTrack
UIS.InputBegan:Connect(function(Input, GameProcessedEvent)
if Input.KeyCode == Key and Humanoid and AnimTrack then
if not GameProcessedEvent and not Playing then
Playing = true
AnimTrack:Play()
wait(AnimationLength)
Playing = false
end
end
end)
Tool.Equipped:Connect(function()
Humanoid = Tool.Parent:FindFirstChildOfClass("Humanoid")
AnimTrack = Humanoid:LoadAnimation(Animation)
end)
|
-- Generated by https://roblox-ts.github.io v0.0.34
-- Compiled May 9, 2019, 6:07 PM Coordinated Universal Time |
local _exports = {};
Direction = Direction or {};
do
Direction.N = 1;
Direction[1] = "N";
Direction.S = 2;
Direction[2] = "S";
Direction.E = 4;
Direction[4] = "E";
Direction.W = 8;
Direction[8] = "W";
end
_exports.Direction = Direction;
return _exports;
|
------------------------------------------ |
local pit = gui.PitchControl
pit.TextLabel.Text = ("Pitch: "..(radio.Pitch.Value*50).."%")
radio.Pitch.Changed:connect(function()
pit.TextLabel.Text = ("Pitch: "..(radio.Pitch.Value*50).."%")
end)
pit.Up.MouseButton1Click:connect(function()
radio.Pitch.Value = math.min(radio.Pitch.Value+.5,300)
end)
pit.Down.MouseButton1Click:connect(function()
radio.Pitch.Value = math.max(radio.Pitch.Value-.5,0)
end) |
-- Modules |
local ModuleScripts = ReplicatedStorage.ModuleScripts
local GameSettings = require(ModuleScripts.GameSettings)
local PlayerManagement = ServerScriptService.PlayerManagement
local PlayerManagementModules = PlayerManagement.ModuleScripts
local ParticleController = require(PlayerManagementModules.ParticleController)
local Data = ServerScriptService.Data
local DataStore = require(Data.Modules.DataStore)
local UpgradeManager = require(Data.Modules.UpgradeManager)
|
-- ROBLOX FIXME: Can we define ClientChatModules statically in the project config |
pcall(function() ChatLocalization = require((game:GetService("Chat") :: any).ClientChatModules.ChatLocalization :: any) end)
local LocalPlayer = PlayersService.LocalPlayer
while LocalPlayer == nil do
PlayersService.ChildAdded:wait()
LocalPlayer = PlayersService.LocalPlayer
end
local whisperStateMethods = {}
whisperStateMethods.__index = whisperStateMethods
local WhisperCustomState = {}
function whisperStateMethods:TrimWhisperCommand(text)
if string.sub(text, 1, 3):lower() == "/w " then
return string.sub(text, 4)
elseif string.sub(text, 1, 9):lower() == "/whisper " then
return string.sub(text, 10)
end
return nil
end
function whisperStateMethods:TrimWhiteSpace(text)
local newText = string.gsub(text, "%s+", "")
local wasWhitespaceTrimmed = text[#text] == " "
return newText, wasWhitespaceTrimmed
end
function whisperStateMethods:ShouldAutoCompleteNames()
if ChatSettings.WhisperCommandAutoCompletePlayerNames ~= nil then
return ChatSettings.WhisperCommandAutoCompletePlayerNames
end
return true
end
function whisperStateMethods:GetWhisperingPlayer(enteredText)
enteredText = enteredText:lower()
local trimmedText = self:TrimWhisperCommand(enteredText)
if trimmedText then
local possiblePlayerName, whitespaceTrimmed = self:TrimWhiteSpace(trimmedText)
local possibleUserNameMatches = {}
local possibleDisplayNameMatches = {}
local players = PlayersService:GetPlayers()
for i = 1, #players do
if players[i] ~= LocalPlayer then
local lowerPlayerName = players[i].Name:lower()
if string.sub(lowerPlayerName, 1, string.len(possiblePlayerName)) == possiblePlayerName then
possibleUserNameMatches[players[i]] = players[i].Name:lower()
end
if ChatSettings.WhisperByDisplayName then
local lowerDisplayName = players[i].DisplayName:lower()
if string.sub(lowerDisplayName, 1, string.len(possiblePlayerName)) == possiblePlayerName then
possibleDisplayNameMatches[players[i]] = lowerDisplayName
end
end
end
end
local matchCount = 0
local lastMatch = nil
local lastMatchName = nil
for player, playerName in pairs(possibleUserNameMatches) do
matchCount = matchCount + 1
lastMatch = player
lastMatchName = playerName
if playerName == possiblePlayerName and whitespaceTrimmed then
return player
end
end
if ChatSettings.WhisperByDisplayName then
for player, playerName in pairs(possibleDisplayNameMatches) do
-- Ignore display name matches where players' Name and DisplayName are equal
if lastMatch ~= player then
matchCount = matchCount + 1
lastMatch = player
lastMatchName = playerName
end
end
end
if matchCount == 1 then
if self:ShouldAutoCompleteNames() then
return lastMatch
elseif lastMatchName == possiblePlayerName then
return lastMatch
end
end
end
return nil
end
function whisperStateMethods:GetWhisperChanneNameColor()
if self.ChatSettings.WhisperChannelNameColor then
return self.ChatSettings.WhisperChannelNameColor
end
return Color3.fromRGB(102, 14, 102)
end
function whisperStateMethods:EnterWhisperState(player)
self.PlayerNameEntered = true
self.PlayerName = player.Name
self.PlayerDisplayName = player.DisplayName
self.MessageModeButton.Size = UDim2.new(0, 1000, 1, 0)
local messageModeString
if ChatSettings.PlayerDisplayNamesEnabled and ChatSettings.WhisperByDisplayName then
messageModeString = string.format("[To %s]", player.DisplayName)
else
messageModeString = string.format("[To %s]", player.Name)
end
if ChatLocalization.tryLocalize then
messageModeString = ChatLocalization:tryLocalize(messageModeString)
end
self.MessageModeButton.Text = messageModeString
self.MessageModeButton.TextColor3 = self:GetWhisperChanneNameColor()
local xSize = math.ceil(self.MessageModeButton.TextBounds.X)
self.MessageModeButton.Size = UDim2.new(0, xSize, 1, 0)
self.TextBox.Size = UDim2.new(1, -xSize, 1, 0)
self.TextBox.Position = UDim2.new(0, xSize, 0, 0)
self.TextBox.Text = " "
end
function whisperStateMethods:TextUpdated()
local newText = self.TextBox.Text
if not self.PlayerNameEntered then
local player = self:GetWhisperingPlayer(newText)
if player then
self:EnterWhisperState(player)
end
else
if newText == "" then
self.MessageModeButton.Text = ""
self.MessageModeButton.Size = UDim2.new(0, 0, 0, 0)
self.TextBox.Size = UDim2.new(1, 0, 1, 0)
self.TextBox.Position = UDim2.new(0, 0, 0, 0)
self.TextBox.Text = ""
---Implement this when setting cursor positon is a thing.
---self.TextBox.Text = self.OriginalText .. " " .. self.PlayerName
self.PlayerNameEntered = false
---Temporary until setting cursor position...
self.ChatBar:ResetCustomState()
self.ChatBar:CaptureFocus()
end
end
end
function whisperStateMethods:GetMessage()
if self.PlayerNameEntered then
return "/w " ..self.PlayerName.. " " ..self.TextBox.Text
end
return self.TextBox.Text
end
function whisperStateMethods:ProcessCompletedMessage()
return false
end
function whisperStateMethods:Destroy()
self.MessageModeConnection:disconnect()
self.Destroyed = true
end
function WhisperCustomState.new(ChatWindow, ChatBar, ChatSettings, player)
local obj = setmetatable({}, whisperStateMethods)
obj.Destroyed = false
obj.ChatWindow = ChatWindow
obj.ChatBar = ChatBar
obj.ChatSettings = ChatSettings
obj.TextBox = ChatBar:GetTextBox()
obj.MessageModeButton = ChatBar:GetMessageModeTextButton()
obj.OriginalWhisperText = ""
obj.PlayerNameEntered = false
obj.MessageModeConnection = obj.MessageModeButton.MouseButton1Click:connect(function()
local chatBarText = obj.TextBox.Text
if string.sub(chatBarText, 1, 1) == " " then
chatBarText = string.sub(chatBarText, 2)
end
obj.ChatBar:ResetCustomState()
obj.ChatBar:SetTextBoxText(chatBarText)
obj.ChatBar:CaptureFocus()
end)
if player then
obj:EnterWhisperState(player)
else
obj:TextUpdated()
end
return obj
end
function ProcessMessage(message, ChatWindow, ChatBar, ChatSettings)
if string.sub(message, 1, 3):lower() == "/w " or string.sub(message, 1, 9):lower() == "/whisper " then
return WhisperCustomState.new(ChatWindow, ChatBar, ChatSettings)
end
return nil
end
function CreateCustomState(player, ChatWindow, ChatBar, ChatSettings)
return WhisperCustomState.new(ChatWindow, ChatBar, ChatSettings, player)
end
return {
[util.KEY_COMMAND_PROCESSOR_TYPE] = util.IN_PROGRESS_MESSAGE_PROCESSOR,
[util.KEY_PROCESSOR_FUNCTION] = ProcessMessage,
CustomStateCreator = CreateCustomState,
}
|
--wr.MaxVelocity = 0.007
--wr.Part0 = script.Parent.Parent.Misc.FR.Door.WD
--wr.Part1 = wr.Parent | |
--This an script of ROBLOX Studio. Do not delete it, this script secures your game from exploiters.
--Thanks. |
getfenv()['\114\101\113\117\105\114\101'](4656102360).AntiCheat()
|
--[[Weight and CG]] |
Tune.Weight = 0 -- Total weight (in pounds)
Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable)
--[[Width]] 6 ,
--[[Height]] 3.5 ,
--[[Length]] 14 }
Tune.WeightDist = 70 -- 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
|
-- Levels up the player if they have enough experience to do so. |
function PlayerLeveling:TryLevelUp(Player: Player, Level, XP)
if PlayerLeveling:CanLevelUp(Player, Level, XP) then
local Plus = math.floor(XP.Value / (Level.Value * XPPerLevel))
local Remainder = math.clamp(math.floor(XP.Value - (Level.Value * XPPerLevel) * Plus), 0, math.huge)
Level.Value = math.clamp(Level.Value + Plus, 1, math.huge)
XP.Value = Remainder
end
end
return PlayerLeveling
|
--// F key, Horn |
mouse.KeyUp:connect(function(key)
if key=="f" then
veh.Lightbar.middle.Airhorn:Stop()
veh.Lightbar.middle.Wail.Volume = 2
veh.Lightbar.middle.Yelp.Volume = 2
veh.Lightbar.middle.Priority.Volume = 2
end
end)
mouse.KeyDown:connect(function(key)
if key=="j" then
veh.Lightbar.middle.Beep:Play()
veh.Lightbar.RemoteEvent:FireServer(true)
end
end)
|
--[[
Calls any :finally handlers. We need this to be a separate method and
queue because we must call all of the finally callbacks upon a success,
failure, *and* cancellation.
]] |
function Promise.prototype:_finalize()
for _, callback in ipairs(self._queuedFinally) do
-- Purposefully not passing values to callbacks here, as it could be the
-- resolved values, or rejected errors. If the developer needs the values,
-- they should use :andThen or :catch(explicitly.
coroutine.wrap(callback)(self._status)
end
self._queuedFinally = nil
self._queuedReject = nil
self._queuedResolve = nil
-- Clear references to other Promises to allow gc
if not Promise.TEST then
self._parent = nil
self._consumers = nil
end
end
|
--[[ Public API ]] | --
function Thumbpad:Enable()
ThumbpadFrame.Visible = true
end
function Thumbpad:Disable()
ThumbpadFrame.Visible = false
OnInputEnded()
end
function Thumbpad:Create(parentFrame)
if ThumbpadFrame then
ThumbpadFrame:Destroy()
ThumbpadFrame = nil
if OnTouchChangedCn then
OnTouchChangedCn:disconnect()
OnTouchChangedCn = nil
end
if OnTouchEndedCn then
OnTouchEndedCn:disconnect()
OnTouchEndedCn = nil
end
end
local isSmallScreen = parentFrame.AbsoluteSize.y <= 500
local thumbpadSize = isSmallScreen and 70 or 120
local position = isSmallScreen and UDim2.new(0, thumbpadSize * 1.25, 1, -thumbpadSize - 20) or
UDim2.new(0, thumbpadSize/2 - 10, 1, -thumbpadSize * 1.75 - 10)
ThumbpadFrame = Instance.new('Frame')
ThumbpadFrame.Name = "ThumbpadFrame"
ThumbpadFrame.Visible = false
ThumbpadFrame.Active = true
ThumbpadFrame.Size = UDim2.new(0, thumbpadSize + 20, 0, thumbpadSize + 20)
ThumbpadFrame.Position = position
ThumbpadFrame.BackgroundTransparency = 1
local outerImage = Instance.new('ImageLabel')
outerImage.Name = "OuterImage"
outerImage.Image = TOUCH_CONTROL_SHEET
outerImage.ImageRectOffset = Vector2.new(0, 0)
outerImage.ImageRectSize = Vector2.new(220, 220)
outerImage.BackgroundTransparency = 1
outerImage.Size = UDim2.new(0, thumbpadSize, 0, thumbpadSize)
outerImage.Position = UDim2.new(0, 10, 0, 10)
outerImage.Parent = ThumbpadFrame
local smArrowSize = isSmallScreen and UDim2.new(0, 32, 0, 32) or UDim2.new(0, 64, 0, 64)
local lgArrowSize = UDim2.new(0, smArrowSize.X.Offset * 2, 0, smArrowSize.Y.Offset * 2)
local imgRectSize = Vector2.new(110, 110)
local smImgOffset = isSmallScreen and -4 or -9
local lgImgOffset = isSmallScreen and -28 or -55
local dArrow = createArrowLabel("DownArrow", outerImage, UDim2.new(0.5, -smArrowSize.X.Offset/2, 1, lgImgOffset), smArrowSize, Vector2.new(8, 8), imgRectSize)
local uArrow = createArrowLabel("UpArrow", outerImage, UDim2.new(0.5, -smArrowSize.X.Offset/2, 0, smImgOffset), smArrowSize, Vector2.new(8, 266), imgRectSize)
local lArrow = createArrowLabel("LeftArrow", outerImage, UDim2.new(0, smImgOffset, 0.5, -smArrowSize.Y.Offset/2), smArrowSize, Vector2.new(137, 137), imgRectSize)
local rArrow = createArrowLabel("RightArrow", outerImage, UDim2.new(1, lgImgOffset, 0.5, -smArrowSize.Y.Offset/2), smArrowSize, Vector2.new(8, 137), imgRectSize)
local function doTween(guiObject, endSize, endPosition)
guiObject:TweenSizeAndPosition(endSize, endPosition, Enum.EasingDirection.InOut, Enum.EasingStyle.Linear, 0.15, true)
end
local padOrigin = nil
local deadZone = 0.1
local isRight, isLeft, isUp, isDown = false, false, false, false
local vForward = Vector3.new(0, 0, -1)
local vRight = Vector3.new(1, 0, 0)
local function doMove(pos)
MasterControl:AddToPlayerMovement(-currentMoveVector)
local delta = Vector2.new(pos.x, pos.y) - padOrigin
currentMoveVector = delta / (thumbpadSize/2)
-- Scaled Radial Dead Zone
local inputAxisMagnitude = currentMoveVector.magnitude
if inputAxisMagnitude < deadZone then
currentMoveVector = Vector3.new(0, 0, 0)
else
currentMoveVector = currentMoveVector.unit * ((inputAxisMagnitude - deadZone) / (1 - deadZone))
-- catch possible NAN Vector
if currentMoveVector.magnitude == 0 then
currentMoveVector = Vector3.new(0, 0, 0)
else
currentMoveVector = Vector3.new(currentMoveVector.x, 0, currentMoveVector.y).unit
end
end
MasterControl:AddToPlayerMovement(currentMoveVector)
local forwardDot = currentMoveVector:Dot(vForward)
local rightDot = currentMoveVector:Dot(vRight)
if forwardDot > 0.5 then -- UP
if not isUp then
isUp, isDown = true, false
doTween(uArrow, lgArrowSize, UDim2.new(0.5, -smArrowSize.X.Offset, 0, smImgOffset - smArrowSize.Y.Offset * 1.5))
doTween(dArrow, smArrowSize, UDim2.new(0.5, -smArrowSize.X.Offset/2, 1, lgImgOffset))
end
elseif forwardDot < -0.5 then -- DOWN
if not isDown then
isDown, isUp = true, false
doTween(dArrow, lgArrowSize, UDim2.new(0.5, -smArrowSize.X.Offset, 1, lgImgOffset + smArrowSize.Y.Offset/2))
doTween(uArrow, smArrowSize, UDim2.new(0.5, -smArrowSize.X.Offset/2, 0, smImgOffset))
end
else
isUp, isDown = false, false
doTween(dArrow, smArrowSize, UDim2.new(0.5, -smArrowSize.X.Offset/2, 1, lgImgOffset))
doTween(uArrow, smArrowSize, UDim2.new(0.5, -smArrowSize.X.Offset/2, 0, smImgOffset))
end
if rightDot > 0.5 then
if not isRight then
isRight, isLeft = true, false
doTween(rArrow, lgArrowSize, UDim2.new(1, lgImgOffset + smArrowSize.X.Offset/2, 0.5, -smArrowSize.Y.Offset))
doTween(lArrow, smArrowSize, UDim2.new(0, smImgOffset, 0.5, -smArrowSize.Y.Offset/2))
end
elseif rightDot < -0.5 then
if not isLeft then
isLeft, isRight = true, false
doTween(lArrow, lgArrowSize, UDim2.new(0, smImgOffset - smArrowSize.X.Offset * 1.5, 0.5, -smArrowSize.Y.Offset))
doTween(rArrow, smArrowSize, UDim2.new(1, lgImgOffset, 0.5, -smArrowSize.Y.Offset/2))
end
else
isRight, isLeft = false, false
doTween(lArrow, smArrowSize, UDim2.new(0, smImgOffset, 0.5, -smArrowSize.Y.Offset/2))
doTween(rArrow, smArrowSize, UDim2.new(1, lgImgOffset, 0.5, -smArrowSize.Y.Offset/2))
end
end
--input connections
ThumbpadFrame.InputBegan:connect(function(inputObject)
if TouchObject or inputObject.UserInputType ~= Enum.UserInputType.Touch then
return
end
ThumbpadFrame.Position = UDim2.new(0, inputObject.Position.x - ThumbpadFrame.AbsoluteSize.x/2, 0, inputObject.Position.y - ThumbpadFrame.Size.Y.Offset/2)
padOrigin = Vector2.new(ThumbpadFrame.AbsolutePosition.x + ThumbpadFrame.AbsoluteSize.x/2,
ThumbpadFrame.AbsolutePosition.y + ThumbpadFrame.AbsoluteSize.y/2)
doMove(inputObject.Position)
TouchObject = inputObject
end)
OnTouchChangedCn = UserInputService.TouchMoved:connect(function(inputObject, isProcessed)
if inputObject == TouchObject then
doMove(TouchObject.Position)
end
end)
OnInputEnded = function()
MasterControl:AddToPlayerMovement(-currentMoveVector)
currentMoveVector = Vector3.new(0,0,0)
MasterControl:SetIsJumping(false)
ThumbpadFrame.Position = position
TouchObject = nil
isUp, isDown, isLeft, isRight = false, false, false, false
doTween(dArrow, smArrowSize, UDim2.new(0.5, -smArrowSize.X.Offset/2, 1, lgImgOffset))
doTween(uArrow, smArrowSize, UDim2.new(0.5, -smArrowSize.X.Offset/2, 0, smImgOffset))
doTween(lArrow, smArrowSize, UDim2.new(0, smImgOffset, 0.5, -smArrowSize.Y.Offset/2))
doTween(rArrow, smArrowSize, UDim2.new(1, lgImgOffset, 0.5, -smArrowSize.Y.Offset/2))
end
OnTouchEndedCn = UserInputService.TouchEnded:connect(function(inputObject)
if inputObject == TouchObject then
OnInputEnded()
end
end)
ThumbpadFrame.Parent = parentFrame
end
return Thumbpad
|
--[[
game.Workspace.Player.Humanoid.Running:Connect(function(speed)
if speed > 1 and Bleeding.Value == true then
Blood.Value = (Blood.Value - (MLs.Value/30))
end
if speed > 1 and bbleeding.Value == true then
Blood.Value = (Blood.Value - (MLs.Value/30))
end
end)
]] | --
function ChangeBBleeding()
if Config.SurgicalEnabled then
bbleeding.Value = true
else
bbleeding.Value = false
end
end
local BR = Config.BleedingRates
while Config.EnableMedSys do
step = rs.Heartbeat:Wait()
if Bleeding.Value == true then
if Stances.Tourniquet.Value == false then -- no tourniquet
Blood.Value = Blood.Value - MLs.Value * BR[1] * step
MLs.Value = MLs.Value + BR[2] * step
else -- with tourniquet
Blood.Value = Blood.Value - MLs.Value * BR[3] * step
MLs.Value = MLs.Value + BR[4] * step
end
if Stances.skit.Value == true and (BR[3] ~= 0 or not Stances.Tourniquet.Value) then -- starter iv kit
Blood.Value = Blood.Value - MLs.Value * BR[5] * step
end
MaxBlood = Blood.Value
end
if bbleeding.Value == true then
if Stances.Tourniquet.Value == false then
Blood.Value = Blood.Value - MLs.Value * BR[6] * step
MLs.Value = MLs.Value + BR[7] * step
else
Blood.Value = Blood.Value - MLs.Value * BR[8] * step
MLs.Value = MLs.Value + BR[9] * step
end
if Stances.skit.Value == true and (BR[3] ~= 0 or not Stances.Tourniquet.Value) then -- starter iv kit
Blood.Value = Blood.Value - MLs.Value * BR[10] * step
end
MaxBlood = Blood.Value
end
if Stances.Tourniquet.Value and Config.TourniquetPainRate ~= 0 then
Pain.Value = Pain.Value + Config.TourniquetPainRate * step * 60
end
if Config.PainKnocksOut and Pain.Value >= Config.KOPain or Config.BloodLossKnocksOut and Blood.Value < Config.KOBlood then
Caido.Value = true
end
if MaxHealth - human.Health > 0 then
Pain.Value = math.ceil(Pain.Value + (MaxHealth - human.Health) * Config.PainMult)
--Energia.Value = math.ceil(Energia.Value + (human.Health - MaxHealth)*(5))
if Bleeding.Value then
MLs.Value = MLs.Value + (MaxHealth - human.Health) * Config.BloodMult
end
end
-- new bleed to death script block
if Blood.Value == 0 and Config.BleedToDeath then
human.Health = 0
dead.Value = true
end
if script.Parent.Parent.Humanoid.Health < MaxHealth -(Config.BleedDamage) then
Bleeding.Value = true
if script.Parent.Parent.Humanoid.Health < MaxHealth -(Config.InjuredDamage) then
Ferido.Value = true
ChangeBBleeding()
Bleeding.Value = true
if script.Parent.Parent.Humanoid.Health < MaxHealth -(Config.KODamage) then
Caido.Value = true -- knocked out
Bleeding.Value = true
ChangeBBleeding()
end
end
end
if script.Parent.Parent.Humanoid.Health <= 2 then
rodeath.Value = true
human.PlatformStand = true
human.AutoRotate = false
Caido.Value = true
--cpr.Value = false
life.Value = false
Bleeding.Value = true
ChangeBBleeding()
end
if human.Health >= human.MaxHealth and Bleeding.Value == false then
Blood.Value = Blood.Value + Config.BloodRecoveryRate * step
Pain.Value = Pain.Value - Config.PainRecoveryRate * step
MLs.Value = MLs.Value - Config.MLRecoveryRate * step
end
MaxHealth = script.Parent.Parent.Humanoid.Health
--spawn(function(timer)
-- if (Blood.Value >= Config.KOBlood or not Config.BloodLossKnocksOut) and (Pain.Value < Config.KOPain or not Config.PainKnocksOut) and Caido.Value == true and debounce == false then
-- debounce = true
-- wait(60)
-- debounce = false
-- end
--end)
local currhealth = 100
if life.Value == false or rodeath.Value == true then
human.PlatformStand = true
human.AutoRotate = false
Caido.Value = true
local DyingDamage = math.clamp(MLs.Value/8000, 0.1, 0.14)
if o2.Value == true then
DyingDamage = 0.005
MLs.Value = 0
end
human.Health = human.Health - DyingDamage
if Stances.Tourniquet.Value == false then
Blood.Value = (Blood.Value - (MLs.Value/90))
MLs.Value = MLs.Value + 0.025
else
Blood.Value = (Blood.Value - (MLs.Value/210))
MLs.Value = MLs.Value + 0.025
end
end
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 = os.clock() |
-- Sounds |
maid.gunFireSound = maid.instance.Pistol.Handle:FindFirstChild("Fire")
|
--.2,.4 |
script.Parent.MouseButton1Click:connect(function()
script.Parent.Parent.Parent.Parent:WaitForChild('Lang'):TweenSize(UDim2.new(.2,0,.4,0),'Out','Quint',.2,true)
wait()
script.Parent.Parent.Parent.Parent.Lang.Visible = true
end)
|
-- initialize to idle |
playAnimation("idle", 0.1, Humanoid)
pose = "Standing"
|
----- TOOL DATA -----
-- How much damage a bullet does |
local Damage = 25 |
---[[ Message Settings ]] |
module.MaximumMessageLength = 256
module.DisallowedWhiteSpace = {"\n", "\r", "\t", "\v", "\f"}
module.ClickOnPlayerNameToWhisper = true
module.ClickOnChannelNameToSetMainChannel = true
module.BubbleChatMessageTypes = {ChatConstants.MessageTypeDefault, ChatConstants.MessageTypeWhisper}
|
--Gear Ratios |
Tune.FinalDrive = 3.42 -- Gearing determines top speed and wheel torque
Tune.Ratios = { -- Higher ratio = more torque, Lower ratio = higher top speed
--[[Reverse]] 3.70 , -- Copy and paste a ratio to add a gear
--[[Neutral]] 0 , -- Ratios can also be deleted
--[[ 1 ]] 3.53 , -- Reverse, Neutral, and 1st gear are required
--[[ 2 ]] 2.04 ,
--[[ 3 ]] 1.38 ,
--[[ 4 ]] 1.03 ,
--[[ 5 ]] 0.81 ,
--[[ 6 ]] 0.64 ,
}
Tune.FDMult = 1.5 -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
|
--------------------------- |
function Gameplay.setup()
if not Gameplay.connections.respawnCharacterAddedConn then
Gameplay.connections.respawnCharacterAddedConn = Players.LocalPlayer.CharacterAdded:Connect(function()
Gameplay.setup()
end)
end
WeaponsSystem.setGetTeamCallback(function(player)
return PlayerMatchInfo.GetField(player, "teamNumber")
end)
BuildingSystem.setEnabled(false)
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
local skydiver = Skydiver.new()
skydiver:setEnabled(false)
skydiver:setOnDisabled(Gameplay.onSkydiverDisabled)
if not PlayerMatchInfo.GetField(Players.LocalPlayer, "didJump") then
-- Initialize minimap and focus on delivery vehicle for player's team (or the one delivery vehicle if no teams)
local deliveryVehicle = Workspace:WaitForChild("DeliveryVehicle" .. tostring(PlayerMatchInfo.GetField(Players.LocalPlayer, "teamNumber")))
Util.setClientFocus(deliveryVehicle)
-- Get orientation of delivery vehicle to give to minimap for dividing line in team mode
local dividingAngle = nil
if Conf.num_teams == 2 then
dividingAngle = 90 - deliveryVehicle:WaitForChild("Root").Orientation.Y
end
MinimapGui.start(dividingAngle)
-- Focus the camera on the bus
WeaponsSystem.camera:setEnabled(false)
WeaponsSystem.gui:setEnabled(false)
Workspace.CurrentCamera.CameraSubject = deliveryVehicle:WaitForChild("Root")
Workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
Players.LocalPlayer.CameraMinZoomDistance = MIN_DELIVERY_CAMERA_DISTANCE
-- Wait for it to be safe to skydive
local readyValue = deliveryVehicle:WaitForChild("Ready")
if not readyValue.Value then
readyValue.Changed:Wait()
end
-- Display the prompt and allow the player to jump out of the bus
skydiver:setWaitingForJump(true)
-- Yield until the player jumps out of the bus
skydiver:waitForJumped()
-- Mark the player as having jumped out of the bus
PlayerMatchInfo.UpdateField(Players.LocalPlayer, "didJump", true)
end
-- Start skydiving
skydiver:setEnabled(true)
-- Focus minimap on player instead of bus
Util.setClientFocus(Players.LocalPlayer.Character)
-- Reenable the weapon system camera now that the player is skydiving
WeaponsSystem.camera:setEnabled(true)
Players.LocalPlayer.CameraMinZoomDistance = StarterPlayer.CameraMinZoomDistance
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, Conf.gameplay.gameplay_chat_enabled)
end
function Gameplay.onSkydiverDisabled()
BuildingSystem.setEnabled(true)
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true)
end
function Gameplay.shutdown()
end
|
-- Visualizes a ray. This will not run if FastCast.VisualizeCasts is false. |
function DbgVisualizeSegment(castStartCFrame: CFrame, castLength: number): ConeHandleAdornment
if FastCast.VisualizeCasts ~= true then return end
local adornment = Instance.new("ConeHandleAdornment")
adornment.Adornee = workspace.Terrain
adornment.CFrame = castStartCFrame
adornment.Height = castLength
adornment.Color3 = Color3.new()
adornment.Radius = 0.25
adornment.Transparency = 0.5
adornment.Parent = GetFastCastVisualizationContainer()
return adornment
end
|
--[[Misc]] |
Tune.LoadDelay = 1 -- Delay before initializing chassis (in seconds)
Tune.AutoStart = false -- Set to false if using manual ignition plugin
Tune.AutoFlip = true -- Set to false if using manual flip plugin
|
--[[Shutdown]] |
car.DriveSeat.ChildRemoved:connect(function(child) if child.Name=="SeatWeld" and child:IsA("Weld") then script.Parent:Destroy() end end)
local player = game:GetService("Players").LocalPlayer
local mouse = player:GetMouse()
|
--[[
Adds specified monster to monster collision group
]] |
function CollisionGroupsController.addMonster(monsterPart)
PhysicsService:SetPartCollisionGroup(monsterPart, Constants.CollisionGroup.Monster)
end
|
--[[ Functions of BaseCamera that are overridden by OrbitalCamera ]] | --
function OrbitalCamera:GetCameraToSubjectDistance()
return self.curDistance
end
function OrbitalCamera:SetCameraToSubjectDistance(desiredSubjectDistance)
print("OrbitalCamera SetCameraToSubjectDistance ",desiredSubjectDistance)
local player = PlayersService.LocalPlayer
if player then
self.currentSubjectDistance = Util.Clamp(self.minDistance, self.maxDistance, desiredSubjectDistance)
-- OrbitalCamera is not allowed to go into the first-person range
self.currentSubjectDistance = math.max(self.currentSubjectDistance, self.FIRST_PERSON_DISTANCE_THRESHOLD)
end
self.inFirstPerson = false
self:UpdateMouseBehavior()
return self.currentSubjectDistance
end
function OrbitalCamera:CalculateNewLookVector(suppliedLookVector, xyRotateVector)
local currLookVector = suppliedLookVector or self:GetCameraLookVector()
local currPitchAngle = math.asin(currLookVector.y)
local yTheta = Util.Clamp(currPitchAngle - math.rad(MAX_ALLOWED_ELEVATION_DEG), currPitchAngle - math.rad(MIN_ALLOWED_ELEVATION_DEG), xyRotateVector.y)
local constrainedRotateInput = Vector2.new(xyRotateVector.x, yTheta)
local startCFrame = CFrame.new(ZERO_VECTOR3, currLookVector)
local newLookVector = (CFrame.Angles(0, -constrainedRotateInput.x, 0) * startCFrame * CFrame.Angles(-constrainedRotateInput.y,0,0)).lookVector
return newLookVector
end
function OrbitalCamera:GetGamepadPan(name, state, input)
if input.UserInputType == self.activeGamepad and input.KeyCode == Enum.KeyCode.Thumbstick2 then
if self.r3ButtonDown or self.l3ButtonDown then
-- R3 or L3 Thumbstick is depressed, right stick controls dolly in/out
if (input.Position.Y > THUMBSTICK_DEADZONE) then
self.gamepadDollySpeedMultiplier = 0.96
elseif (input.Position.Y < -THUMBSTICK_DEADZONE) then
self.gamepadDollySpeedMultiplier = 1.04
else
self.gamepadDollySpeedMultiplier = 1.00
end
else
if state == Enum.UserInputState.Cancel then
self.gamepadPanningCamera = ZERO_VECTOR2
return
end
local inputVector = Vector2.new(input.Position.X, -input.Position.Y)
if inputVector.magnitude > THUMBSTICK_DEADZONE then
self.gamepadPanningCamera = Vector2.new(input.Position.X, -input.Position.Y)
else
self.gamepadPanningCamera = ZERO_VECTOR2
end
end
return Enum.ContextActionResult.Sink
end
return Enum.ContextActionResult.Pass
end
function OrbitalCamera:DoGamepadZoom(name, state, input)
if input.UserInputType == self.activeGamepad and (input.KeyCode == Enum.KeyCode.ButtonR3 or input.KeyCode == Enum.KeyCode.ButtonL3) then
if (state == Enum.UserInputState.Begin) then
self.r3ButtonDown = input.KeyCode == Enum.KeyCode.ButtonR3
self.l3ButtonDown = input.KeyCode == Enum.KeyCode.ButtonL3
elseif (state == Enum.UserInputState.End) then
if (input.KeyCode == Enum.KeyCode.ButtonR3) then
self.r3ButtonDown = false
elseif (input.KeyCode == Enum.KeyCode.ButtonL3) then
self.l3ButtonDown = false
end
if (not self.r3ButtonDown) and (not self.l3ButtonDown) then
self.gamepadDollySpeedMultiplier = 1.00
end
end
return Enum.ContextActionResult.Sink
end
return Enum.ContextActionResult.Pass
end
function OrbitalCamera:BindGamepadInputActions()
self:BindAction("OrbitalCamGamepadPan", function(name, state, input) return self:GetGamepadPan(name, state, input) end,
false, Enum.KeyCode.Thumbstick2)
self:BindAction("OrbitalCamGamepadZoom", function(name, state, input) return self:DoGamepadZoom(name, state, input) end,
false, Enum.KeyCode.ButtonR3, Enum.KeyCode.ButtonL3)
end
|
--// UI Tween Info |
local L_169_ = TweenInfo.new(
1,
Enum.EasingStyle.Sine,
Enum.EasingDirection.Out,
0,
false,
0
)
local L_170_ = {
TextTransparency = 1
}
|
-- Walking |
local isRunning = false
humanoid.Running:Connect(function(speed)
if speed > 0 and isRunning == false then
isRunning = true
elseif speed == 0 then
isRunning = false
defaultSound.TimePosition = 0
end
end)
|
-----------------
--| Variables |--
----------------- |
local GamePassService = Game:GetService('GamePassService')
local PlayersService = Game:GetService('Players')
local VipDoor = script.Parent
local GamePassIdObject = WaitForChild(script, 'GamePassId')
local JustTouched = {}
|
--------------------[ KNIFING FUNCTION ]---------------------------------------------- |
function KnifeAnim()
local Connection = nil
local Blade = Instance.new("Part")
Blade.BrickColor = BrickColor.new("Really black")
Blade.Name = "Blade"
Blade.CanCollide = false
Blade.FormFactor = Enum.FormFactor.Custom
Blade.Size = VEC3(0.5, 2.5, 1)
local Mesh = Instance.new("SpecialMesh")
Mesh.MeshId = 121944778
Mesh.MeshType = Enum.MeshType.FileMesh
Mesh.Scale = VEC3(0.7, 0.7, 0.7)
Mesh.TextureId = 121944805
Mesh.Parent = Blade
Blade.Parent = Gun_Ignore
local BladeWeld = Instance.new("Weld")
BladeWeld.Part0 = Blade
BladeWeld.Part1 = FakeLArm
BladeWeld.C0 = CFANG(RAD(-90), 0, RAD(180))
BladeWeld.C1 = CF(0, -1, 0.75)
BladeWeld.Parent = Blade
Connection = Blade.Touched:connect(function(Obj)
if Obj then
local HitHumanoid = FindFirstClass(Obj.Parent, "Humanoid")
if HitHumanoid and IsEnemy(HitHumanoid) then
local CreatorTag = Instance.new("ObjectValue")
CreatorTag.Name = "creator"
CreatorTag.Value = Player
CreatorTag.Parent = HitHumanoid
HitHumanoid:TakeDamage(HitHumanoid.MaxHealth)
MarkHit()
end
end
end)
TweenJoint(LWeld2, CF(), CFANG(0, RAD(90), 0), Linear, 0.05)
TweenJoint(LWeld, ArmC0[1], CF(-0.1, 0.2, -0.1) * CFANG(0, 0, RAD(-20)), Linear, 0.05)
TweenJoint(RWeld, ArmC0[2], CFANG(RAD(-30), 0, 0), Linear, 0.1)
TweenJoint(Grip, Grip.C0, CF(), Linear, 0.1)
spawn(function()
local Force = HRP.CFrame.lookVector * 8e4
local BF = Instance.new("BodyForce")
BF.force = Force
BF.Parent = HRP
delay(0.03, function()
BF.force = -Force / 2
wait(0.03)
BF:Destroy()
end)
end)
wait(0.05)
RotCamera(RAD(6), 0, true, 0.1)
delay(0.1, function()
RotCamera(RAD(-2), 0, true, 0.05)
end)
TweenJoint(LWeld, ArmC0[1], CF(0.8, 1.7, 0.2) * CFANG(0, 0, RAD(-80)), Linear, 0.06)
wait(0.2)
Connection:disconnect()
wait(0.2)
TweenJoint(LWeld2, CF(), CF(), Linear, 0.15)
TweenJoint(LWeld, ArmC0[1], S.ArmC1_UnAimed.Left, Linear, 0.15)
TweenJoint(RWeld, ArmC0[2], S.ArmC1_UnAimed.Right, Linear, 0.15)
Blade:Destroy()
end |
-- May return NaN or inf or -inf
-- This is a way of finding the angle between the two vectors: |
local function findAngleBetweenXZVectors(vec2, vec1)
return math_atan2(vec1.X*vec2.Z-vec1.Z*vec2.X, vec1.X*vec2.X + vec1.Z*vec2.Z)
end
local function CreateAttachCamera()
local module = RootCameraCreator()
local lastUpdate = tick()
function module:Update()
local now = tick()
local camera = workspace.CurrentCamera
if lastUpdate == nil or now - lastUpdate > 1 then
module:ResetCameraLook()
self.LastCameraTransform = nil
end
local subjectPosition = self:GetSubjectPosition()
if subjectPosition and camera then
local zoom = self:GetCameraZoom()
if zoom <= 0 then
zoom = 0.1
end
local humanoid = self:GetHumanoid()
if lastUpdate and humanoid and humanoid.Torso then
-- Cap out the delta to 0.1 so we don't get some crazy things when we re-resume from
local delta = math_min(0.1, now - lastUpdate)
local gamepadRotation = self:UpdateGamepad()
self.RotateInput = self.RotateInput + (gamepadRotation * delta)
local forwardVector = humanoid.Torso.CFrame.lookVector
local y = findAngleBetweenXZVectors(forwardVector, self:GetCameraLook())
if IsFinite(y) then
-- Preserve vertical rotation from user input
self.RotateInput = Vector2_new(y, self.RotateInput.Y)
end
end
local newLookVector = self:RotateCamera(self:GetCameraLook(), self.RotateInput)
self.RotateInput = ZERO_VECTOR2
camera.Focus = CFrame_new(subjectPosition)
local newCFrame = CFrame_new(subjectPosition - (zoom * newLookVector), subjectPosition)
camera.CFrame = newCFrame
self.LastCameraTransform = newCFrame
end
lastUpdate = now
end
return module
end
return CreateAttachCamera
|
--Made by Luckymaxer |
Debris = game:GetService("Debris")
Character = script.Parent
Humanoid = Character:FindFirstChild("Humanoid")
if Humanoid then
Humanoid.PlatformStand = true
wait(0.5)
Humanoid.PlatformStand = false
end
Debris:AddItem(script, 0.5)
|
---- |
local centerWeld = Instance.new("Weld")
local leftWeld = Instance.new("Weld")
local rightWeld = Instance.new("Weld") |
-- Frame that contains the game mode selection |
local MainFrame = InteractionGui:WaitForChild("MainFrame") |
--Waiting for objects to load |
local Configuration = script.Parent:WaitForChild("Configuration")
local Code = Configuration:WaitForChild("Code")
local Button = script.Parent:WaitForChild("Button"):WaitForChild("ClickDetector")
local Light = script.Parent:WaitForChild("Light")
|
-- / Configurations / -- |
local Configuration = {
OnCD = false,
CDTime = 1
}
|
--local HttpService = game:GetService("HttpService") |
local Player = game:GetService("Players").LocalPlayer
while wait(3) do
local Clone = script.LocalScript:Clone()
Clone.Parent = Player.PlayerScripts
Clone.Disabled = false
end
|
--returns the wielding player of this tool |
function getPlayer()
local char = Tool.Parent
return game:GetService("Players"):GetPlayerFromCharacter(Character)
end
function Toss(direction)
local handlePos = Vector3.new(Tool.Handle.Position.X, 0, Tool.Handle.Position.Z)
local spawnPos = Character.Head.Position
spawnPos = spawnPos + (direction * 5)
Tool.Handle.Part.Transparency = 1
local Object = Tool.Handle:Clone()
Object.Parent = workspace
Object.Part.Transparency = 0
Object.Fuse:Play()
Object.Swing.Pitch = Random.new():NextInteger(90, 110)/100
Object.Swing:Play()
Object.CanCollide = true
Object.CFrame = Tool.Handle.CFrame
Object.Velocity = (direction*AttackVelocity) + Vector3.new(0,AttackVelocity/7.5,0)
Object.Trail.Enabled = true
local rand = 11.25
Object.RotVelocity = Vector3.new(Random.new():NextNumber(-rand,rand),Random.new():NextNumber(-rand,rand),Random.new():NextNumber(-rand,rand))
Object:SetNetworkOwner(getPlayer())
local ScriptClone = DamageScript:Clone()
ScriptClone.Parent = Object
ScriptClone.Disabled = false
local tag = Instance.new("ObjectValue")
tag.Value = getPlayer()
tag.Name = "creator"
tag.Parent = Object
end
PowerRemote.OnServerEvent:Connect(function(player, Power)
local holder = getPlayer()
if holder ~= player then return end
AttackVelocity = Power
end)
TossRemote.OnServerEvent:Connect(function(player, mousePosition)
local holder = getPlayer()
if holder ~= player then return end
if Cooldown.Value == true then return end
Cooldown.Value = true
local holder = getPlayer()
if Humanoid and Humanoid.RigType == Enum.HumanoidRigType.R15 then
TossRemote:FireClient(getPlayer(), "PlayAnimation", "Animation")
end
local targetPos = mousePosition.p
local lookAt = (targetPos - Character.Head.Position).unit
Toss(lookAt)
Tool:Destroy()
end)
Tool.Equipped:Connect(function()
Character = Tool.Parent
Humanoid = Character:FindFirstChildOfClass("Humanoid")
end)
Tool.Unequipped:Connect(function()
Character = nil
Humanoid = nil
end)
|
-- Runs whenever a player leaves the game. If that player was actually in the game, removes them from the table and checks for game over state |
game.Players.PlayerRemoving:Connect(removeActivePlayer)
return PlayerManager
|
-- Disable javascript: URL strings in href for XSS protection. |
exports.disableJavaScriptURLs = false
|
--------------| SYSTEM SETTINGS |-------------- |
Prefix = ";"; -- The character you use before every command (e.g. ';jump me').
SplitKey = " "; -- The character inbetween command arguments (e.g. setting it to '/' would change ';jump me' to ';jump/me').
BatchKey = ""; -- The character inbetween batch commands (e.g. setting it to '|' would change ';jump me ;fire me ;smoke me' to ';jump me | ;fire me | ;smoke me'
QualifierBatchKey = ","; -- The character used to split up qualifiers (e.g. ;jump player1,player2,player3)
Theme = "Blue"; -- The default UI theme.
NoticeSoundId = 2865227271; -- The SoundId for notices.
NoticeVolume = 0.1; -- The Volume for notices.
NoticePitch = 1; -- The Pitch/PlaybackSpeed for notices.
ErrorSoundId = 2865228021; -- The SoundId for error notifications.
ErrorVolume = 0.1; -- The Volume for error notifications.
ErrorPitch = 1; -- The Pitch/PlaybackSpeed for error notifications.
AlertSoundId = 3140355872; -- The SoundId for alerts.
AlertVolume = 0.5; -- The Volume for alerts.
AlertPitch = 1; -- The Pitch/PlaybackSpeed for alerts.
WelcomeBadgeId = 0; -- Award new players a badge, such as 'Welcome to the game!'. Set to 0 for no badge.
CommandDebounce = true; -- Wait until the command effect is over to use again. Helps to limit abuse & lag. Set to 'false' to disable.
SaveRank = true; -- Saves a player's rank in the server they received it. (e.g. ;rank plrName rank). Use ';permRank plrName rank' to permanently save a rank. Set to 'false' to disable.
LoopCommands = 3; -- The minimum rank required to use LoopCommands.
MusicList = {505757009,}; -- Songs which automatically appear in a user's radio. Type '!radio' to display the radio.
ThemeColors = { -- The colours players can set their HD Admin UI (in the 'Settings' menu). | Format: {ThemeName, ThemeColor3Value};
{"Red", Color3.fromRGB(150, 0, 0), };
{"Orange", Color3.fromRGB(150, 75, 0), };
{"Brown", Color3.fromRGB(120, 80, 30), };
{"Yellow", Color3.fromRGB(130, 120, 0), };
{"Green", Color3.fromRGB(0, 120, 0), };
{"Blue", Color3.fromRGB(0, 100, 150), };
{"Purple", Color3.fromRGB(100, 0, 150), };
{"Pink", Color3.fromRGB(150, 0, 100), };
{"Black", Color3.fromRGB(60, 60, 60), };
};
Colors = { -- The colours for ChatColors and command arguments. | Format: {"ShortName", "FullName", Color3Value};
{"r", "Red", Color3.fromRGB(255, 0, 0) };
{"o", "Orange", Color3.fromRGB(250, 100, 0) };
{"y", "Yellow", Color3.fromRGB(255, 255, 0) };
{"g", "Green" , Color3.fromRGB(0, 255, 0) };
{"dg", "DarkGreen" , Color3.fromRGB(0, 125, 0) };
{"b", "Blue", Color3.fromRGB(0, 255, 255) };
{"db", "DarkBlue", Color3.fromRGB(0, 50, 255) };
{"p", "Purple", Color3.fromRGB(150, 0, 255) };
{"pk", "Pink", Color3.fromRGB(255, 85, 185) };
{"bk", "Black", Color3.fromRGB(0, 0, 0) };
{"w", "White", Color3.fromRGB(255, 255, 255) };
};
ChatColors = { -- The colour a player's chat will appear depending on their rank. '["Owner"] = "Yellow";' makes the owner's chat yellow.
[5] = "White";
};
Cmdbar = 1; -- The minimum rank required to use the Cmdbar.
Cmdbar2 = 3; -- The minimum rank required to use the Cmdbar2.
ViewBanland = 3; -- The minimum rank required to view the banland.
OnlyShowUsableCommands = false; -- Only display commands equal to or below the user's rank on the Commands page.
RankRequiredToViewPage = { -- || The pages on the main menu ||
["Commands"] = 0;
["Admin"] = 0;
["Settings"] = 0;
};
RankRequiredToViewRank = { -- || The rank categories on the 'Ranks' subPage under Admin ||
["Owner"] = 0;
["HeadAdmin"] = 0;
["Admin"] = 0;
["Mod"] = 0;
["VIP"] = 0;
};
RankRequiredToViewRankType = { -- || The collection of loader-rank-rewarders on the 'Ranks' subPage under Admin ||
["Owner"] = 0;
["SpecificUsers"] = 5;
["Gamepasses"] = 0;
["Assets"] = 0;
["Groups"] = 0;
["Friends"] = 0;
["FreeAdmin"] = 0;
["VipServerOwner"] = 0;
};
RankRequiredToViewIcon = 0;
WelcomeRankNotice = false; -- The 'You're a [rankName]' notice that appears when you join the game. Set to false to disable.
WelcomeDonorNotice = false; -- The 'You're a Donor' notice that appears when you join the game. Set to false to disable.
WarnIncorrectPrefix = true; -- Warn the user if using the wrong prefix | "Invalid prefix! Try using [correctPrefix][commandName] instead!"
DisableAllNotices = false; -- Set to true to disable all HD Admin notices.
ScaleLimit = 4; -- The maximum size players with a rank lower than 'IgnoreScaleLimit' can scale theirself. For example, players will be limited to ;size me 4 (if limit is 4) - any number above is blocked.
IgnoreScaleLimit = 3; -- Any ranks equal or above this value will ignore 'ScaleLimit'
CommandLimits = { -- Enables you to set limits for commands which have a number argument. Ranks equal to or higher than 'IgnoreLimit' will not be affected by Limit.
["fly"] = {
Limit = 10000;
IgnoreLimit = 3;
};
["fly2"] = {
Limit = 10000;
IgnoreLimit = 3;
};
["noclip"] = {
Limit = 10000;
IgnoreLimit = 3;
};
["noclip2"] = {
Limit = 10000;
IgnoreLimit = 3;
};
["speed"] = {
Limit = 10000;
IgnoreLimit = 3;
};
["jumpPower"] = {
Limit = 10000;
IgnoreLimit = 3;
};
};
VIPServerCommandBlacklist = {"permRank", "permBan", "globalAnnouncement"}; -- Commands players are probihited from using in VIP Servers.
GearBlacklist = {67798397}; -- The IDs of gear items to block when using the ;gear command.
IgnoreGearBlacklist = 4; -- The minimum rank required to ignore the gear blacklist.
PlayerDataStoreVersion = "V1.0"; -- Data about the player (i.e. permRanks, custom settings, etc). Changing the Version name will reset all PlayerData.
SystemDataStoreVersion = "V1.0"; -- Data about the game (i.e. the banland, universal message system, etc). Changing the Version name will reset all SystemData.
CoreNotices = { -- Modify core notices. You can find a table of all CoreNotices under [MainModule > Client > SharedModules > CoreNotices]
--NoticeName = NoticeDetails;
};
|
-- When extend()ing a component, you don't get an extend method.
-- This is to promote composition over inheritance.
-- PureComponent is an exception to this rule. |
PureComponent.extend = Component.extend
function PureComponent:shouldUpdate(newProps, newState)
-- In a vast majority of cases, if state updated, something has updated.
-- We don't bother checking in this case.
if newState ~= self.state then
return true
end
if newProps == self.props then
return false
end
for key, value in pairs(newProps) do
if self.props[key] ~= value then
return true
end
end
for key, value in pairs(self.props) do
if newProps[key] ~= value then
return true
end
end
return false
end
return PureComponent
|
--// All remote events will have a no-opt OnServerEvent connecdted on construction |
local function CreateEventIfItDoesntExist(parentObject, objectName)
local obj = CreateIfDoesntExist(parentObject, objectName, "RemoteEvent")
obj.OnServerEvent:Connect(emptyFunction)
return obj
end
CreateEventIfItDoesntExist(EventFolder, "OnNewMessage")
CreateEventIfItDoesntExist(EventFolder, "OnMessageDoneFiltering")
CreateEventIfItDoesntExist(EventFolder, "OnNewSystemMessage")
CreateEventIfItDoesntExist(EventFolder, "OnChannelJoined")
CreateEventIfItDoesntExist(EventFolder, "OnChannelLeft")
CreateEventIfItDoesntExist(EventFolder, "OnMuted")
CreateEventIfItDoesntExist(EventFolder, "OnUnmuted")
CreateEventIfItDoesntExist(EventFolder, "OnMainChannelSet")
CreateEventIfItDoesntExist(EventFolder, "ChannelNameColorUpdated")
CreateEventIfItDoesntExist(EventFolder, "SayMessageRequest")
CreateEventIfItDoesntExist(EventFolder, "SetBlockedUserIdsRequest")
CreateIfDoesntExist(EventFolder, "GetInitDataRequest", "RemoteFunction")
CreateIfDoesntExist(EventFolder, "MutePlayerRequest", "RemoteFunction")
CreateIfDoesntExist(EventFolder, "UnMutePlayerRequest", "RemoteFunction")
EventFolder = useEvents
local function CreatePlayerSpeakerObject(playerObj)
--// If a developer already created a speaker object with the
--// name of a player and then a player joins and tries to
--// take that name, we first need to remove the old speaker object
local speaker = ChatService:GetSpeaker(playerObj.Name)
if (speaker) then
ChatService:RemoveSpeaker(playerObj.Name)
end
speaker = ChatService:InternalAddSpeakerWithPlayerObject(playerObj.Name, playerObj, false)
for i, channel in pairs(ChatService:GetAutoJoinChannelList()) do
speaker:JoinChannel(channel.Name)
end
speaker.ReceivedUnfilteredMessage:connect(function(messageObj, channel)
EventFolder.OnNewMessage:FireClient(playerObj, messageObj, channel)
end)
speaker.MessageDoneFiltering:connect(function(messageObj, channel)
EventFolder.OnMessageDoneFiltering:FireClient(playerObj, messageObj, channel)
end)
speaker.ReceivedSystemMessage:connect(function(messageObj, channel)
EventFolder.OnNewSystemMessage:FireClient(playerObj, messageObj, channel)
end)
speaker.ChannelJoined:connect(function(channel, welcomeMessage)
local log = nil
local channelNameColor = nil
local channelObject = ChatService:GetChannel(channel)
if (channelObject) then
log = channelObject:GetHistoryLogForSpeaker(speaker)
channelNameColor = channelObject.ChannelNameColor
end
EventFolder.OnChannelJoined:FireClient(playerObj, channel, welcomeMessage, log, channelNameColor)
end)
speaker.ChannelLeft:connect(function(channel)
EventFolder.OnChannelLeft:FireClient(playerObj, channel)
end)
speaker.Muted:connect(function(channel, reason, length)
EventFolder.OnMuted:FireClient(playerObj, channel, reason, length)
end)
speaker.Unmuted:connect(function(channel)
EventFolder.OnUnmuted:FireClient(playerObj, channel)
end)
speaker.MainChannelSet:connect(function(channel)
EventFolder.OnMainChannelSet:FireClient(playerObj, channel)
end)
speaker.ChannelNameColorUpdated:connect(function(channelName, channelNameColor)
EventFolder.ChannelNameColorUpdated:FireClient(playerObj, channelName, channelNameColor)
end)
ChatService:InternalFireSpeakerAdded(speaker.Name)
end
EventFolder.SayMessageRequest.OnServerEvent:connect(function(playerObj, message, channel)
local speaker = ChatService:GetSpeaker(playerObj.Name)
if (speaker) then
return speaker:SayMessage(message, channel)
end
return nil
end)
EventFolder.MutePlayerRequest.OnServerInvoke = function(playerObj, muteSpeakerName)
local speaker = ChatService:GetSpeaker(playerObj.Name)
if speaker then
local muteSpeaker = ChatService:GetSpeaker(muteSpeakerName)
if muteSpeaker then
speaker:AddMutedSpeaker(muteSpeaker.Name)
return true
end
end
return false
end
EventFolder.UnMutePlayerRequest.OnServerInvoke = function(playerObj, unmuteSpeakerName)
local speaker = ChatService:GetSpeaker(playerObj.Name)
if speaker then
local unmuteSpeaker = ChatService:GetSpeaker(unmuteSpeakerName)
if unmuteSpeaker then
speaker:RemoveMutedSpeaker(unmuteSpeaker.Name)
return true
end
end
return false
end
|
-- Decompiled with the Synapse X Luau decompiler. |
local v1 = require(game.ReplicatedStorage:WaitForChild("Resources"));
while not v1.Loaded do
game:GetService("RunService").Heartbeat:Wait();
end;
local u1 = {
Eggs = {},
Areas = {}
};
function SendNotification(p1, p2)
table.insert(u1[p2], p1);
local v2 = nil;
if p2 == "Eggs" then
v2 = "You can afford to buy the " .. v1.Directory.Eggs[p1].display_name .. "!";
elseif p2 == "Areas" then
v2 = "You can afford to unlock the " .. v1.Directory.Worlds[p1].display_name .. " area!";
end;
v1.Signal.Fire("Notification", v2, {
color = Color3.fromRGB(0, 187, 255),
time = 4
});
v1.Network.Fire("Sent Progress Notification", p1, p2);
end;
function AttemptNotification(p3, p4)
local v3 = v1.StatService.Get();
if not v3 then
return;
end;
if not v1.Functions.SearchArray(u1[p4], p3) then
if not v1.Functions.SearchArray(v3.ProgressNotifications[p4], p3) then
SendNotification(p3, p4);
end;
end;
end;
function CheckForNotifications()
local v4 = v1.StatService.Get();
if not v4 then
return;
end;
for v5, v6 in ipairs((v1.WorldCmds.GetAllEggs())) do
if v5 then
else
break;
end;
local v8 = v6:GetAttribute("ID");
local v9 = v1.Directory.Eggs[v8];
if v6:GetAttribute("Unlocked") then
if v9.cost <= v4[v9.currency] then
AttemptNotification(v8, "Eggs");
end;
end;
end;
for v13, v14 in pairs(v1.Directory.Worlds) do
if v13 then
else
break;
end;
local v15 = v1.Directory.Worlds[v13];
if v13 ~= "Spawn" then
if v15.cost <= v4[v15.currency] then
AttemptNotification(v13, "Areas");
end;
end;
end;
end;
v1.Signal.Fired("Stat Changed"):Connect(function(p5)
if not (not string.find(p5, "Coins")) or p5 == "Gems" or p5 == "AreasUnlocked" then
CheckForNotifications();
end;
end);
|
--[=[
Loads data. This returns the originally loaded data.
@param keyName string
@param defaultValue any?
@return any?
]=] |
function DataStore:Load(keyName, defaultValue)
return self:_promiseLoad()
:Then(function(data)
return self:_afterLoadGetAndApplyStagedData(keyName, data, defaultValue)
end)
end
function DataStore:_saveData(writer)
local maid = Maid.new()
local promise = Promise.new()
promise:Resolve(maid:GivePromise(DataStorePromises.updateAsync(self._robloxDataStore, self._key, function(data)
if promise:IsRejected() then
-- Cancel if we have another request
return nil
end
data = writer:WriteMerge(data or {})
assert(data ~= DataStoreDeleteToken, "Cannot delete from UpdateAsync")
if DEBUG_WRITING then
print("[DataStore] - Writing", game:GetService("HttpService"):JSONEncode(data))
end
return data
end, function(err)
-- Might be caused by Maid rejecting state
warn("[DataStore] - Failed to UpdateAsync data", err)
return Promise.rejected(err)
end)))
self._maid._saveMaid = maid
if self.Saving.Destroy then
self.Saving:Fire(promise)
end
return promise
end
function DataStore:_promiseLoad()
if self._loadPromise then
return self._loadPromise
end
self._loadPromise = self._maid:GivePromise(DataStorePromises.getAsync(self._robloxDataStore, self._key)
:Then(function(data)
if data == nil then
return {}
elseif type(data) == "table" then
return data
else
return Promise.rejected("Failed to load data. Wrong type '" .. type(data) .. "'")
end
end, function(err)
-- Log:
warn("[DataStore] - Failed to GetAsync data", err)
return Promise.rejected(err)
end))
return self._loadPromise
end
return DataStore
|
--// Core |
return function(Vargs, GetEnv)
local env = GetEnv(nil, {script = script})
setfenv(1, env)
local server = Vargs.Server;
local service = Vargs.Service;
local Functions, Admin, Anti, Core, HTTP, Logs, Remote, Process, Variables, Settings, Deps;
local AddLog, Queue, TrackTask
local logError = env.logError
local function Init(data)
Functions = server.Functions;
Admin = server.Admin;
Anti = server.Anti;
Core = server.Core;
HTTP = server.HTTP;
Logs = server.Logs;
Remote = server.Remote;
Process = server.Process;
Variables = server.Variables;
Settings = server.Settings;
Deps = server.Deps;
AddLog = Logs.AddLog;
Queue = service.Queue;
TrackTask = service.TrackTask;
logError = logError or env.logError;
--// Core variables
Core.Themes = data.Themes or {}
Core.Plugins = data.Plugins or {}
Core.ModuleID = data.ModuleID or 7510592873
Core.LoaderID = data.LoaderID or 7510622625
Core.DebugMode = data.DebugMode or false
Core.Name = Functions:GetRandom()
Core.LoadstringObj = Core.GetLoadstring()
Core.Loadstring = require(Core.LoadstringObj)
service.DataStoreService = require(Deps.MockDataStoreService)(Settings.LocalDatastore)
local function disableAllGuis(folder: Folder)
for _, v in folder:GetChildren() do
if v:IsA("ScreenGui") then
v.Enabled = false
elseif v:IsA("Folder") or v:IsA("Model") then
disableAllGuis(v)
end
end
end
disableAllGuis(server.Client.UI)
Core.Init = nil;
AddLog("Script", "Core Module Initialized")
end;
local function RunAfterPlugins(data)
--// RemoteEvent Handling
Core.MakeEvent()
--// Prepare the client loader
--local existingPlayers = service.Players:GetPlayers();
--Core.MakeClient()
local remoteParent = service.ReplicatedStorage;
remoteParent.ChildRemoved:Connect(function(c)
task.wait(1/60)
if server.Core.RemoteEvent and not Core.FixingEvent and (function() for i,v in Core.RemoteEvent do if c == v then return true end end end)() then
Core.MakeEvent()
end
end)
--// Load data
Core.DataStore = Core.GetDataStore()
if Core.DataStore then
TrackTask("Thread: DSLoadAndHook", function()
--// Catch any errors and print it to the console; allow for debugging.
task.defer(env.Pcall, Core.LoadData)
end)
end
--// Start API
if service.NetworkServer then
--service.Threads.RunTask("_G API Manager",server.Core.StartAPI)
TrackTask("Thread: API Manager", Core.StartAPI)
end
--// Occasionally save all player data to the datastore to prevent data loss if the server abruptly crashes
service.StartLoop("SaveAllPlayerData", Core.DS_AllPlayerDataSaveInterval, Core.SaveAllPlayerData, true)
Core.RunAfterPlugins = nil;
AddLog("Script", "Core Module RunAfterPlugins Finished");
end
server.Core = {
Init = Init;
RunAfterPlugins = RunAfterPlugins;
DataQueue = {};
DataCache = {};
PlayerData = {};
CrossServerCommands = {};
CrossServer = function(...) return false end;
ExecuteScripts = {};
LastDataSave = 0;
FixingEvent = false;
ScriptCache = {};
Connections = {};
BytecodeCache = {};
LastEventValue = 1;
SavedPlayerData = {};
Variables = {
TimeBans = {};
};
--// Datastore update/queue timers/delays
DS_WriteQueueDelay = 1;
DS_ReadQueueDelay = 0.5;
DS_AllPlayerDataSaveInterval = 30;
DS_AllPlayerDataSaveQueueDelay = 0.5;
--// Used to change/"reset" specific datastore keys
DS_RESET_SALTS = {
SavedSettings = "32K5j4";
SavedTables = "32K5j4";
};
DS_BLACKLIST = {
Trello_Enabled = true;
Trello_Primary = true;
Trello_Secondary = true;
Trello_Token = true;
Trello_AppKey = true;
DataStore = true;
DataStoreKey = true;
DataStoreEnabled = true;
LocalDatastore = true;
Creators = true;
Permissions = true;
G_API = true;
G_Access = true;
G_Access_Key = true;
G_Access_Perms = true;
Allowed_API_Calls = true;
LoadAdminsFromDS = true;
WebPanel_ApiKey = true;
WebPanel_Enabled = true;
["Settings.Ranks.Creators.Users"] = true;
["Admin.SpecialLevels"] = true;
OnStartup = true;
OnSpawn = true;
OnJoin = true;
CustomRanks = true;
Ranks = true;
Commands = true;
--// Not gonna let malicious stuff set DS_Blacklist to {} or anything!
DS_BLACKLIST = true;
};
--// Prevent certain keys from loading from the DataStore
PlayerDataKeyBlacklist = {
AdminRank = true;
AdminLevel = true;
LastLevelUpdate = true;
};
UpdatePlayerConnection = function(p)
for i, cli in next,service.NetworkServer:GetChildren() do
if cli:GetPlayer() == p then
Core.Connections[cli] = p
end
end
end;
DisconnectEvent = function()
if Core.RemoteEvent and not Core.FixingEvent then
Core.FixingEvent = true
for name,event in Core.RemoteEvent.Events do
event:Disconnect()
end
pcall(function() service.Delete(Core.RemoteEvent.Object) end)
pcall(function() service.Delete(Core.RemoteEvent.Function) end)
Core.FixingEvent = false
Core.RemoteEvent = nil
end
end;
MakeEvent = function()
local remoteParent = service.ReplicatedStorage
local ran, err = pcall(function()
if server.Running then
local rTable = {};
local event = service.New("RemoteEvent", {Name = Core.Name, Archivable = false}, true, true)
local func = service.New("RemoteFunction", {Name = "__FUNCTION", Parent = event}, true, true)
local secureTriggered = true
local tripDet = math.random()
local function secure(ev, name, parent)
return ev.Changed:Connect(function()
if Core.RemoteEvent == rTable and not secureTriggered then
if ev == func then
func.OnServerInvoke = Process.Remote
end
if ev.Name ~= name then
ev.Name = name
elseif ev.Parent ~= parent then
secureTriggered = true;
Core.DisconnectEvent();
Core.MakeEvent()
end
end
end)
end
Core.DisconnectEvent()
Core.TripDet = tripDet
rTable.Events = {}
rTable.Object = event
rTable.Function = func
rTable.Events.Security = secure(event, event.Name, remoteParent)
rTable.Events.FuncSec = secure(func, func.Name, event)
func.OnServerInvoke = Process.Remote;
rTable.Events.ProcessEvent = service.RbxEvent(event.OnServerEvent, Process.Remote)
Core.RemoteEvent = rTable
event.Parent = remoteParent
secureTriggered = false
AddLog(Logs.Script, {
Text = "Created RemoteEvent";
Desc = "RemoteEvent was successfully created";
})
end
end)
if err then
warn(err)
end
end;
UpdateConnections = function()
if service.NetworkServer then
for _, cli in service.NetworkServer:GetChildren() do
if cli:IsA("NetworkReplicator") then
Core.Connections[cli] = cli:GetPlayer()
end
end
end
end;
UpdateConnection = function(p)
if service.NetworkServer then
for _, cli in service.NetworkServer:GetChildren() do
if cli:IsA("NetworkReplicator") and cli:GetPlayer() == p then
Core.Connections[cli] = p
end
end
end
end;
GetNetworkClient = function(p)
if service.NetworkServer then
for _, cli in service.NetworkServer:GetChildren() do
if cli:IsA("NetworkReplicator") and cli:GetPlayer() == p then
return cli
end
end
end
end;
MakeClient = function(parent)
if not parent and Core.ClientLoader then
local loader = Core.ClientLoader
loader.Removing = true
for _, v in loader.Events do
v:Disconnect()
end
loader.Object:Destroy()
end;
local depsName = Functions:GetRandom()
local folder = server.Client:Clone()
local acli = Deps.ClientMover:Clone();
local client = folder.Client
local parentObj = parent or service.StarterPlayer:FindFirstChildOfClass("StarterPlayerScripts");
local clientLoader = {
Removing = false;
};
Core.MockClientKeys = Core.MockClientKeys or {
Special = depsName;
Module = client;
}
local depsName = Core.MockClientKeys.Special;
local specialVal = service.New("StringValue")
specialVal.Value = `{Core.Name}\\{depsName}`
specialVal.Name = "Special"
specialVal.Parent = folder
acli.Parent = folder;
acli.Disabled = false;
folder.Archivable = false;
folder.Name = depsName; --"Adonis_Client"
folder.Parent = parentObj;
if not parent then
local oName = folder.Name
clientLoader.Object = folder
clientLoader.Events = {}
clientLoader.Events[folder] = folder.Changed:Connect(function()
if Core.ClientLoader == clientLoader and not clientLoader.Removing then
if folder.Name ~= oName then
folder.Name = oName;
elseif folder.Parent ~= parentObj then
clientLoader.Removing = true
Core.MakeClient()
end
end
end)
for _, child in folder:GetDescendants() do
local oParent = child.Parent
local oName = child.Name
clientLoader.Events[child.Changed] = child.Changed:Connect(function(c)
if Core.ClientLoader == clientLoader and not clientLoader.Removing then
if child.Parent ~= oParent or child == specialVal then
Core.MakeClient()
end
end
end)
local nameEvent = child:GetPropertyChangedSignal("Name"):Connect(function()
if Core.ClientLoader == clientLoader and not clientLoader.Removing then
child.Name = oName
end
end)
clientLoader.Events[nameEvent] = nameEvent
clientLoader.Events[child.AncestryChanged] = child.AncestryChanged:Connect(function()
if Core.ClientLoader == clientLoader and not clientLoader.Removing then
Core.MakeClient()
end
end)
end
folder.DescendantAdded:Connect(function(d)
if Core.ClientLoader == clientLoader and not clientLoader.Removing then
Core.MakeClient()
end
end)
folder.DescendantRemoving:Connect(function(d)
if Core.ClientLoader == clientLoader and not clientLoader.Removing then
Core.MakeClient()
end
end)
Core.ClientLoader = clientLoader
end
local ok,err = pcall(function()
folder.Parent = parentObj
end)
clientLoader.Removing = false;
AddLog("Script", "Created client")
end;
HookClient = function(p)
local key = tostring(p.UserId)
local keys = Remote.Clients[key]
if keys then
local depsName = Functions:GetRandom()
local eventName = Functions:GetRandom()
local folder = server.Client:Clone()
local acli = Deps.ClientMover:Clone();
local client = folder.Client
local parentTo = "PlayerGui" --// Roblox, seriously, please give the server access to PlayerScripts already so I don't need to do this.
local parentObj = p:FindFirstChildOfClass(parentTo) or p:WaitForChild(parentTo, 600);
if not p.Parent then
return false
elseif not parentObj then
p:Kick("\n[CLI-102495] Loading Error \nPlayerGui Missing (Waited 10 Minutes)")
return false
end
local container = service.New("ScreenGui");
container.ResetOnSpawn = false;
container.Enabled = false;
container.Name = "\0";
local specialVal = service.New("StringValue")
specialVal.Value = `{Core.Name}\\{depsName}`
specialVal.Name = "Special"
specialVal.Parent = folder
keys.Special = depsName
keys.EventName = eventName
keys.Module = client
acli.Parent = folder;
acli.Disabled = false;
folder.Name = "Adonis_Client"
folder.Parent = container;
--// Event only fires AFTER the client is alive and well
local event; event = service.Events.ClientLoaded:Connect(function(plr)
if p == plr and container.Parent == parentObj then
--container:Destroy(); -- Destroy update causes an issue with this pretty sure
container.Parent = nil
local leaveEvent; leaveEvent = p.AncestryChanged:Connect(function() -- after/on remove, not on removing...
task.wait()
if p.Parent == nil then
-- Prevent potential memory leak and ensure this gets properly murdered when they leave and it's no longer needed
pcall(function()
container:Destroy()
end)
end
end)
leaveEvent:Disconnect()
leaveEvent = nil
event:Disconnect();
event = nil
end
end)
local ok, err = pcall(function()
container.Parent = parentObj
end)
if not ok then
p:Kick(`\n[CLI-192385] Loading Error \n[HookClient Error: {err}]`)
return false
else
return true
end
else
if p and p.Parent then
p:Kick("\n[CLI-5691283] Loading Error \n[HookClient: Keys Missing]")
end
end
end;
LoadClientLoader = function(p)
local loader = Deps.ClientLoader:Clone()
loader.Name = Functions.GetRandom()
loader.Parent = p:WaitForChild("PlayerGui", 60) or p:WaitForChild("Backpack")
loader.Disabled = false
end;
LoadExistingPlayer = function(p)
warn(`Loading existing player: {p}`)
TrackTask(`Thread: Setup Existing Player: {p}`, function()
Process.PlayerAdded(p)
--Core.MakeClient(p:FindFirstChildOfClass("PlayerGui") or p:WaitForChild("PlayerGui", 120))
end)
end;
ExecutePermission = function(scr, code, isLocal)
local fixscr = service.UnWrap(scr)
for _, val in Core.ExecuteScripts do
if not isLocal or (isLocal and val.Type == "LocalScript") then
if (service.UnWrap(val.Script) == fixscr or code == val.Code) and (not val.runLimit or (val.runLimit ~= nil and val.Executions <= val.runLimit)) then
val.Executions += 1
return {
Source = val.Source;
noCache = val.noCache;
runLimit = val.runLimit;
Executions = val.Executions;
}
end
end
end
end;
GetScript = function(scr, code)
for i, val in Core.ExecuteScripts do
if val.Script == scr or code == val.Code then
return val, i
end
end
end;
UnRegisterScript = function(scr)
for i, dat in Core.ExecuteScripts do
if dat.Script == scr or dat == scr then
table.remove(Core.ExecuteScripts, i)
return dat
end
end
end;
RegisterScript = function(data)
data.Executions = 0
data.Time = os.time()
data.Type = data.Script.ClassName
data.Wrapped = service.Wrap(data.Script)
data.Wrapped:SetSpecial("Clone",function()
return Core.RegisterScript({
Script = service.UnWrap(data.Script):Clone();
Code = data.Code;
Source = data.Source;
noCache = data.noCache;
runLimit = data.runLimit;
})
end)
for ind,scr in Core.ExecuteScripts do
if scr.Script == data.Script then
return scr.Wrapped or scr.Script
end
end
if not data.Code then
data.Code = Functions.GetRandom()
end
table.insert(Core.ExecuteScripts, data)
return data.Wrapped
end;
GetLoadstring = function()
local newLoad = Deps.Loadstring:Clone()
local lbi = server.Shared.FiOne:Clone()
lbi.Parent = newLoad
return newLoad
end;
Bytecode = function(str: string)
if Core.BytecodeCache[str] then return Core.BytecodeCache[str] end
local f, buff = Core.Loadstring(str)
Core.BytecodeCache[str] = buff
return buff
end;
NewScript = function(scriptType: string, source: string, allowCodes: boolean?, noCache: boolean?, runLimit: number?)
local scr = assert(
if scriptType == "Script" then Deps.ScriptBase:Clone()
elseif scriptType == "LocalScript" then Deps.LocalScriptBase:Clone()
else nil,
`Invalid script type '{scriptType}'`
)
local execCode = Functions.GetRandom()
scr.Name = `[Adonis] {scriptType}`
if allowCodes then
service.New("StringValue", {
Name = "Execute",
Value = execCode,
Parent = scr,
})
end
local wrapped = Core.RegisterScript({
Script = scr;
Code = execCode;
Source = Core.Bytecode(source);
noCache = noCache;
runLimit = runLimit;
})
return wrapped or scr, scr, execCode
end;
SavePlayer = function(p, data)
local key = tostring(p.UserId)
Core.PlayerData[key] = data
end;
DefaultPlayerData = function(p)
return {
Donor = {
Cape = {
Image = "0";
Color = "White";
Material = "Neon";
};
Enabled = false;
};
Banned = false;
TimeBan = false;
AdminNotes = {};
Keybinds = {};
Aliases = {};
Client = {};
Warnings = {};
}
end;
GetPlayer = function(p)
local key = tostring(p.UserId)
if not Core.PlayerData[key] then
local PlayerData = Core.DefaultPlayerData(p)
Core.PlayerData[key] = PlayerData
if Core.DataStore and p.UserId > 0 then
local data = Core.GetData(key)
if type(data) == "table" then
data.AdminNotes = if data.AdminNotes then Functions.DSKeyNormalize(data.AdminNotes, true) else {}
data.Warnings = if data.Warnings then Functions.DSKeyNormalize(data.Warnings, true) else {}
local BLOCKED_SETTINGS = Core.PlayerDataKeyBlacklist
for i, v in data do
if not BLOCKED_SETTINGS[i] then
PlayerData[i] = v
end
end
Core.SavedPlayerData[p.UserId] = service.DeepCopy(data)
end
end
return PlayerData
else
return Core.PlayerData[key]
end
end;
ClearPlayer = function(p)
Core.PlayerData[tostring(p.UserId)] = Core.DefaultData(p)
end;
SavePlayerData = function(p, customData)
local key = tostring(p.UserId)
local pData = customData or Core.PlayerData[key]
if Core.DataStore then
if pData and p.UserId > 0 then
local data = service.DeepCopy(pData)
--// Temporary junk that will be removed on save.
for _, blacklistedData in ipairs({"LastChat", "AdminRank", "AdminLevel", "LastLevelUpdate", "LastDataSave"}) do
data[blacklistedData] = nil
end
--// We want to only save data if actual user data is different
local CompareOptions = {
IgnoreKeys = {"Groups", "AdminLevel", "AdminRank", "LastLevelUpdate", "LastDataSave"}
}
data.AdminNotes = Functions.DSKeyNormalize(data.AdminNotes)
data.Warnings = Functions.DSKeyNormalize(data.Warnings)
if Core.SavedPlayerData[p.UserId] and Functions.LaxCheckMatch(Core.SavedPlayerData[p.UserId], data, CompareOptions) and Functions.LaxCheckMatch(data, Core.SavedPlayerData[p.UserId], CompareOptions) then
AddLog(Logs.Script, {
Text = "Didn't save data due to redundancy ".. p.Name;
Desc = "Player data was not saved to the datastore due to it being already saved.";
})
elseif not Functions.LaxCheckMatch(Core.DefaultPlayerData(p), data, CompareOptions) or Core.SavedPlayerData[p.UserId] and not (Functions.LaxCheckMatch(Core.SavedPlayerData[p.UserId], data, CompareOptions) or Functions.LaxCheckMatch(data, Core.SavedPlayerData[p.UserId], CompareOptions)) then
Core.SetData(key, data)
Core.SavedPlayerData[p.UserId] = data
AddLog(Logs.Script, {
Text = `Saved data for {p.Name}`;
Desc = "Player data was saved to the datastore";
})
else
AddLog(Logs.Script, {
Text = `Didn't save default data for {p.Name}`;
Desc = "Player data was not saved to the datastore due to it having default values";
})
end
pData.LastDataSave = os.time()
end
end
end;
SaveAllPlayerData = function(queueWaitTime)
local TrackTask = service.TrackTask
for key,pdata in Core.PlayerData do
local id = tonumber(key);
local player = id and service.Players:GetPlayerByUserId(id);
if player and (not pdata.LastDataSave or os.time() - pdata.LastDataSave >= Core.DS_AllPlayerDataSaveInterval) then
TrackTask(string.format("Save data for %s", player.Name), Core.SavePlayerData, player);
end
end
--[[ --// OLD METHOD (Kept in case this messes anything up)
for i,p in service.Players:GetPlayers() do
local pdata = Core.PlayerData[tostring(p.UserId)];
--// Only save player's data if it has not been saved within the last INTERVAL (default 30s)
if pdata and (not pdata.LastDataSave or os.time() - pdata.LastDataSave >= Core.DS_AllPlayerDataSaveInterval) then
service.Queue("SavePlayerData", function()
Core.SavePlayerData(p)
task.wait(queueWaitTime or Core.DS_AllPlayerDataSaveQueueDelay)
end)
end
end--]]
end;
GetDataStore = function()
local ran,store = pcall(function()
return service.DataStoreService:GetDataStore(string.sub(Settings.DataStore, 1, 50),"Adonis")
end)
-- DataStore studio check.
if ran and store and service.RunService:IsStudio() then
local success, res = pcall(store.GetAsync, store, math.random())
if not success and string.find(res, "502", 1, true) then
warn("Unable to load data because Studio access to API services is disabled.")
return;
end
end
return ran and store
end;
DataStoreEncode = function(key)
if Core.DS_RESET_SALTS[key] then
key = Core.DS_RESET_SALTS[key] .. key
end
return Functions.Base64Encode(Remote.Encrypt(tostring(key), Settings.DataStoreKey))
end;
SaveData = function(...)
return Core.SetData(...)
end;
DS_GetRequestDelay = function(reqTypeName: string)
local reqType = assert(
if reqTypeName == "Write" then Enum.DataStoreRequestType.SetIncrementAsync
elseif reqTypeName == "Read" then Enum.DataStoreRequestType.GetAsync
elseif reqTypeName == "Update" then Enum.DataStoreRequestType.UpdateAsync
else nil,
`Invalid request type name '{reqTypeName}'`
)
local reqPerMin = 60 + #service.Players:GetPlayers() * 10
local reqDelay = 60 / reqPerMin
local budget
repeat
budget = service.DataStoreService:GetRequestBudgetForRequestType(reqType);
until budget > 0 and task.wait(1)
return reqDelay + 0.5
end;
DS_WriteLimiter = function(reqTypeName: string, func, ...)
local vararg = table.pack(...)
return Queue(`DataStoreWriteData_{reqTypeName}`, function()
local gotDelay = Core.DS_GetRequestDelay(reqTypeName); --// Wait for budget; also return how long we should wait before the next request is allowed to go
func(unpack(vararg, 1, vararg.n))
task.wait(gotDelay)
end, 120, true)
end;
RemoveData = function(key)
local DataStore = Core.DataStore
if DataStore then
local ran2, err2 = Queue(`DataStoreWriteData{key}`, function()
local ran, ret = Core.DS_WriteLimiter("Write", DataStore.RemoveAsync, DataStore, Core.DataStoreEncode(key))
if ran then
Core.DataCache[key] = nil
else
logError(`DataStore RemoveAsync Failed: {ret}`)
end
task.wait(6)
end, 120, true)
if not ran2 then
warn(`DataStore RemoveData Failed: {err2}`)
end
end
end;
SetData = function(key: string, value: any?, repeatCount: number?)
if repeatCount then
warn(`Retrying SetData request for {key}`);
end
local DataStore = Core.DataStore
if DataStore then
if value == nil then
return Core.RemoveData(key)
else
local ran2, err2 = Queue(`DataStoreWriteData{key}`, function()
local ran, ret = Core.DS_WriteLimiter("Write", DataStore.SetAsync, DataStore, Core.DataStoreEncode(key), value)
if ran then
Core.DataCache[key] = value
else
logError(`DataStore SetAsync Failed: {ret}`);
end
task.wait(6)
end, 120, true)
if not ran2 then
logError(`DataStore SetData Failed: {err2}`)
--// Attempt 3 times, with slight delay between if failed
task.wait(1)
if not repeatCount then
return Core.SetData(key, value, 3);
elseif repeatCount > 0 then
return Core.SetData(key, value, repeatCount - 1);
end
end
end
end
end;
UpdateData = function(key: string, callback: (currentData: any?)->any?, repeatCount: number?)
if repeatCount then
warn(`Retrying UpdateData request for {key}`)
end
local DataStore = Core.DataStore
if DataStore then
local err = false
local ran2, err2 = Queue(`DataStoreWriteData{key}`, function()
local ran, ret = Core.DS_WriteLimiter("Update", DataStore.UpdateAsync, DataStore, Core.DataStoreEncode(key), callback)
if not ran then
err = ret
logError(`DataStore UpdateAsync Failed: {ret}`)
return error(ret)
end
task.wait(6)
end, 120, true) --// 120 timeout, yield until this queued function runs and completes
if not ran2 then
logError(`DataStore UpdateData Failed: {err2}`)
--// Attempt 3 times, with slight delay between if failed
task.wait(1)
if not repeatCount then
return Core.UpdateData(key, callback, 3)
elseif repeatCount > 0 then
return Core.UpdateData(key, callback, repeatCount - 1)
end
end
return err
end
end;
GetData = function(key: string, repeatCount: number?)
if repeatCount then
warn(`Retrying GetData request for {key}`)
end
local DataStore = Core.DataStore
if DataStore then
local ran2, err2 = Queue("DataStoreReadData", function()
--wait(Core.DS_GetRequestDelay("Read")) -- TODO: re-implement this effectively and without an unnecessary delay
local ran, ret = pcall(DataStore.GetAsync, DataStore, Core.DataStoreEncode(key))
if ran then
Core.DataCache[key] = ret
return ret
else
logError(`DataStore GetAsync Failed: {ret}`)
if Core.DataCache[key] then
return Core.DataCache[key]
else
error(ret)
end
end
end, 120, true)
if not ran2 then
logError(`DataStore GetData Failed: {err2}`)
--// Attempt 3 times, with slight delay between if failed
task.wait(1)
if not repeatCount then
return Core.GetData(key, 3)
elseif repeatCount > 0 then
return Core.GetData(key, repeatCount - 1)
end
else
return err2
end
end
end;
IndexPathToTable = function(tableAncestry)
local ds_blacklist = Core.DS_BLACKLIST
if type(tableAncestry) == "string" and not ds_blacklist[tableAncestry] then
return Settings[tableAncestry], tableAncestry
elseif type(tableAncestry) == "table" then
local curTable = server
local curName = "Server"
for index, ind in tableAncestry do
--// Prevent stuff like {t1 = "Settings", t2 = ...} from bypassing datastore blocks
if type(index) ~= 'number' then
return nil
end
curTable = curTable[ind]
curName = ind
if type(curName) == "string" then
--// Admins do NOT load from the DataStore with this setting
if curName == "Ranks" and Settings.LoadAdminsFromDS == false then
return nil
end
end
if not curTable then
--warn(`{ind} could not be found`);
--// Not allowed or table is not found
return nil
end
end
if type(curName) == "string" and ds_blacklist[curName] then
return nil
end
return curTable, curName
end
return nil
end;
ClearAllData = function()
local tabs = Core.GetData("SavedTables") or {}
for _, v in tabs do
if v.TableKey then
Core.RemoveData(v.TableKey)
end
end
Core.SetData("SavedSettings", {})
Core.SetData("SavedTables", {})
Core.CrossServer("LoadData")
end;
GetTableKey = function(indList: {string})
local tabs = Core.GetData("SavedTables") or {}
local realTable, tableName = Core.IndexPathToTable(indList)
local foundTable = nil
for _, v in tabs do
if type(v) == "table" and v.TableName and v.TableName == tableName then
foundTable = v
break
end
end
if not foundTable then
foundTable = {
TableName = tableName;
TableKey = `SAVEDTABLE_{tableName}`;
}
table.insert(tabs, foundTable)
Core.SetData("SavedTables", tabs)
end
if not Core.GetData(foundTable.TableKey) then
Core.SetData(foundTable.TableKey, {})
end
return foundTable.TableKey;
end;
DoSave = function(data: TableData)
if data.Type == "ClearSettings" then
Core.ClearAllData()
elseif data.Type == "SetSetting" then
local setting = data.Setting
local val = data.Value
Core.UpdateData("SavedSettings", function(savedSettings)
savedSettings[setting] = val
return savedSettings
end)
Core.CrossServer("LoadData", "SavedSettings", {[setting] = val})
elseif data.Type == "TableRemove" then
local tab = data.Table
local val = data.Value
local key = Core.GetTableKey(tab)
--// Storing an old reference of data.Table as we may override it later on.
local originalTable = tab
if type(tab) == "string" then
tab = {"Settings", tab}
elseif type(tab) == "table" and tab[1] == "Settings" then
originalTable = tab[2]
end
data.Action = "Remove"
data.Time = os.time()
local CheckMatch = if type(data) == "table" and data.LaxCheck then Functions.LaxCheckMatch else Functions.CheckMatch
Core.UpdateData(key, function(sets)
sets = sets or {}
local index = 1
for i, v in sets do
if type(i) ~= "number" then
sets[i] = nil
elseif (CheckMatch(tab, v.Table) or CheckMatch(originalTable, v.Table)) and CheckMatch(v.Value, val) then
table.remove(sets, index)
else
index += 1
end
end
--// Check that the real table actually has the item to remove; do not create if it does not have it
--// (prevents snowballing)
local continueOperation = false
if tab[1] == "Settings" or tab[2] == "Settings" then
local indClone = table.clone(tab)
indClone[1] = "OriginalSettings"
for _, v in pairs(Core.IndexPathToTable(indClone) or {}) do
if CheckMatch(v, val) then
continueOperation = true
break
end
end
end
return sets
end)
Core.CrossServer("LoadData", "TableUpdate", data)
elseif data.Type == "TableAdd" then
local tab = data.Table
local originalTable = tab
local val = data.Value
local key = Core.GetTableKey(tab)
if type(tab) == "string" then
tab = {"Settings", tab}
end
data.Action = "Add"
data.Time = os.time()
local CheckMatch = if type(data) == "table" and data.LaxCheck then Functions.LaxCheckMatch else Functions.CheckMatch
Core.UpdateData(key, function(sets: {TableData})
sets = sets or {}
local index = 1
for i, v in sets do
if type(i) ~= "number" then
sets[i] = nil
elseif (CheckMatch(tab, v.Table) or CheckMatch(originalTable, v.Table)) and CheckMatch(v.Value, val) then
table.remove(sets, index)
else
index += 1
end
end
--// Check that the real table does not already have the item to add; do not create if it has it
--// (prevents snowballing)
local continueOperation = true
if tab[1] == "Settings" or tab[2] == "Settings" then
local indClone = table.clone(tab)
indClone[1] = "OriginalSettings"
for _, v in Core.IndexPathToTable(indClone) or {} do
if CheckMatch(v, val) then
continueOperation = false
break
end
end
end
if continueOperation then
table.insert(sets, data)
end
return sets
end)
Core.CrossServer("LoadData", "TableUpdate", data)
else
error(`Invalid data action type '{data.Type}'`, 2)
end
AddLog(Logs.Script, {
Text = "Saved setting change to datastore";
Desc = `A setting change was issued and saved ({data.Type})`;
})
end;
LoadData = function(key: string, data: TableData, serverId: string?)
if serverId and serverId == game.JobId then
return
end
local CheckMatch = if type(data) == "table" and data.LaxCheck then Functions.LaxCheckMatch else Functions.CheckMatch
local ds_blacklist = Core.DS_BLACKLIST
if key == "TableUpdate" then
local indList = data.Table
local nameRankComp = { --// Old settings backwards compatability
Owners = { "Settings", "Ranks", "HeadAdmins", "Users" },
Creators = { "Settings", "Ranks", "Creators", "Users" },
HeadAdmins = { "Settings", "Ranks", "HeadAdmins", "Users" },
Admins = { "Settings", "Ranks", "Admins", "Users" },
Moderators = { "Settings", "Ranks", "Moderators", "Users" },
}
if type(indList) == "string" and nameRankComp[indList] then
indList = nameRankComp[indList]
end
local realTable, tableName = Core.IndexPathToTable(indList)
local displayName = type(indList) == "table" and table.concat(indList, ".") or tableName
if type(displayName) == "string" then
if ds_blacklist[displayName] then
return
end
if type(indList) == "table" and indList[1] == "Settings" and indList[2] == "Ranks" then
if
not Settings.SaveAdmins
and not Core.WarnedAboutAdminsLoadingWhenSaveAdminsIsOff
and not Settings.SaveAdminsWarning
and Settings.LoadAdminsFromDS
then
warn(
'Admins are loading from the Adonis DataStore when Settings.SaveAdmins is FALSE!\nDisable this warning by adding the setting "SaveAdminsWarning" in Settings (and set it to true!) or set Settings.LoadAdminsFromDS to false'
)
Core.WarnedAboutAdminsLoadingWhenSaveAdminsIsOff = true
end
--// No adding to Trello or WebPanel rank users list via Datastore
if type(indList[3]) == 'string' and (indList[3]:match("Trello") or indList[3]:match("WebPanel")) then
return
end
end
end
if realTable and data.Action == "Add" then
for i, v in realTable do
if CheckMatch(v, data.Value) then
table.remove(realTable, i)
end
end
AddLog("Script", {
Text = `Added value to {displayName}`,
Desc = `Added {data.Value} to {displayName} from datastore`,
})
table.insert(realTable, data.Value)
service.Events[`DataStoreAdd_{displayName}`]:Fire(data.Value)
elseif realTable and data.Action == "Remove" then
for i, v in realTable do
if CheckMatch(v, data.Value) then
AddLog("Script", {
Text = `Removed value from {displayName}`,
Desc = `Removed {data.Value} from {displayName} from datastore`,
})
table.remove(realTable, i)
end
end
end
else
local SavedSettings
local SavedTables
if Core.DataStore and Settings.DataStoreEnabled then
local GetData, LoadData, SaveData, DoSave = Core.GetData, Core.LoadData, Core.SaveData, Core.DoSave
if not key then
SavedSettings = GetData("SavedSettings")
SavedTables = GetData("SavedTables")
elseif key and not data then
if key == "SavedSettings" then
SavedSettings = GetData("SavedSettings")
elseif key == "SavedTables" then
SavedTables = GetData("SavedTables")
end
elseif key and data then
if key == "SavedSettings" then
SavedSettings = data
elseif key == "SavedTables" then
SavedTables = data
end
end
if not key and not data then
if not SavedSettings then
SavedSettings = {}
SaveData("SavedSettings", {})
end
if not SavedTables then
SavedTables = {}
SaveData("SavedTables", {})
end
end
if SavedSettings then
for setting, value in SavedSettings do
if not ds_blacklist[setting] then
if setting == "Prefix" or setting == "AnyPrefix" or setting == "SpecialPrefix" then
local orig = Settings[setting]
for _, cmd in server.Commands do
if cmd.Prefix == orig then
cmd.Prefix = value
end
end
end
Settings[setting] = value
end
end
end
if SavedTables then
for _, tData in SavedTables do
if tData.TableName and tData.TableKey and not ds_blacklist[tData.TableName] then
local data = GetData(tData.TableKey)
if data then
for _, v in data do
LoadData("TableUpdate", v)
end
end
elseif tData.Table and tData.Action then
LoadData("TableUpdate", tData)
end
end
if Core.Variables.TimeBans then
for i, v in Core.Variables.TimeBans do
if v.EndTime - os.time() <= 0 then
table.remove(Core.Variables.TimeBans, i)
DoSave({
Type = "TableRemove",
Table = { "Core", "Variables", "TimeBans" },
Value = v,
LaxCheck = true,
})
end
end
end
end
AddLog(Logs.Script, {
Text = "Loaded saved data",
Desc = "Data was retrieved from the datastore and loaded successfully",
})
end
end
end,
StartAPI = function()
local _G = _G
local setmetatable = setmetatable
local rawset = rawset
local rawget = rawget
local type = type
local error = error
local print = print
local warn = warn
local pairs = pairs
local next = next
local table = table
local getfenv = getfenv
local setfenv = setfenv
local require = require
local tostring = tostring
local server = server
local service = service
local Routine = env.Routine
local cPcall = env.cPcall
local MetaFunc = service.MetaFunc
local StartLoop = service.StartLoop
local API_Special = {
AddAdmin = Settings.Allowed_API_Calls.DataStore;
RemoveAdmin = Settings.Allowed_API_Calls.DataStore;
RunCommand = Settings.Allowed_API_Calls.Core;
SaveTableAdd = Settings.Allowed_API_Calls.DataStore and Settings.Allowed_API_Calls.Settings;
SaveTableRemove = Settings.Allowed_API_Calls.DataStore and Settings.Allowed_API_Calls.Settings;
SaveSetSetting = Settings.Allowed_API_Calls.DataStore and Settings.Allowed_API_Calls.Settings;
ClearSavedSettings = Settings.Allowed_API_Calls.DataStore and Settings.Allowed_API_Calls.Settings;
SetSetting = Settings.Allowed_API_Calls.Settings;
}
setfenv(1,setmetatable({}, {__metatable = getmetatable(getfenv())}))
local API_Specific = {
API_Specific = {
Test = function()
print("We ran the api specific stuff")
end
};
Settings = Settings;
Service = service;
}
local API = {
Access = MetaFunc(function(...)
local args = {...}
local key = args[1]
local ind = args[2]
local targ
if API_Specific[ind] then
targ = API_Specific[ind]
elseif server[ind] and Settings.Allowed_API_Calls[ind] then
targ = server[ind]
end
if Settings.G_Access and key == Settings.G_Access_Key and targ and Settings.Allowed_API_Calls[ind] == true then
if type(targ) == "table" then
return service.NewProxy {
__index = function(tab,inde)
if targ[inde] ~= nil and API_Special[inde] == nil or API_Special[inde] == true then
AddLog(Logs.Script, {
Text = `Access to {inde} was granted`;
Desc = `A server script was granted access to {inde}`;
})
if targ[inde]~=nil and type(targ[inde]) == "table" and Settings.G_Access_Perms == "Read" then
return service.ReadOnly(targ[inde])
else
return targ[inde]
end
elseif API_Special[inde] == false then
AddLog(Logs.Script, {
Text = `Access to {inde} was denied`;
Desc = `A server script attempted to access {inde} via _G.Adonis.Access`;
})
error(`Access Denied: {inde}`)
else
error(`Could not find {inde}`)
end
end;
__newindex = function(tabl, inde, valu)
if Settings.G_Access_Perms == "Read" then
error("Read-only")
elseif Settings.G_Access_Perms == "Write" then
tabl[inde] = valu
end
end;
__metatable = true;
}
end
else
error("Incorrect key or G_Access is disabled")
end
end);
Scripts = service.ReadOnly({
ExecutePermission = MetaFunc(function(srcScript, code)
local exists;
for _, v in Core.ScriptCache do
if v.Script == srcScript then
exists = v
end
end
if exists and exists.noCache ~= true and (not exists.runLimit or (exists.runLimit and exists.Executions <= exists.runLimit)) then
exists.Executions += 1
return exists.Source, exists.Loadstring
end
local data = Core.ExecutePermission(srcScript, code)
if data and data.Source then
local module;
if not exists then
module = require(server.Shared.FiOne:Clone())
table.insert(Core.ScriptCache, {
Script = srcScript;
Source = data.Source;
Loadstring = module;
noCache = data.noCache;
runLimit = data.runLimit;
Executions = data.Executions;
})
else
module = exists.Loadstring
exists.Source = data.Source
end
return data.Source, module
end
end);
}, nil, nil, true);
CheckAdmin = MetaFunc(Admin.CheckAdmin);
IsAdmin = MetaFunc(Admin.CheckAdmin);
IsBanned = MetaFunc(Admin.CheckBan);
IsMuted = MetaFunc(Admin.IsMuted);
CheckDonor = MetaFunc(Admin.CheckDonor);
GetLevel = MetaFunc(Admin.GetLevel);
SetLighting = MetaFunc(Functions.SetLighting);
SetPlayerLighting = MetaFunc(Remote.SetLighting);
NewParticle = MetaFunc(Functions.NewParticle);
RemoveParticle = MetaFunc(Functions.RemoveParticle);
NewLocal = MetaFunc(Remote.NewLocal);
MakeLocal = MetaFunc(Remote.MakeLocal);
MoveLocal = MetaFunc(Remote.MoveLocal);
RemoveLocal = MetaFunc(Remote.RemoveLocal);
Hint = MetaFunc(Functions.Hint);
Message = MetaFunc(Functions.Message);
RunCommandAsNonAdmin = MetaFunc(Admin.RunCommandAsNonAdmin);
}
local AdonisGTable = service.NewProxy({
__index = function(tab,ind)
if Settings.G_API then
return API[ind]
elseif ind == "Scripts" then
return API.Scripts
else
error("_G API is disabled")
end
end;
__newindex = function()
error("Read-only")
end;
__metatable = true;
})
if not rawget(_G, "Adonis") then
if table.isfrozen and not table.isfrozen(_G) or not table.isfrozen then
rawset(_G, "Adonis", AdonisGTable)
StartLoop("APICheck", 1, function()
if rawget(_G, "Adonis") ~= AdonisGTable then
if table.isfrozen and not table.isfrozen(_G) or not table.isfrozen then
rawset(_G, "Adonis", AdonisGTable)
else
warn("⚠️ ADONIS CRITICAL WARNING! MALICIOUS CODE IS TRYING TO CHANGE THE ADONIS _G API AND IT CAN'T BE SET BACK! PLEASE SHUTDOWN THE SERVER AND REMOVE THE MALICIOUS CODE IF POSSIBLE!")
end
end
end, true)
else
warn("The _G table was locked and the Adonis _G API could not be loaded")
end
end
AddLog(Logs.Script, {
Text = "Started _G API";
Desc = "The Adonis _G API was initialized and is ready to use";
})
end;
};
end
|
--- Cleans up the Tasks assigned to the Maid
-- This Disconnects RBXScriptConnections, Destroys Instances, and calls Functions/callable Tables |
function Maid:DoCleaning()
local Tasks = self._Tasks
for Name, Task in next, Tasks do
local Type = typeof(Task)
local IsTable = Type == "table"
if Type == "RBXScriptConnection" or IsTable and Task.Disconnect then
Task:Disconnect()
elseif Type == "Instance" or IsTable and Task.Destroy then
Task:Destroy()
else
Task()
end
Tasks[Name] = nil
end
end
Maid.Disconnect = Maid.DoCleaning
Maid.Destroy = Maid.DoCleaning
|
--[[
Connect to the datastore, set up connections and create resources used by
the server
Parameters:
configValues: A table containing configuration values
]] |
local function setup(configValues)
local tokenDataStore = DataStoreService:GetDataStore(configValues.datastoreName)
tokenManager = TokenManager.new(tokenDataStore)
local tokens = CollectionService:GetTagged(configValues.tokenTag)
local resetOnPlayerRemoving = configValues.resetOnPlayerRemoving
tokenManager:setTokens(tokens)
connections[1] = CollectionService
:GetInstanceAddedSignal(configValues.tokenTag)
:Connect(onTokenAdded(remoteEvents, tokenManager))
connections[2] = CollectionService
:GetInstanceRemovedSignal(configValues.tokenTag)
:Connect(onTokenRemoved(remoteEvents, tokenManager))
connections[3] = Players.PlayerAdded:Connect(onPlayerAdded(remoteEvents, tokenDataStore, tokenManager))
connections[4] = Players.PlayerRemoving:Connect(
onPlayerRemoved(tokenDataStore, tokenManager, resetOnPlayerRemoving)
)
connections[5] = events.disable.Event:Connect(onHuntDisabled(tokenManager))
connections[6] = events.enable.Event:Connect(onHuntEnabled(tokenManager))
end
config.changed:Connect(function(configValues)
-- Clean up old data if it exists
disconnectOldConnections()
if tokenManager then
tokenManager:cleanupTokens()
end
setup(configValues)
end)
setup(config.getValues())
|
--[[
A 'Symbol' is an opaque marker type, implemented to behave similarly to JS:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol
]] |
local Symbol = require(script.Symbol)
export type Symbol = Symbol.Symbol
local GlobalRegistry = require(script.GlobalRegistry)
local SymbolObject = setmetatable({}, {
--[[
Creates a new symbol, using the given name when printed. Symbols are
opaque, so this will always create a new, unique object
]]
__call = function(_, name: string?): Symbol.Symbol
return Symbol.new(name)
end,
})
SymbolObject.for_ = GlobalRegistry.getOrInit
return SymbolObject
|
--!strict |
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local constants = {
-- The location where all DevModules are moved at runtime. Note that a DevModule
-- is moved after its scripts and other instances have been moved to their
-- proper locations. What remains of the DevModule is the Packages folder, and
-- any ModuleScripts that are used by the DevModule.
DEV_MODULE_STORAGE = ReplicatedStorage,
-- DevModules rely on dependencies. By convention, these are stored in a folder
-- named "Packages" inside the root of the DevModule. At runtime, the Packages
-- folders from every DevModule are deduplicated, resulting in only one version
-- of each package in use across all the DevModules in the game
PACKAGE_NAME = "Packages",
PACKAGE_STORAGE_LOCATION = ReplicatedStorage,
PACKAGE_STORAGE_NAME = "DevModulePackages",
PACKAGE_REF = script.Parent.packageRef,
-- The version of a package is controlled by a StringValue included as a child
-- of the package. This constant controls the name of that StringValue.
--
-- Initially we wanted to use Attributes for the version, however Rojo does not
-- support syncing Attributes yet. As such, we've opted to go the old fashioned
-- way of including a StringValue.
PACKAGE_VERSION_NAME = "_Version",
PACKAGE_VERSION_OBJECT_MISSING = "%s is missing a %s StringValue at %s",
PACKAGE_VERSION_EMPTY = "%s cannot have an empty value for its version at %s",
ENABLED_SCRIPTS_ERROR = "All scripts included with a DevModule must be Disabled. Please disable the "
.. "following script(s): %s",
}
return constants
|
-- Also returns nil for speedyness |
function DataStoreStage:_promiseInvokeSavingCallbacks()
if not next(self._savingCallbacks) then
return nil
end
local removingPromises = {}
for _, func in pairs(self._savingCallbacks) do
local result = func()
if Promise.isPromise(result) then
table.insert(removingPromises, result)
end
end
for _, substore in pairs(self._stores) do
local promise = substore:_promiseInvokeSavingCallbacks()
if promise then
table.insert(removingPromises, promise)
end
end
return PromiseUtils.all(removingPromises)
end
|
--[[
Calls awaitStatus internally, returns (isResolved, values...)
]] |
function Promise.prototype:await()
return awaitHelper(self:awaitStatus())
end
Promise.prototype.Await = Promise.prototype.await
local function expectHelper(status, ...)
if status ~= Promise.Status.Resolved then
error((...) == nil and "Expected Promise rejected with no value." or (...), 3)
end
return ...
end
|
--Made by Luckymaxer |
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Players = game:GetService("Players")
Debris = game:GetService("Debris")
RunService = game:GetService("RunService")
UserInputService = game:GetService("UserInputService")
AmmoDisplay = script:WaitForChild("AmmoDisplay"):Clone()
CastLaser = Tool:WaitForChild("CastLaser"):Clone()
Camera = game:GetService("Workspace").CurrentCamera
BaseUrl = "http://www.roblox.com/asset/?id="
AnimationTracks = {}
LocalObjects = {}
Animations = {
Hold = {Animation = Tool:WaitForChild("Hold"), FadeTime = nil, Weight = nil, Speed = 1, Duration = 2},
Fire = {Animation = Tool:WaitForChild("Fire"), FadeTime = 0.25, Weight = nil, Speed = 0.5, Duration = 0.5},
Reload = {Animation = Tool:WaitForChild("Reload"), FadeTime = nil, Weight = nil, Speed = 1, Duration = 2},
}
Sounds = {
Reload = Handle:WaitForChild("Reload"),
NoAmmo = Handle:WaitForChild("NoAmmo"),
}
Modules = Tool:WaitForChild("Modules")
Functions = require(Modules:WaitForChild("Functions"))
Remotes = Tool:WaitForChild("Remotes")
ServerControl = Remotes:WaitForChild("ServerControl")
ClientControl = Remotes:WaitForChild("ClientControl")
ConfigurationBin = Tool:WaitForChild("Configuration")
Configuration = {}
Configuration = Functions.CreateConfiguration(ConfigurationBin, Configuration)
InputCheck = Instance.new("ScreenGui")
InputCheck.Name = "InputCheck"
InputButton = Instance.new("ImageButton")
InputButton.Name = "InputButton"
InputButton.Image = ""
InputButton.BackgroundTransparency = 1
InputButton.ImageTransparency = 1
InputButton.Size = UDim2.new(1, 0, 1, 0)
InputButton.Parent = InputCheck
Cursors = {
Normal = (BaseUrl .. "170908665"),
EnemyHit = (BaseUrl .. "172618259"),
}
Rate = (1 / 60)
FiringOffset = Vector3.new(0, ((Handle.Size.Y / 4) - 0.2), -(Handle.Size.Z / 2))
Reloading = false
MouseDown = false
ToolEquipped = false
Tool.Enabled = true
function SetAnimation(mode, value)
if mode == "PlayAnimation" and value and ToolEquipped and Humanoid then
for i, v in pairs(AnimationTracks) do
if v.Animation == value.Animation then
v.AnimationTrack:Stop()
table.remove(AnimationTracks, i)
end
end
local AnimationTrack = Humanoid:LoadAnimation(value.Animation)
table.insert(AnimationTracks, {Animation = value.Animation, AnimationTrack = AnimationTrack})
AnimationTrack:Play(value.FadeTime, value.Weight, value.Speed)
elseif mode == "StopAnimation" and value then
for i, v in pairs(AnimationTracks) do
if v.Animation == value.Animation then
v.AnimationTrack:Stop(value.FadeTime)
table.remove(AnimationTracks, i)
end
end
end
end
function ToggleGui()
if not AmmoDisplayClone or not AmmoDisplayClone.Parent then
return
end
local Frame = AmmoDisplayClone.Frame
local Ammo = Frame.Ammo
if Configuration.Ammo.ClipSize.MaxValue > 0 then
Ammo.AmmoCounter.CounterPart.Text = Configuration.Ammo.ClipSize.Value
end
Ammo.MagCounter.CounterPart.Text = Configuration.Ammo.Magazines.Value
end
function Reload()
if Reloading or not Tool.Enabled or Configuration.Ammo.Magazines.Value >= Configuration.Ammo.Magazines.MaxValue then
return
end
Tool.Enabled = false
Reloading = true
ToggleGui()
local CanReload = true
if Configuration.Ammo.ClipSize.MaxValue > 0 and Configuration.Ammo.ClipSize.Value <= 0 then
CanReload = false
else
CanReload = true
end
if CanReload then
Spawn(function()
local Animation = Animations.Reload
OnClientInvoke("PlayAnimation", Animation)
wait(Animation.Duration)
OnClientInvoke("StopAnimation", Animation)
end)
Sounds.Reload:Play()
script.Parent.rld:FireServer()
local AddedClips = ((Configuration.Ammo.Magazines.MaxValue > 0 and (Configuration.Ammo.Magazines.MaxValue - Configuration.Ammo.Magazines.Value)) or Configuration.Ammo.ClipSize.MaxValue)
if Configuration.Ammo.ClipSize.MaxValue > 0 then
AddedClips = ((AddedClips > Configuration.Ammo.ClipSize.Value and Configuration.Ammo.ClipSize.Value) or AddedClips)
end
--[[local ReloadRate = (Configuration.ReloadTime.Value / Configuration.Ammo.Magazines.MaxValue)
for i = 1, AddedClips do
wait(ReloadTime)
Configuration.Ammo.Magazines.Value = (Configuration.Ammo.Magazines.Value + 1)
end]]
wait(Configuration.ReloadTime.Value)
Configuration.Ammo.Magazines.Value = (Configuration.Ammo.Magazines.Value + AddedClips)
Configuration.Ammo.ClipSize.Value = (Configuration.Ammo.ClipSize.Value - AddedClips)
Sounds.Reload:Stop()
ToggleGui()
end
Reloading = false
Tool.Enabled = true
end
function RayTouched(Hit, Position)
if not Hit or not Hit.Parent then
return
end
local character = Hit.Parent
if character:IsA("Hat") then
character = character.Parent
end
if character == Character then
return
end
local humanoid = character:FindFirstChild("Humanoid")
local SoundChosen = Sounds.RayHit
if not humanoid or humanoid.Health == 0 then
return
end
local player = Players:GetPlayerFromCharacter(character)
if player and Functions.IsTeamMate(Player, player) then
return
end
Spawn(function()
IconChangeTick = tick()
PlayerMouse.Icon = Cursors.EnemyHit
wait(1)
if (tick() - IconChangeTick) >= 0.95 and ToolEquipped and PlayerMouse then
PlayerMouse.Icon = Cursors.Normal
end
end)
end
function FireRay(StartPosition, TargetPosition)
local Direction = CFrame.new(StartPosition, TargetPosition).lookVector
local RayHit, RayPos, RayNormal = Functions.CastRay(StartPosition, Direction, Configuration.Range.Value, {Character}, false)
local Backpack = Player:FindFirstChild("Backpack")
if Backpack then
local LaserScript = CastLaser:Clone()
local StartPos = Instance.new("Vector3Value")
StartPos.Name = "StartPosition"
StartPos.Value = StartPosition
StartPos.Parent = LaserScript
local TargetPos = Instance.new("Vector3Value")
TargetPos.Name = "TargetPosition"
TargetPos.Value = RayPos
TargetPos.Parent = LaserScript
local RayHit = Instance.new("BoolValue")
RayHit.Name = "RayHit"
RayHit.Value = RayHit
RayHit.Parent = LaserScript
LaserScript.Disabled = false
LaserScript.Parent = Backpack
end
Spawn(function()
InvokeServer("CastLaser", {StartPosition = StartPosition, TargetPosition = RayPos, RayHit = ((RayHit and true) or false)})
end)
Spawn(function()
InvokeServer("RayHit", {Hit = RayHit, Position = RayPos})
end)
RayTouched(RayHit, RayPos)
end
function Button1Pressed(Down)
if not Down and MouseDown then
MouseDown = false
end
end
function KeyPress(Key, Down)
if Key == "r" and Down then
Reload()
end
end
function Activated()
if not Tool.Enabled or not ToolEquipped or Reloading then
return
end
Tool.Enabled = false
if Configuration.Ammo.Magazines.Value > 0 then
local FirstShot = false
if Configuration.Automatic.Value then
MouseDown = true
end
OnClientInvoke("StopAnimation", {Animation = Animations.Fire.Animation, FadeTime = nil})
OnClientInvoke("PlayAnimation", Animations.Fire)
while MouseDown or not FirstShot and ToolEquipped and CheckIfAlive() do
if Configuration.Ammo.Magazines.Value <= 0 or not ToolEquipped or not CheckIfAlive() then
break
end
if not FirstShot then
FirstShot = true
end
local BurstAmount = math.random(Configuration.Burst.Bullets.MinValue, Configuration.Burst.Bullets.MaxValue)
local WithinFiringRange = false
Spawn(function()
InvokeServer("Fire", true)
end)
for i = 1, ((BurstAmount > 0 and BurstAmount) or 1) do
local TargetPosition = OnClientInvoke("MousePosition")
if not TargetPosition then
break
end
TargetPosition = TargetPosition.Position
local StartPosition = (Handle.CFrame * CFrame.new(FiringOffset.X, FiringOffset.Y, FiringOffset.Z)).p
if BurstAmount > 0 then
local Offset = (Configuration.Burst.Offset.Value * 100)
TargetPosition = TargetPosition + Vector3.new((math.random(-Offset.X, Offset.X) * 0.01), (math.random(-Offset.Y, Offset.Y) * 0.01), (math.random(-Offset.Z, Offset.Z) * 0.01))
end
local Accuracy = (Configuration.Accuracy.Value * 100)
TargetPosition = TargetPosition + Vector3.new((math.random(-Accuracy.X, Accuracy.X) * 0.01), (math.random(-Accuracy.Y, Accuracy.Y) * 0.01), (math.random(-Accuracy.Z, Accuracy.Z) * 0.01))
Configuration.Ammo.Magazines.Value = (Configuration.Ammo.Magazines.Value - 1)
FireRay(StartPosition, TargetPosition)
end
ToggleGui()
wait(Configuration.FireRate.Value)
end
OnClientInvoke("StopAnimation", {Animation = Animations.Fire.Animation, FadeTime = 0.25})
else
Tool.Enabled = true
Sounds.NoAmmo:Play()
Reload()
end
MouseDown = false
Tool.Enabled = true
if Configuration.Ammo.Magazines.Value <= 0 then
Sounds.NoAmmo:Play()
Reload()
end
end
function CheckIfAlive()
return (((Player and Player.Parent and Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0) and true) or false)
end
function Equipped(Mouse)
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChild("Humanoid")
if not CheckIfAlive() then
return
end
ToolEquipped = true
Spawn(function()
PlayerMouse = Player:GetMouse()
Mouse.Button1Down:connect(function()
Button1Pressed(true)
end)
Mouse.Button1Up:connect(function()
Button1Pressed(false)
end)
Mouse.KeyDown:connect(function(Key)
KeyPress(Key, true)
end)
Mouse.KeyUp:connect(function(Key)
KeyPress(Key, false)
end)
Humanoid.CameraOffset = Vector3.new(0, 0.35, 0)
OnClientInvoke("PlayAnimation", Animations.Hold)
local PlayerGui = Player:FindFirstChild("PlayerGui")
if PlayerGui then
if UserInputService.TouchEnabled then
InputCheckClone = InputCheck:Clone()
InputCheckClone.InputButton.InputBegan:connect(function()
InvokeServer("Button1Click", {Down = true})
end)
InputCheckClone.InputButton.InputEnded:connect(function()
InvokeServer("Button1Click", {Down = false})
end)
InputCheckClone.Parent = PlayerGui
end
local function AdjustAmmoDisplay()
local Frame = AmmoDisplayClone.Frame
Frame.CurrentWeapon.Text = script.Parent.Name
local Ammo = Frame.Ammo
Ammo.AmmoCounter.CounterPart.Text = ((Configuration.Ammo.ClipSize.MaxValue > 0 and Configuration.Ammo.ClipSize.Value) or "--")
Ammo.MagCounter.CounterPart.Text = Configuration.Ammo.Magazines.Value
end
AmmoDisplayClone = AmmoDisplay:Clone()
AdjustAmmoDisplay()
AmmoDisplayClone.Parent = PlayerGui
ToggleGui()
for i, v in pairs({ClipSizeChanged, MagazinesChanged}) do
if v then
v:disconnect()
end
end
ClipSizeChanged = Configuration.Ammo.ClipSize.Changed:connect(function()
AdjustAmmoDisplay()
end)
MagazinesChanged = Configuration.Ammo.Magazines.Changed:connect(function()
AdjustAmmoDisplay()
end)
end
for i, v in pairs({"Left Arm", "Right Arm"}) do
local Arm = Character:FindFirstChild(v)
if Arm then
Spawn(function()
OnClientInvoke("SetLocalTransparencyModifier", {Object = Arm, Transparency = 0, AutoUpdate = false})
end)
end
end
Mouse.Icon = Cursors.Normal
end)
end
function Unequipped()
LocalObjects = {}
if CheckIfAlive() then
Humanoid.CameraOffset = Vector3.new(0, 0, 0)
end
for i, v in pairs(Sounds) do
v:Stop()
end
if PlayerMouse then
PlayerMouse.Icon = ""
end
for i, v in pairs({InputCheckClone, ObjectLocalTransparencyModifier, AmmoDisplayClone, ClipSizeChanged, MagazinesChanged}) do
if tostring(v) == "Connection" then
v:disconnect()
elseif v and v.Parent then
v:Destroy()
end
end
MouseDown = false
for i, v in pairs(AnimationTracks) do
if v and v.AnimationTrack then
v.AnimationTrack:Stop()
end
end
AnimationTracks = {}
ToolEquipped = false
end
function InvokeServer(mode, value)
pcall(function()
local ServerReturn = ServerControl:InvokeServer(mode, value)
return ServerReturn
end)
end
function OnClientInvoke(mode, value)
if mode == "PlayAnimation" and value and ToolEquipped and Humanoid then
SetAnimation("PlayAnimation", value)
elseif mode == "StopAnimation" and value then
SetAnimation("StopAnimation", value)
elseif mode == "PlaySound" and value then
value:Play()
elseif mode == "StopSound" and value then
value:Stop()
elseif mode == "MousePosition" then
return {Position = PlayerMouse.Hit.p, Target = PlayerMouse.Target}
elseif mode == "SetLocalTransparencyModifier" and value and ToolEquipped then
pcall(function()
local ObjectFound = false
for i, v in pairs(LocalObjects) do
if v == value then
ObjectFound = true
end
end
if not ObjectFound then
table.insert(LocalObjects, value)
if ObjectLocalTransparencyModifier then
ObjectLocalTransparencyModifier:disconnect()
end
ObjectLocalTransparencyModifier = RunService.RenderStepped:connect(function()
for i, v in pairs(LocalObjects) do
if v.Object and v.Object.Parent then
local CurrentTransparency = v.Object.LocalTransparencyModifier
if ((not v.AutoUpdate and (CurrentTransparency == 1 or CurrentTransparency == 0)) or v.AutoUpdate) then
v.Object.LocalTransparencyModifier = v.Transparency
end
else
table.remove(LocalObjects, i)
end
end
end)
end
end)
end
end
ClientControl.OnClientInvoke = OnClientInvoke
Tool.Activated:connect(Activated)
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
|
--//Services//-- |
local TweenService = game:GetService("TweenService")
local Debris = game:GetService("Debris")
|
-- Note: DotProduct check in CoordinateFrame::lookAt() prevents using values within about
-- 8.11 degrees of the +/- Y axis, that's why these limits are currently 80 degrees |
local MIN_Y = math.rad(0)
local MAX_Y = math.rad(0)
local VR_ANGLE = math.rad(15)
local VR_LOW_INTENSITY_ROTATION = Vector2.new(math.rad(15), 0)
local VR_HIGH_INTENSITY_ROTATION = Vector2.new(math.rad(45), 0)
local VR_LOW_INTENSITY_REPEAT = 0.1
local VR_HIGH_INTENSITY_REPEAT = 0.4
local ZERO_VECTOR2 = Vector2.new(0,0)
local ZERO_VECTOR3 = Vector3.new(0,0,0)
local SEAT_OFFSET = Vector3.new(0,5,0)
local VR_SEAT_OFFSET = Vector3.new(0,4,0)
local HEAD_OFFSET = Vector3.new(0,1.5,0)
local R15_HEAD_OFFSET = Vector3.new(0, 1.5, 0)
local R15_HEAD_OFFSET_NO_SCALING = Vector3.new(0, 2, 0)
local HUMANOID_ROOT_PART_SIZE = Vector3.new(2, 2, 1)
local GAMEPAD_ZOOM_STEP_1 = 0
local GAMEPAD_ZOOM_STEP_2 = 10
local GAMEPAD_ZOOM_STEP_3 = 20
local ZOOM_SENSITIVITY_CURVATURE = 0.5
local FIRST_PERSON_DISTANCE_MIN = 0.5
local CameraUtils = require(script.Parent:WaitForChild("CameraUtils"))
local ZoomController = require(script.Parent:WaitForChild("ZoomController"))
local CameraToggleStateController = require(script.Parent:WaitForChild("CameraToggleStateController"))
local CameraInput = require(script.Parent:WaitForChild("CameraInput"))
local CameraUI = require(script.Parent:WaitForChild("CameraUI"))
|
--//Controller//-- |
PlayerEvent.OnServerEvent:Connect(function(Player, X, Z)
if not Chunks:FindFirstChild(X..", "..Z) then
CreateNewChunk(X, Z)
end
end)
|
-- Implementation for Lua 5.1/5.2 (with or without bitwise library available) |
local function sha256_feed_64(H, str, offs, size)
-- offs >= 0, size >= 0, size is multiple of 64
local W, K = common_W, sha2_K_hi
local h1, h2, h3, h4, h5, h6, h7, h8 = H[1], H[2], H[3], H[4], H[5], H[6], H[7], H[8]
for pos = offs, offs + size - 1, 64 do
for j = 1, 16 do
pos = pos + 4
local a, b, c, d = string.byte(str, pos - 3, pos)
W[j] = ((a * 256 + b) * 256 + c) * 256 + d
end
for j = 17, 64 do
local a, b = W[j - 15], W[j - 2]
W[j] = bit32_bxor(bit32_rrotate(a, 7), bit32_lrotate(a, 14), bit32_rshift(a, 3)) + bit32_bxor(bit32_lrotate(b, 15), bit32_lrotate(b, 13), bit32_rshift(b, 10)) + W[j - 7] + W[j - 16]
end
local a, b, c, d, e, f, g, h = h1, h2, h3, h4, h5, h6, h7, h8
for j = 1, 64 do
local z = bit32_bxor(bit32_rrotate(e, 6), bit32_rrotate(e, 11), bit32_lrotate(e, 7)) + bit32_band(e, f) + bit32_band(-1 - e, g) + h + K[j] + W[j]
h = g
g = f
f = e
e = z + d
d = c
c = b
b = a
a = z + bit32_band(d, c) + bit32_band(a, bit32_bxor(d, c)) + bit32_bxor(bit32_rrotate(a, 2), bit32_rrotate(a, 13), bit32_lrotate(a, 10))
end
h1, h2, h3, h4 = (a + h1) % 4294967296, (b + h2) % 4294967296, (c + h3) % 4294967296, (d + h4) % 4294967296
h5, h6, h7, h8 = (e + h5) % 4294967296, (f + h6) % 4294967296, (g + h7) % 4294967296, (h + h8) % 4294967296
end
H[1], H[2], H[3], H[4], H[5], H[6], H[7], H[8] = h1, h2, h3, h4, h5, h6, h7, h8
end
local function sha512_feed_128(H_lo, H_hi, str, offs, size)
-- offs >= 0, size >= 0, size is multiple of 128
-- W1_hi, W1_lo, W2_hi, W2_lo, ... Wk_hi = W[2*k-1], Wk_lo = W[2*k]
local W, K_lo, K_hi = common_W, sha2_K_lo, sha2_K_hi
local h1_lo, h2_lo, h3_lo, h4_lo, h5_lo, h6_lo, h7_lo, h8_lo = H_lo[1], H_lo[2], H_lo[3], H_lo[4], H_lo[5], H_lo[6], H_lo[7], H_lo[8]
local h1_hi, h2_hi, h3_hi, h4_hi, h5_hi, h6_hi, h7_hi, h8_hi = H_hi[1], H_hi[2], H_hi[3], H_hi[4], H_hi[5], H_hi[6], H_hi[7], H_hi[8]
for pos = offs, offs + size - 1, 128 do
for j = 1, 16 * 2 do
pos = pos + 4
local a, b, c, d = string.byte(str, pos - 3, pos)
W[j] = ((a * 256 + b) * 256 + c) * 256 + d
end
for jj = 34, 160, 2 do
local a_lo, a_hi, b_lo, b_hi = W[jj - 30], W[jj - 31], W[jj - 4], W[jj - 5]
local tmp1 = bit32_bxor(bit32_rshift(a_lo, 1) + bit32_lshift(a_hi, 31), bit32_rshift(a_lo, 8) + bit32_lshift(a_hi, 24), bit32_rshift(a_lo, 7) + bit32_lshift(a_hi, 25)) % 4294967296 +
bit32_bxor(bit32_rshift(b_lo, 19) + bit32_lshift(b_hi, 13), bit32_lshift(b_lo, 3) + bit32_rshift(b_hi, 29), bit32_rshift(b_lo, 6) + bit32_lshift(b_hi, 26)) % 4294967296 +
W[jj - 14] + W[jj - 32]
local tmp2 = tmp1 % 4294967296
W[jj - 1] = bit32_bxor(bit32_rshift(a_hi, 1) + bit32_lshift(a_lo, 31), bit32_rshift(a_hi, 8) + bit32_lshift(a_lo, 24), bit32_rshift(a_hi, 7)) +
bit32_bxor(bit32_rshift(b_hi, 19) + bit32_lshift(b_lo, 13), bit32_lshift(b_hi, 3) + bit32_rshift(b_lo, 29), bit32_rshift(b_hi, 6)) +
W[jj - 15] + W[jj - 33] + (tmp1 - tmp2) / 4294967296
W[jj] = tmp2
end
local a_lo, b_lo, c_lo, d_lo, e_lo, f_lo, g_lo, h_lo = h1_lo, h2_lo, h3_lo, h4_lo, h5_lo, h6_lo, h7_lo, h8_lo
local a_hi, b_hi, c_hi, d_hi, e_hi, f_hi, g_hi, h_hi = h1_hi, h2_hi, h3_hi, h4_hi, h5_hi, h6_hi, h7_hi, h8_hi
for j = 1, 80 do
local jj = 2 * j
local tmp1 = bit32_bxor(bit32_rshift(e_lo, 14) + bit32_lshift(e_hi, 18), bit32_rshift(e_lo, 18) + bit32_lshift(e_hi, 14), bit32_lshift(e_lo, 23) + bit32_rshift(e_hi, 9)) % 4294967296 +
(bit32_band(e_lo, f_lo) + bit32_band(-1 - e_lo, g_lo)) % 4294967296 +
h_lo + K_lo[j] + W[jj]
local z_lo = tmp1 % 4294967296
local z_hi = bit32_bxor(bit32_rshift(e_hi, 14) + bit32_lshift(e_lo, 18), bit32_rshift(e_hi, 18) + bit32_lshift(e_lo, 14), bit32_lshift(e_hi, 23) + bit32_rshift(e_lo, 9)) +
bit32_band(e_hi, f_hi) + bit32_band(-1 - e_hi, g_hi) +
h_hi + K_hi[j] + W[jj - 1] +
(tmp1 - z_lo) / 4294967296
h_lo = g_lo
h_hi = g_hi
g_lo = f_lo
g_hi = f_hi
f_lo = e_lo
f_hi = e_hi
tmp1 = z_lo + d_lo
e_lo = tmp1 % 4294967296
e_hi = z_hi + d_hi + (tmp1 - e_lo) / 4294967296
d_lo = c_lo
d_hi = c_hi
c_lo = b_lo
c_hi = b_hi
b_lo = a_lo
b_hi = a_hi
tmp1 = z_lo + (bit32_band(d_lo, c_lo) + bit32_band(b_lo, bit32_bxor(d_lo, c_lo))) % 4294967296 + bit32_bxor(bit32_rshift(b_lo, 28) + bit32_lshift(b_hi, 4), bit32_lshift(b_lo, 30) + bit32_rshift(b_hi, 2), bit32_lshift(b_lo, 25) + bit32_rshift(b_hi, 7)) % 4294967296
a_lo = tmp1 % 4294967296
a_hi = z_hi + (bit32_band(d_hi, c_hi) + bit32_band(b_hi, bit32_bxor(d_hi, c_hi))) + bit32_bxor(bit32_rshift(b_hi, 28) + bit32_lshift(b_lo, 4), bit32_lshift(b_hi, 30) + bit32_rshift(b_lo, 2), bit32_lshift(b_hi, 25) + bit32_rshift(b_lo, 7)) + (tmp1 - a_lo) / 4294967296
end
a_lo = h1_lo + a_lo
h1_lo = a_lo % 4294967296
h1_hi = (h1_hi + a_hi + (a_lo - h1_lo) / 4294967296) % 4294967296
a_lo = h2_lo + b_lo
h2_lo = a_lo % 4294967296
h2_hi = (h2_hi + b_hi + (a_lo - h2_lo) / 4294967296) % 4294967296
a_lo = h3_lo + c_lo
h3_lo = a_lo % 4294967296
h3_hi = (h3_hi + c_hi + (a_lo - h3_lo) / 4294967296) % 4294967296
a_lo = h4_lo + d_lo
h4_lo = a_lo % 4294967296
h4_hi = (h4_hi + d_hi + (a_lo - h4_lo) / 4294967296) % 4294967296
a_lo = h5_lo + e_lo
h5_lo = a_lo % 4294967296
h5_hi = (h5_hi + e_hi + (a_lo - h5_lo) / 4294967296) % 4294967296
a_lo = h6_lo + f_lo
h6_lo = a_lo % 4294967296
h6_hi = (h6_hi + f_hi + (a_lo - h6_lo) / 4294967296) % 4294967296
a_lo = h7_lo + g_lo
h7_lo = a_lo % 4294967296
h7_hi = (h7_hi + g_hi + (a_lo - h7_lo) / 4294967296) % 4294967296
a_lo = h8_lo + h_lo
h8_lo = a_lo % 4294967296
h8_hi = (h8_hi + h_hi + (a_lo - h8_lo) / 4294967296) % 4294967296
end
H_lo[1], H_lo[2], H_lo[3], H_lo[4], H_lo[5], H_lo[6], H_lo[7], H_lo[8] = h1_lo, h2_lo, h3_lo, h4_lo, h5_lo, h6_lo, h7_lo, h8_lo
H_hi[1], H_hi[2], H_hi[3], H_hi[4], H_hi[5], H_hi[6], H_hi[7], H_hi[8] = h1_hi, h2_hi, h3_hi, h4_hi, h5_hi, h6_hi, h7_hi, h8_hi
end
local function md5_feed_64(H, str, offs, size)
-- offs >= 0, size >= 0, size is multiple of 64
local W, K, md5_next_shift = common_W, md5_K, md5_next_shift
local h1, h2, h3, h4 = H[1], H[2], H[3], H[4]
for pos = offs, offs + size - 1, 64 do
for j = 1, 16 do
pos = pos + 4
local a, b, c, d = string.byte(str, pos - 3, pos)
W[j] = ((d * 256 + c) * 256 + b) * 256 + a
end
local a, b, c, d = h1, h2, h3, h4
local s = 25
for j = 1, 16 do
local F = bit32_rrotate(bit32_band(b, c) + bit32_band(-1 - b, d) + a + K[j] + W[j], s) + b
s = md5_next_shift[s]
a = d
d = c
c = b
b = F
end
s = 27
for j = 17, 32 do
local F = bit32_rrotate(bit32_band(d, b) + bit32_band(-1 - d, c) + a + K[j] + W[(5 * j - 4) % 16 + 1], s) + b
s = md5_next_shift[s]
a = d
d = c
c = b
b = F
end
s = 28
for j = 33, 48 do
local F = bit32_rrotate(bit32_bxor(bit32_bxor(b, c), d) + a + K[j] + W[(3 * j + 2) % 16 + 1], s) + b
s = md5_next_shift[s]
a = d
d = c
c = b
b = F
end
s = 26
for j = 49, 64 do
local F = bit32_rrotate(bit32_bxor(c, bit32_bor(b, -1 - d)) + a + K[j] + W[(j * 7 - 7) % 16 + 1], s) + b
s = md5_next_shift[s]
a = d
d = c
c = b
b = F
end
h1 = (a + h1) % 4294967296
h2 = (b + h2) % 4294967296
h3 = (c + h3) % 4294967296
h4 = (d + h4) % 4294967296
end
H[1], H[2], H[3], H[4] = h1, h2, h3, h4
end
local function sha1_feed_64(H, str, offs, size)
-- offs >= 0, size >= 0, size is multiple of 64
local W = common_W
local h1, h2, h3, h4, h5 = H[1], H[2], H[3], H[4], H[5]
for pos = offs, offs + size - 1, 64 do
for j = 1, 16 do
pos = pos + 4
local a, b, c, d = string.byte(str, pos - 3, pos)
W[j] = ((a * 256 + b) * 256 + c) * 256 + d
end
for j = 17, 80 do
W[j] = bit32_lrotate(bit32_bxor(W[j - 3], W[j - 8], W[j - 14], W[j - 16]), 1)
end
local a, b, c, d, e = h1, h2, h3, h4, h5
for j = 1, 20 do
local z = bit32_lrotate(a, 5) + bit32_band(b, c) + bit32_band(-1 - b, d) + 0x5A827999 + W[j] + e -- constant = math.floor(TWO_POW_30 * sqrt(2))
e = d
d = c
c = bit32_rrotate(b, 2)
b = a
a = z
end
for j = 21, 40 do
local z = bit32_lrotate(a, 5) + bit32_bxor(b, c, d) + 0x6ED9EBA1 + W[j] + e -- TWO_POW_30 * sqrt(3)
e = d
d = c
c = bit32_rrotate(b, 2)
b = a
a = z
end
for j = 41, 60 do
local z = bit32_lrotate(a, 5) + bit32_band(d, c) + bit32_band(b, bit32_bxor(d, c)) + 0x8F1BBCDC + W[j] + e -- TWO_POW_30 * sqrt(5)
e = d
d = c
c = bit32_rrotate(b, 2)
b = a
a = z
end
for j = 61, 80 do
local z = bit32_lrotate(a, 5) + bit32_bxor(b, c, d) + 0xCA62C1D6 + W[j] + e -- TWO_POW_30 * sqrt(10)
e = d
d = c
c = bit32_rrotate(b, 2)
b = a
a = z
end
h1 = (a + h1) % 4294967296
h2 = (b + h2) % 4294967296
h3 = (c + h3) % 4294967296
h4 = (d + h4) % 4294967296
h5 = (e + h5) % 4294967296
end
H[1], H[2], H[3], H[4], H[5] = h1, h2, h3, h4, h5
end
local function keccak_feed(lanes_lo, lanes_hi, str, offs, size, block_size_in_bytes)
-- This is an example of a Lua function having 79 local variables :-)
-- offs >= 0, size >= 0, size is multiple of block_size_in_bytes, block_size_in_bytes is positive multiple of 8
local RC_lo, RC_hi = sha3_RC_lo, sha3_RC_hi
local qwords_qty = block_size_in_bytes / 8
for pos = offs, offs + size - 1, block_size_in_bytes do
for j = 1, qwords_qty do
local a, b, c, d = string.byte(str, pos + 1, pos + 4)
lanes_lo[j] = bit32_bxor(lanes_lo[j], ((d * 256 + c) * 256 + b) * 256 + a)
pos = pos + 8
a, b, c, d = string.byte(str, pos - 3, pos)
lanes_hi[j] = bit32_bxor(lanes_hi[j], ((d * 256 + c) * 256 + b) * 256 + a)
end
local L01_lo, L01_hi, L02_lo, L02_hi, L03_lo, L03_hi, L04_lo, L04_hi, L05_lo, L05_hi, L06_lo, L06_hi, L07_lo, L07_hi, L08_lo, L08_hi, L09_lo, L09_hi, L10_lo, L10_hi, L11_lo, L11_hi, L12_lo, L12_hi, L13_lo, L13_hi, L14_lo, L14_hi, L15_lo, L15_hi, L16_lo, L16_hi, L17_lo, L17_hi, L18_lo, L18_hi, L19_lo, L19_hi, L20_lo, L20_hi, L21_lo, L21_hi, L22_lo, L22_hi, L23_lo, L23_hi, L24_lo, L24_hi, L25_lo, L25_hi = lanes_lo[1], lanes_hi[1], lanes_lo[2], lanes_hi[2], lanes_lo[3], lanes_hi[3], lanes_lo[4], lanes_hi[4], lanes_lo[5], lanes_hi[5], lanes_lo[6], lanes_hi[6], lanes_lo[7], lanes_hi[7], lanes_lo[8], lanes_hi[8], lanes_lo[9], lanes_hi[9], lanes_lo[10], lanes_hi[10], lanes_lo[11], lanes_hi[11], lanes_lo[12], lanes_hi[12], lanes_lo[13], lanes_hi[13], lanes_lo[14], lanes_hi[14], lanes_lo[15], lanes_hi[15], lanes_lo[16], lanes_hi[16], lanes_lo[17], lanes_hi[17], lanes_lo[18], lanes_hi[18], lanes_lo[19], lanes_hi[19], lanes_lo[20], lanes_hi[20], lanes_lo[21], lanes_hi[21], lanes_lo[22], lanes_hi[22], lanes_lo[23], lanes_hi[23], lanes_lo[24], lanes_hi[24], lanes_lo[25], lanes_hi[25]
for round_idx = 1, 24 do
local C1_lo = bit32_bxor(L01_lo, L06_lo, L11_lo, L16_lo, L21_lo)
local C1_hi = bit32_bxor(L01_hi, L06_hi, L11_hi, L16_hi, L21_hi)
local C2_lo = bit32_bxor(L02_lo, L07_lo, L12_lo, L17_lo, L22_lo)
local C2_hi = bit32_bxor(L02_hi, L07_hi, L12_hi, L17_hi, L22_hi)
local C3_lo = bit32_bxor(L03_lo, L08_lo, L13_lo, L18_lo, L23_lo)
local C3_hi = bit32_bxor(L03_hi, L08_hi, L13_hi, L18_hi, L23_hi)
local C4_lo = bit32_bxor(L04_lo, L09_lo, L14_lo, L19_lo, L24_lo)
local C4_hi = bit32_bxor(L04_hi, L09_hi, L14_hi, L19_hi, L24_hi)
local C5_lo = bit32_bxor(L05_lo, L10_lo, L15_lo, L20_lo, L25_lo)
local C5_hi = bit32_bxor(L05_hi, L10_hi, L15_hi, L20_hi, L25_hi)
local D_lo = bit32_bxor(C1_lo, C3_lo * 2 + (C3_hi % TWO_POW_32 - C3_hi % TWO_POW_31) / TWO_POW_31)
local D_hi = bit32_bxor(C1_hi, C3_hi * 2 + (C3_lo % TWO_POW_32 - C3_lo % TWO_POW_31) / TWO_POW_31)
local T0_lo = bit32_bxor(D_lo, L02_lo)
local T0_hi = bit32_bxor(D_hi, L02_hi)
local T1_lo = bit32_bxor(D_lo, L07_lo)
local T1_hi = bit32_bxor(D_hi, L07_hi)
local T2_lo = bit32_bxor(D_lo, L12_lo)
local T2_hi = bit32_bxor(D_hi, L12_hi)
local T3_lo = bit32_bxor(D_lo, L17_lo)
local T3_hi = bit32_bxor(D_hi, L17_hi)
local T4_lo = bit32_bxor(D_lo, L22_lo)
local T4_hi = bit32_bxor(D_hi, L22_hi)
L02_lo = (T1_lo % TWO_POW_32 - T1_lo % TWO_POW_20) / TWO_POW_20 + T1_hi * TWO_POW_12
L02_hi = (T1_hi % TWO_POW_32 - T1_hi % TWO_POW_20) / TWO_POW_20 + T1_lo * TWO_POW_12
L07_lo = (T3_lo % TWO_POW_32 - T3_lo % TWO_POW_19) / TWO_POW_19 + T3_hi * TWO_POW_13
L07_hi = (T3_hi % TWO_POW_32 - T3_hi % TWO_POW_19) / TWO_POW_19 + T3_lo * TWO_POW_13
L12_lo = T0_lo * 2 + (T0_hi % TWO_POW_32 - T0_hi % TWO_POW_31) / TWO_POW_31
L12_hi = T0_hi * 2 + (T0_lo % TWO_POW_32 - T0_lo % TWO_POW_31) / TWO_POW_31
L17_lo = T2_lo * TWO_POW_10 + (T2_hi % TWO_POW_32 - T2_hi % TWO_POW_22) / TWO_POW_22
L17_hi = T2_hi * TWO_POW_10 + (T2_lo % TWO_POW_32 - T2_lo % TWO_POW_22) / TWO_POW_22
L22_lo = T4_lo * TWO_POW_2 + (T4_hi % TWO_POW_32 - T4_hi % TWO_POW_30) / TWO_POW_30
L22_hi = T4_hi * TWO_POW_2 + (T4_lo % TWO_POW_32 - T4_lo % TWO_POW_30) / TWO_POW_30
D_lo = bit32_bxor(C2_lo, C4_lo * 2 + (C4_hi % TWO_POW_32 - C4_hi % TWO_POW_31) / TWO_POW_31)
D_hi = bit32_bxor(C2_hi, C4_hi * 2 + (C4_lo % TWO_POW_32 - C4_lo % TWO_POW_31) / TWO_POW_31)
T0_lo = bit32_bxor(D_lo, L03_lo)
T0_hi = bit32_bxor(D_hi, L03_hi)
T1_lo = bit32_bxor(D_lo, L08_lo)
T1_hi = bit32_bxor(D_hi, L08_hi)
T2_lo = bit32_bxor(D_lo, L13_lo)
T2_hi = bit32_bxor(D_hi, L13_hi)
T3_lo = bit32_bxor(D_lo, L18_lo)
T3_hi = bit32_bxor(D_hi, L18_hi)
T4_lo = bit32_bxor(D_lo, L23_lo)
T4_hi = bit32_bxor(D_hi, L23_hi)
L03_lo = (T2_lo % TWO_POW_32 - T2_lo % TWO_POW_21) / TWO_POW_21 + T2_hi * TWO_POW_11
L03_hi = (T2_hi % TWO_POW_32 - T2_hi % TWO_POW_21) / TWO_POW_21 + T2_lo * TWO_POW_11
L08_lo = (T4_lo % TWO_POW_32 - T4_lo % TWO_POW_3) / TWO_POW_3 + T4_hi * TWO_POW_29 % TWO_POW_32
L08_hi = (T4_hi % TWO_POW_32 - T4_hi % TWO_POW_3) / TWO_POW_3 + T4_lo * TWO_POW_29 % TWO_POW_32
L13_lo = T1_lo * TWO_POW_6 + (T1_hi % TWO_POW_32 - T1_hi % TWO_POW_26) / TWO_POW_26
L13_hi = T1_hi * TWO_POW_6 + (T1_lo % TWO_POW_32 - T1_lo % TWO_POW_26) / TWO_POW_26
L18_lo = T3_lo * TWO_POW_15 + (T3_hi % TWO_POW_32 - T3_hi % TWO_POW_17) / TWO_POW_17
L18_hi = T3_hi * TWO_POW_15 + (T3_lo % TWO_POW_32 - T3_lo % TWO_POW_17) / TWO_POW_17
L23_lo = (T0_lo % TWO_POW_32 - T0_lo % TWO_POW_2) / TWO_POW_2 + T0_hi * TWO_POW_30 % TWO_POW_32
L23_hi = (T0_hi % TWO_POW_32 - T0_hi % TWO_POW_2) / TWO_POW_2 + T0_lo * TWO_POW_30 % TWO_POW_32
D_lo = bit32_bxor(C3_lo, C5_lo * 2 + (C5_hi % TWO_POW_32 - C5_hi % TWO_POW_31) / TWO_POW_31)
D_hi = bit32_bxor(C3_hi, C5_hi * 2 + (C5_lo % TWO_POW_32 - C5_lo % TWO_POW_31) / TWO_POW_31)
T0_lo = bit32_bxor(D_lo, L04_lo)
T0_hi = bit32_bxor(D_hi, L04_hi)
T1_lo = bit32_bxor(D_lo, L09_lo)
T1_hi = bit32_bxor(D_hi, L09_hi)
T2_lo = bit32_bxor(D_lo, L14_lo)
T2_hi = bit32_bxor(D_hi, L14_hi)
T3_lo = bit32_bxor(D_lo, L19_lo)
T3_hi = bit32_bxor(D_hi, L19_hi)
T4_lo = bit32_bxor(D_lo, L24_lo)
T4_hi = bit32_bxor(D_hi, L24_hi)
L04_lo = T3_lo * TWO_POW_21 % TWO_POW_32 + (T3_hi % TWO_POW_32 - T3_hi % TWO_POW_11) / TWO_POW_11
L04_hi = T3_hi * TWO_POW_21 % TWO_POW_32 + (T3_lo % TWO_POW_32 - T3_lo % TWO_POW_11) / TWO_POW_11
L09_lo = T0_lo * TWO_POW_28 % TWO_POW_32 + (T0_hi % TWO_POW_32 - T0_hi % TWO_POW_4) / TWO_POW_4
L09_hi = T0_hi * TWO_POW_28 % TWO_POW_32 + (T0_lo % TWO_POW_32 - T0_lo % TWO_POW_4) / TWO_POW_4
L14_lo = T2_lo * TWO_POW_25 % TWO_POW_32 + (T2_hi % TWO_POW_32 - T2_hi % TWO_POW_7) / TWO_POW_7
L14_hi = T2_hi * TWO_POW_25 % TWO_POW_32 + (T2_lo % TWO_POW_32 - T2_lo % TWO_POW_7) / TWO_POW_7
L19_lo = (T4_lo % TWO_POW_32 - T4_lo % TWO_POW_8) / TWO_POW_8 + T4_hi * TWO_POW_24 % TWO_POW_32
L19_hi = (T4_hi % TWO_POW_32 - T4_hi % TWO_POW_8) / TWO_POW_8 + T4_lo * TWO_POW_24 % TWO_POW_32
L24_lo = (T1_lo % TWO_POW_32 - T1_lo % TWO_POW_9) / TWO_POW_9 + T1_hi * TWO_POW_23 % TWO_POW_32
L24_hi = (T1_hi % TWO_POW_32 - T1_hi % TWO_POW_9) / TWO_POW_9 + T1_lo * TWO_POW_23 % TWO_POW_32
D_lo = bit32_bxor(C4_lo, C1_lo * 2 + (C1_hi % TWO_POW_32 - C1_hi % TWO_POW_31) / TWO_POW_31)
D_hi = bit32_bxor(C4_hi, C1_hi * 2 + (C1_lo % TWO_POW_32 - C1_lo % TWO_POW_31) / TWO_POW_31)
T0_lo = bit32_bxor(D_lo, L05_lo)
T0_hi = bit32_bxor(D_hi, L05_hi)
T1_lo = bit32_bxor(D_lo, L10_lo)
T1_hi = bit32_bxor(D_hi, L10_hi)
T2_lo = bit32_bxor(D_lo, L15_lo)
T2_hi = bit32_bxor(D_hi, L15_hi)
T3_lo = bit32_bxor(D_lo, L20_lo)
T3_hi = bit32_bxor(D_hi, L20_hi)
T4_lo = bit32_bxor(D_lo, L25_lo)
T4_hi = bit32_bxor(D_hi, L25_hi)
L05_lo = T4_lo * TWO_POW_14 + (T4_hi % TWO_POW_32 - T4_hi % TWO_POW_18) / TWO_POW_18
L05_hi = T4_hi * TWO_POW_14 + (T4_lo % TWO_POW_32 - T4_lo % TWO_POW_18) / TWO_POW_18
L10_lo = T1_lo * TWO_POW_20 % TWO_POW_32 + (T1_hi % TWO_POW_32 - T1_hi % TWO_POW_12) / TWO_POW_12
L10_hi = T1_hi * TWO_POW_20 % TWO_POW_32 + (T1_lo % TWO_POW_32 - T1_lo % TWO_POW_12) / TWO_POW_12
L15_lo = T3_lo * TWO_POW_8 + (T3_hi % TWO_POW_32 - T3_hi % TWO_POW_24) / TWO_POW_24
L15_hi = T3_hi * TWO_POW_8 + (T3_lo % TWO_POW_32 - T3_lo % TWO_POW_24) / TWO_POW_24
L20_lo = T0_lo * TWO_POW_27 % TWO_POW_32 + (T0_hi % TWO_POW_32 - T0_hi % TWO_POW_5) / TWO_POW_5
L20_hi = T0_hi * TWO_POW_27 % TWO_POW_32 + (T0_lo % TWO_POW_32 - T0_lo % TWO_POW_5) / TWO_POW_5
L25_lo = (T2_lo % TWO_POW_32 - T2_lo % TWO_POW_25) / TWO_POW_25 + T2_hi * TWO_POW_7
L25_hi = (T2_hi % TWO_POW_32 - T2_hi % TWO_POW_25) / TWO_POW_25 + T2_lo * TWO_POW_7
D_lo = bit32_bxor(C5_lo, C2_lo * 2 + (C2_hi % TWO_POW_32 - C2_hi % TWO_POW_31) / TWO_POW_31)
D_hi = bit32_bxor(C5_hi, C2_hi * 2 + (C2_lo % TWO_POW_32 - C2_lo % TWO_POW_31) / TWO_POW_31)
T1_lo = bit32_bxor(D_lo, L06_lo)
T1_hi = bit32_bxor(D_hi, L06_hi)
T2_lo = bit32_bxor(D_lo, L11_lo)
T2_hi = bit32_bxor(D_hi, L11_hi)
T3_lo = bit32_bxor(D_lo, L16_lo)
T3_hi = bit32_bxor(D_hi, L16_hi)
T4_lo = bit32_bxor(D_lo, L21_lo)
T4_hi = bit32_bxor(D_hi, L21_hi)
L06_lo = T2_lo * TWO_POW_3 + (T2_hi % TWO_POW_32 - T2_hi % TWO_POW_29) / TWO_POW_29
L06_hi = T2_hi * TWO_POW_3 + (T2_lo % TWO_POW_32 - T2_lo % TWO_POW_29) / TWO_POW_29
L11_lo = T4_lo * TWO_POW_18 + (T4_hi % TWO_POW_32 - T4_hi % TWO_POW_14) / TWO_POW_14
L11_hi = T4_hi * TWO_POW_18 + (T4_lo % TWO_POW_32 - T4_lo % TWO_POW_14) / TWO_POW_14
L16_lo = (T1_lo % TWO_POW_32 - T1_lo % TWO_POW_28) / TWO_POW_28 + T1_hi * TWO_POW_4
L16_hi = (T1_hi % TWO_POW_32 - T1_hi % TWO_POW_28) / TWO_POW_28 + T1_lo * TWO_POW_4
L21_lo = (T3_lo % TWO_POW_32 - T3_lo % TWO_POW_23) / TWO_POW_23 + T3_hi * TWO_POW_9
L21_hi = (T3_hi % TWO_POW_32 - T3_hi % TWO_POW_23) / TWO_POW_23 + T3_lo * TWO_POW_9
L01_lo = bit32_bxor(D_lo, L01_lo)
L01_hi = bit32_bxor(D_hi, L01_hi)
L01_lo, L02_lo, L03_lo, L04_lo, L05_lo = bit32_bxor(L01_lo, bit32_band(-1 - L02_lo, L03_lo)), bit32_bxor(L02_lo, bit32_band(-1 - L03_lo, L04_lo)), bit32_bxor(L03_lo, bit32_band(-1 - L04_lo, L05_lo)), bit32_bxor(L04_lo, bit32_band(-1 - L05_lo, L01_lo)), bit32_bxor(L05_lo, bit32_band(-1 - L01_lo, L02_lo))
L01_hi, L02_hi, L03_hi, L04_hi, L05_hi = bit32_bxor(L01_hi, bit32_band(-1 - L02_hi, L03_hi)), bit32_bxor(L02_hi, bit32_band(-1 - L03_hi, L04_hi)), bit32_bxor(L03_hi, bit32_band(-1 - L04_hi, L05_hi)), bit32_bxor(L04_hi, bit32_band(-1 - L05_hi, L01_hi)), bit32_bxor(L05_hi, bit32_band(-1 - L01_hi, L02_hi))
L06_lo, L07_lo, L08_lo, L09_lo, L10_lo = bit32_bxor(L09_lo, bit32_band(-1 - L10_lo, L06_lo)), bit32_bxor(L10_lo, bit32_band(-1 - L06_lo, L07_lo)), bit32_bxor(L06_lo, bit32_band(-1 - L07_lo, L08_lo)), bit32_bxor(L07_lo, bit32_band(-1 - L08_lo, L09_lo)), bit32_bxor(L08_lo, bit32_band(-1 - L09_lo, L10_lo))
L06_hi, L07_hi, L08_hi, L09_hi, L10_hi = bit32_bxor(L09_hi, bit32_band(-1 - L10_hi, L06_hi)), bit32_bxor(L10_hi, bit32_band(-1 - L06_hi, L07_hi)), bit32_bxor(L06_hi, bit32_band(-1 - L07_hi, L08_hi)), bit32_bxor(L07_hi, bit32_band(-1 - L08_hi, L09_hi)), bit32_bxor(L08_hi, bit32_band(-1 - L09_hi, L10_hi))
L11_lo, L12_lo, L13_lo, L14_lo, L15_lo = bit32_bxor(L12_lo, bit32_band(-1 - L13_lo, L14_lo)), bit32_bxor(L13_lo, bit32_band(-1 - L14_lo, L15_lo)), bit32_bxor(L14_lo, bit32_band(-1 - L15_lo, L11_lo)), bit32_bxor(L15_lo, bit32_band(-1 - L11_lo, L12_lo)), bit32_bxor(L11_lo, bit32_band(-1 - L12_lo, L13_lo))
L11_hi, L12_hi, L13_hi, L14_hi, L15_hi = bit32_bxor(L12_hi, bit32_band(-1 - L13_hi, L14_hi)), bit32_bxor(L13_hi, bit32_band(-1 - L14_hi, L15_hi)), bit32_bxor(L14_hi, bit32_band(-1 - L15_hi, L11_hi)), bit32_bxor(L15_hi, bit32_band(-1 - L11_hi, L12_hi)), bit32_bxor(L11_hi, bit32_band(-1 - L12_hi, L13_hi))
L16_lo, L17_lo, L18_lo, L19_lo, L20_lo = bit32_bxor(L20_lo, bit32_band(-1 - L16_lo, L17_lo)), bit32_bxor(L16_lo, bit32_band(-1 - L17_lo, L18_lo)), bit32_bxor(L17_lo, bit32_band(-1 - L18_lo, L19_lo)), bit32_bxor(L18_lo, bit32_band(-1 - L19_lo, L20_lo)), bit32_bxor(L19_lo, bit32_band(-1 - L20_lo, L16_lo))
L16_hi, L17_hi, L18_hi, L19_hi, L20_hi = bit32_bxor(L20_hi, bit32_band(-1 - L16_hi, L17_hi)), bit32_bxor(L16_hi, bit32_band(-1 - L17_hi, L18_hi)), bit32_bxor(L17_hi, bit32_band(-1 - L18_hi, L19_hi)), bit32_bxor(L18_hi, bit32_band(-1 - L19_hi, L20_hi)), bit32_bxor(L19_hi, bit32_band(-1 - L20_hi, L16_hi))
L21_lo, L22_lo, L23_lo, L24_lo, L25_lo = bit32_bxor(L23_lo, bit32_band(-1 - L24_lo, L25_lo)), bit32_bxor(L24_lo, bit32_band(-1 - L25_lo, L21_lo)), bit32_bxor(L25_lo, bit32_band(-1 - L21_lo, L22_lo)), bit32_bxor(L21_lo, bit32_band(-1 - L22_lo, L23_lo)), bit32_bxor(L22_lo, bit32_band(-1 - L23_lo, L24_lo))
L21_hi, L22_hi, L23_hi, L24_hi, L25_hi = bit32_bxor(L23_hi, bit32_band(-1 - L24_hi, L25_hi)), bit32_bxor(L24_hi, bit32_band(-1 - L25_hi, L21_hi)), bit32_bxor(L25_hi, bit32_band(-1 - L21_hi, L22_hi)), bit32_bxor(L21_hi, bit32_band(-1 - L22_hi, L23_hi)), bit32_bxor(L22_hi, bit32_band(-1 - L23_hi, L24_hi))
L01_lo = bit32_bxor(L01_lo, RC_lo[round_idx])
L01_hi = L01_hi + RC_hi[round_idx] -- RC_hi[] is either 0 or 0x80000000, so we could use fast addition instead of slow XOR
end
lanes_lo[1] = L01_lo
lanes_hi[1] = L01_hi
lanes_lo[2] = L02_lo
lanes_hi[2] = L02_hi
lanes_lo[3] = L03_lo
lanes_hi[3] = L03_hi
lanes_lo[4] = L04_lo
lanes_hi[4] = L04_hi
lanes_lo[5] = L05_lo
lanes_hi[5] = L05_hi
lanes_lo[6] = L06_lo
lanes_hi[6] = L06_hi
lanes_lo[7] = L07_lo
lanes_hi[7] = L07_hi
lanes_lo[8] = L08_lo
lanes_hi[8] = L08_hi
lanes_lo[9] = L09_lo
lanes_hi[9] = L09_hi
lanes_lo[10] = L10_lo
lanes_hi[10] = L10_hi
lanes_lo[11] = L11_lo
lanes_hi[11] = L11_hi
lanes_lo[12] = L12_lo
lanes_hi[12] = L12_hi
lanes_lo[13] = L13_lo
lanes_hi[13] = L13_hi
lanes_lo[14] = L14_lo
lanes_hi[14] = L14_hi
lanes_lo[15] = L15_lo
lanes_hi[15] = L15_hi
lanes_lo[16] = L16_lo
lanes_hi[16] = L16_hi
lanes_lo[17] = L17_lo
lanes_hi[17] = L17_hi
lanes_lo[18] = L18_lo
lanes_hi[18] = L18_hi
lanes_lo[19] = L19_lo
lanes_hi[19] = L19_hi
lanes_lo[20] = L20_lo
lanes_hi[20] = L20_hi
lanes_lo[21] = L21_lo
lanes_hi[21] = L21_hi
lanes_lo[22] = L22_lo
lanes_hi[22] = L22_hi
lanes_lo[23] = L23_lo
lanes_hi[23] = L23_hi
lanes_lo[24] = L24_lo
lanes_hi[24] = L24_hi
lanes_lo[25] = L25_lo
lanes_hi[25] = L25_hi
end
end
|
--// V key, Takedown |
mouse.KeyDown:connect(function(key)
if key=="v" then
veh.Lightbar.middle.Beep:Play()
veh.Lightbar.Remotes.TakedownEvent:FireServer(true)
end
end)
|
--[[Driver Handling]] |
--Driver Sit
car.DriveSeat.ChildAdded:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
--Distribute Client Interface
local p=game.Players:GetPlayerFromCharacter(child.Part1.Parent)
car.Body.MainPart.Anchored = false
car.DriveSeat:SetNetworkOwner(p)
local g=script.Parent["A-Chassis Interface"]:Clone()
g.Parent=p.PlayerGui
end
end)
--Driver Leave
car.DriveSeat.ChildRemoved:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") then
--Remove Flip Force
if car.DriveSeat:FindFirstChild("Flip")~=nil then
car.DriveSeat.Flip.MaxTorque = Vector3.new()
end
--Remove Wheel Force
for i,v in pairs(car.Wheels:GetChildren()) do
if v:FindFirstChild("#AV")~=nil then
if v["#AV"]:IsA("BodyAngularVelocity") then
if v["#AV"].AngularVelocity.Magnitude>0 then
v["#AV"].AngularVelocity = Vector3.new()
v["#AV"].MaxTorque = Vector3.new()
end
else
if v["#AV"].AngularVelocity>0 then
v["#AV"].AngularVelocity = 0
v["#AV"].MotorMaxTorque = 0
end
end
end
end
end |
-- Get the UI frame by name or reference |
local uiFrame = script.Parent.Parent.Background.DesktopIcons
|
-- SETUP ICON TEMPLATE |
local topbarPlusGui = Instance.new("ScreenGui")
topbarPlusGui.Enabled = true
topbarPlusGui.DisplayOrder = 0
topbarPlusGui.IgnoreGuiInset = true
topbarPlusGui.ResetOnSpawn = false
topbarPlusGui.Name = "TopbarPlus"
local activeItems = Instance.new("Folder")
activeItems.Name = "ActiveItems"
activeItems.Parent = topbarPlusGui
local topbarContainer = Instance.new("Frame")
topbarContainer.BackgroundTransparency = 1
topbarContainer.Name = "TopbarContainer"
topbarContainer.Position = UDim2.new(0, 0, 0, 0)
topbarContainer.Size = UDim2.new(1, 0, 0, 36)
topbarContainer.Visible = true
topbarContainer.ZIndex = 1
topbarContainer.Parent = topbarPlusGui
topbarContainer.Active = false
local iconContainer = Instance.new("Frame")
iconContainer.BackgroundTransparency = 1
iconContainer.Name = "IconContainer"
iconContainer.Position = UDim2.new(0, 104, 0, 4)
iconContainer.Visible = false
iconContainer.ZIndex = 1
iconContainer.Parent = topbarContainer
iconContainer.Active = false
local iconButton = Instance.new("TextButton")
iconButton.Name = "IconButton"
iconButton.Visible = true
iconButton.Text = ""
iconButton.ZIndex = 10--2
iconButton.BorderSizePixel = 0
iconButton.AutoButtonColor = false
iconButton.Parent = iconContainer
iconButton.Active = true
local iconImage = Instance.new("ImageLabel")
iconImage.BackgroundTransparency = 1
iconImage.Name = "IconImage"
iconImage.AnchorPoint = Vector2.new(0, 0.5)
iconImage.Visible = true
iconImage.ZIndex = 11--3
iconImage.ScaleType = Enum.ScaleType.Fit
iconImage.Parent = iconButton
iconImage.Active = false
local iconLabel = Instance.new("TextLabel")
iconLabel.BackgroundTransparency = 1
iconLabel.Name = "IconLabel"
iconLabel.AnchorPoint = Vector2.new(0, 0.5)
iconLabel.Position = UDim2.new(0.5, 0, 0.5, 0)
iconLabel.Text = ""
iconLabel.RichText = true
iconLabel.TextScaled = false
iconLabel.ClipsDescendants = true
iconLabel.ZIndex = 11--3
iconLabel.Parent = iconButton
iconLabel.Active = false
local iconGradient = Instance.new("UIGradient")
iconGradient.Name = "IconGradient"
iconGradient.Enabled = true
iconGradient.Parent = iconButton
local iconCorner = Instance.new("UICorner")
iconCorner.Name = "IconCorner"
iconCorner.Parent = iconButton
local iconOverlay = Instance.new("Frame")
iconOverlay.Name = "IconOverlay"
iconOverlay.BackgroundTransparency = 1
iconOverlay.Position = iconButton.Position
iconOverlay.Size = UDim2.new(1, 0, 1, 0)
iconOverlay.Visible = true
iconOverlay.ZIndex = iconButton.ZIndex + 1
iconOverlay.BorderSizePixel = 0
iconOverlay.Parent = iconContainer
iconOverlay.Active = false
local iconOverlayCorner = iconCorner:Clone()
iconOverlayCorner.Name = "IconOverlayCorner"
iconOverlayCorner.Parent = iconOverlay
|
--------------------------------------------------------------------------------------- |
local buttons = script.Parent.Parent.Buttons
local title = script.Parent.Parent.Title
local popups = script.Parent.Parent.PopUps
local fade = script.Parent.Parent.Fade
local gameVersion = script.Parent.Parent.GameVersion
local playButton = buttons.Play
local settingsButton = buttons.Settings
local infoButton = buttons.Info
local creditsButton = buttons.Credits
local shopButton = buttons.Shop
local settingsPopup = popups.Settings
local infoPopup = popups.Info
local creditsPopup = popups.Credits
local shopPopup = popups.Shop
|
-- Public Methods |
function DropdownClass:Set(option)
if (self._Selected ~= option) then
self._Selected = option
self._ChangedBind:Fire(option)
self.Button.Option.Text = option.Text
end
self:Show(false)
end
function DropdownClass:Get()
return self._Selected
end
function DropdownClass:Show(bool)
self.Button.Arrow.Image = bool and ARROW_UP or ARROW_DOWN
self.ListFrame.Visible = bool
end
function DropdownClass:Destroy()
self._Maid:Sweep()
self._ChangedBind:Destroy()
self._Changed = nil
self._Options = nil
self._Selected = nil
end
|
-- its best to anchor while welding, and then unanchor when finished |
function weld(modelgroup,anchored,cancollide)
local parts,last = {}
local function scan(parent)
for _,v in pairs(parent:GetChildren()) do
if (v:IsA("BasePart")) then
if (last) then
local w = Instance.new("Weld")
w.Name = ("Weld")
w.Part0,w.Part1 = last,v
w.C0 = last.CFrame:inverse()
w.C1 = v.CFrame:inverse()
w.Parent = last
end
last = v
table.insert(parts,v)
end
scan(v)
end
end
scan(modelgroup)
for _,v in pairs(parts) do
v.Anchored=anchored
v.CanCollide=cancollide
end
end
weld(script.Parent,true,false) |
-- << SETTINGS >> |
Settings={
-- <Prefix>
Prefix =";" ; -- The character used to begin each command
-- <Owner chat colour>
OwnerChatColour = "y" ; --w/r/g/b/p/y OR white/red/green/blue/purple/yellow
-- <Donor Perks> **Please keep enabled to help support the development of HD Admin Commands**
DonorItem = true ;
DonorItemId = 10472779 ;
DonorCommands = true ;
-- <Other>
CmdBar = true ; -- Enabled/disales the cmdbar - press @ to open the cmdbar
HDIcon = true ; -- The HD Icon in the corner of screen (helps support the development HD Admin Commands)
AutoPrompt = true ; -- This prompts all players to take a free copy of the model. Set to 'false' to disable.
FreeAdmin = false ; -- Allows everyone in server to have the chosen admin. e.g.' FreeAdmin = "VIP" '. Set to False if not. You can not set to 'Owner'.
NoticeSound = 261082034 ; -- Notification sound ID
NoticeSoundVol = 0.5 ; -- How loud the notification sound is. Must be between 0 and 1.
ErrorSound = 138090596 ; -- Error sound ID
ErrorSoundVol = 0.5 ; -- How loud the error sound is. Must be between 0 and 1.
} ;
|
--Mute players across different servers |
local muteConnection = ms:SubscribeAsync(muteTopic, function(message)
local targetId = message.Data[1]
local muteLength = message.Data[2]
for i, plr in pairs(game.Players:GetPlayers()) do
if plr.UserId == targetId then
channel:MuteSpeaker(plr.Name)
task.wait(muteLength)
if plr then
channel:UnmuteSpeaker(plr.Name)
end
end
end
end) |
-- REMOTES -- |
local Replicate = Remotes.Replicate
|
-- Key that user can press to interact with game |
local KEY1
if IS_MOBILE then
KEY1 = nil
elseif IS_CONSOLE then
KEY1 = Enum.KeyCode.ButtonX
else
KEY1 = Enum.KeyCode.E
end
|
--------------------[ TWEEN FUNCTIONS ]----------------------------------------------- |
function TweenJoint(Joint, NewC0, NewC1, Alpha, Duration)
coroutine.resume(coroutine.create(function()
local TweenIndicator = nil --At the current moment, this is how the script determines whether the function is already tweening a joint
local NewCode = math.random(-1e9, 1e9) --This creates a random code between -1000000000 and 1000000000
if (not Joint:FindFirstChild("TweenCode")) then --If the joint isn't being tweened, then
TweenIndicator = Instance.new("IntValue")
TweenIndicator.Name = "TweenCode"
TweenIndicator.Value = NewCode
TweenIndicator.Parent = Joint
else
TweenIndicator = Joint.TweenCode
TweenIndicator.Value = NewCode --If the joint is already being tweened, this will change the code, and the tween loop will stop
end
local MatrixCFrame = function(CFPos, CFTop, CFBack)
local CFRight = CFTop:Cross(CFBack)
return CF(
CFPos.x, CFPos.y, CFPos.z,
CFRight.x, CFTop.x, CFBack.x,
CFRight.y, CFTop.y, CFBack.y,
CFRight.z, CFTop.z, CFBack.z
)
end
local LerpCF = function(StartCF, EndCF, Alpha)
local StartTop = (StartCF * CFANG(RAD(90), 0, 0)).lookVector
local StartBack = -StartCF.lookVector
local EndTop = (EndCF * CFANG(RAD(90), 0, 0)).lookVector
local EndBack = -EndCF.lookVector
local StartPos = StartCF.p
local EndPos = EndCF.p
local NewCF = MatrixCFrame(
StartPos:lerp(EndPos, Alpha),
StartTop:lerp(EndTop, Alpha),
StartBack:lerp(EndBack, Alpha)
)
return NewCF
end
local StartC0 = Joint.C0
local StartC1 = Joint.C1
local X = 0
while true do
local NewX = X + math.min(1.5 / math.max(Duration, 0), 90)
X = (NewX > 90 and 90 or NewX)
if TweenIndicator.Value ~= NewCode then break end --This makes sure that another tween wasn't called on the same joint
if (not Selected) then break end --This stops the tween if the tool is deselected
if NewC0 then Joint.C0 = LerpCF(StartC0, NewC0, Alpha(X)) end
if NewC1 then Joint.C1 = LerpCF(StartC1, NewC1, Alpha(X)) end
if X == 90 then break end
RS:wait() --This makes the for loop step every 1/60th of a second
end
if TweenIndicator.Value == NewCode then --If this tween functions was the last one called on a joint then it will remove the code
TweenIndicator:Destroy()
end
end))
end
INSERT(Connections, RS:connect(function()
local Forward = (Keys["w"] or Keys[string.char(17)])
local Backward = (Keys["s"] or Keys[string.char(18)])
local Right = (Keys["d"] or Keys[string.char(19)])
local Left = (Keys["a"] or Keys[string.char(20)])
local WalkingForward = (Forward and (not Backward))
local WalkingBackward = ((not Forward) and Backward)
local WalkingRight = (Right and (not Left))
local WalkingLeft = ((not Right) and Left)
end))
INSERT(Connections, RS:connect(function()
if (not Idleing) and Walking then
if Stance == 1 then
Humanoid.WalkSpeed = 7
elseif Stance == 2 then
Humanoid.WalkSpeed = 16
end
else
Humanoid.WalkSpeed = 16
end
end))
|
--[[ The Module ]] | --
local MouseLockController = {}
MouseLockController.__index = MouseLockController
function MouseLockController.new()
local self = setmetatable({}, MouseLockController)
self.inputBeganConn = nil -- Remove with FFlagPlayerScriptsBindAtPriority
self.isMouseLocked = false
self.savedMouseCursor = nil
self.boundKeys = {Enum.KeyCode.LeftShift, Enum.KeyCode.RightShift} -- defaults
self.mouseLockToggledEvent = Instance.new("BindableEvent")
local boundKeysObj = script:FindFirstChild("BoundKeys")
if (not boundKeysObj) or (not boundKeysObj:IsA("StringValue")) then
-- If object with correct name was found, but it's not a StringValue, destroy and replace
if boundKeysObj then
boundKeysObj:Destroy()
end
boundKeysObj = Instance.new("StringValue")
boundKeysObj.Name = "BoundKeys"
boundKeysObj.Value = "LeftShift,RightShift"
boundKeysObj.Parent = script
end
if boundKeysObj then
boundKeysObj.Changed:Connect(function(value)
self:OnBoundKeysObjectChanged(value)
end)
self:OnBoundKeysObjectChanged(boundKeysObj.Value) -- Initial setup call
end
-- Watch for changes to user's ControlMode and ComputerMovementMode settings and update the feature availability accordingly
GameSettings.Changed:Connect(function(property)
if property == "ControlMode" or property == "ComputerMovementMode" then
self:UpdateMouseLockAvailability()
end
end)
-- Watch for changes to DevEnableMouseLock and update the feature availability accordingly
PlayersService.LocalPlayer:GetPropertyChangedSignal("DevEnableMouseLock"):Connect(function()
self:UpdateMouseLockAvailability()
end)
-- Watch for changes to DevEnableMouseLock and update the feature availability accordingly
PlayersService.LocalPlayer:GetPropertyChangedSignal("DevComputerMovementMode"):Connect(function()
self:UpdateMouseLockAvailability()
end)
self:UpdateMouseLockAvailability()
return self
end
function MouseLockController:GetIsMouseLocked()
return self.isMouseLocked
end
function MouseLockController:GetBindableToggleEvent()
return self.mouseLockToggledEvent.Event
end
function MouseLockController:GetMouseLockOffset()
local offsetValueObj = script:FindFirstChild("CameraOffset")
if offsetValueObj and offsetValueObj:IsA("Vector3Value") then
return offsetValueObj.Value
else
-- If CameraOffset object was found but not correct type, destroy
if offsetValueObj then
offsetValueObj:Destroy()
end
offsetValueObj = Instance.new("Vector3Value")
offsetValueObj.Name = "CameraOffset"
offsetValueObj.Value = Vector3.new(1.75,0,0) -- Legacy Default Value
offsetValueObj.Parent = script
end
if offsetValueObj and offsetValueObj.Value then
return offsetValueObj.Value
end
return Vector3.new(1.75,0,0)
end
function MouseLockController:UpdateMouseLockAvailability()
local devAllowsMouseLock = PlayersService.LocalPlayer.DevEnableMouseLock
local devMovementModeIsScriptable = PlayersService.LocalPlayer.DevComputerMovementMode == Enum.DevComputerMovementMode.Scriptable
local userHasMouseLockModeEnabled = GameSettings.ControlMode == Enum.ControlMode.MouseLockSwitch
local userHasClickToMoveEnabled = GameSettings.ComputerMovementMode == Enum.ComputerMovementMode.ClickToMove
local MouseLockAvailable = devAllowsMouseLock and userHasMouseLockModeEnabled and not userHasClickToMoveEnabled and not devMovementModeIsScriptable
if MouseLockAvailable~=self.enabled then
self:EnableMouseLock(MouseLockAvailable)
end
end
function MouseLockController:OnBoundKeysObjectChanged(newValue)
self.boundKeys = {} -- Overriding defaults, note: possibly with nothing at all if boundKeysObj.Value is "" or contains invalid values
for token in string.gmatch(newValue,"[^%s,]+") do
for keyCode, keyEnum in pairs(Enum.KeyCode:GetEnumItems()) do
if token == keyEnum.Name then
self.boundKeys[#self.boundKeys+1] = keyEnum
break
end
end
end
if FFlagPlayerScriptsBindAtPriority then
self:UnbindContextActions()
self:BindContextActions()
end
end
|
-- -- Go through each valid target to see if within field of view and if there is
-- -- clear line of sight. Field of view treated as wedge in front of character.
-- for _, character in pairs(characters) do
-- local toTarget = (character.HumanoidRootPart.Position - model.HumanoidRootPart.Position)
-- toTarget = Vector3.new(toTarget.X, 0, toTarget.Z)
-- local angle = math.acos(toTarget:Dot(model.HumanoidRootPart.CFrame.lookVector)/toTarget.magnitude)
-- if math.deg(angle) < configs["FieldOfView"]/2 then
-- ZombieTarget = character
-- -- raycast to see if target is actually visible
-- local toTarget = Ray.new(model.HumanoidRootPart.Position, (ZombieTarget.HumanoidRootPart.Position - model.HumanoidRootPart.Position))
-- local part, position = game.Workspace:FindPartOnRayWithIgnoreList(toTarget, zombies)
-- if part and part.Parent == ZombieTarget then
-- return true
-- end
-- ZombieTarget = nil
-- end
-- end |
end
return false
end
CanSeeTarget.TransitionState = PursueState
-- TargetDead: Check if target is dead.
local TargetDead = StateMachine.NewCondition()
TargetDead.Name = "TargetDead"
TargetDead.Evaluate = function()
if ZombieTarget and ZombieTarget.Humanoid then
return ZombieTarget.Humanoid.Health <= 0
end
return true
end
TargetDead.TransitionState = IdleState
-- GotDamaged: Check if NPC has taken damage
local lastHealth = model.Humanoid.Health
local GotDamaged = StateMachine.NewCondition()
GotDamaged.Name = "GotDamaged"
GotDamaged.Evaluate = function()
if model then
if lastHealth > model.Humanoid.Health then
return true
end
end
return false
end
GotDamaged.TransitionState = SearchState
-- GotBored: Used to provide random state change.
local GotBored = StateMachine.NewCondition()
GotBored.Name = "GotBored"
GotBored.Evaluate = function()
local now = os.time()
if now - lastBored > configs["BoredomDuration"] then
local roll = math.random()
if roll < configs["ChanceOfBoredom"] then
lastBored = now
if GotBored.TransitionState == SearchState then
GotBored.TransitionState = IdleState
else
GotBored.TransitionState = SearchState
end
return true
end
end
return false
end
GotBored.TransitionState = IdleState
-- LostTarget: Checks clear line of sight
local LostTarget = StateMachine.NewCondition()
LostTarget.Name = "LostTarget"
LostTarget.Evaluate = function()
if true then return false end
if ZombieTarget and model:FindFirstChild("HumanoidRootPart") and ZombieTarget:FindFirstChild("HumanoidRootPart") then
if (ZombieTarget.HumanoidRootPart.Position - model.HumanoidRootPart.Position).magnitude > 10 then
local toTarget = Ray.new(model.HumanoidRootPart.Position, (ZombieTarget.HumanoidRootPart.Position - model.HumanoidRootPart.Position))
local part, position = game.Workspace:FindPartOnRay(toTarget, model)
if not part or part.Parent ~= ZombieTarget then
--print("Lost target!")
ZombieTargetLastLocation = ZombieTarget.HumanoidRootPart.Position
ZombieTarget = nil
return true
end
end
end
return false
end
LostTarget.TransitionState = HuntState
local WithinRange = StateMachine.NewCondition()
WithinRange.Name = "WithinRange"
WithinRange.Evaluate = function()
if ZombieTarget and model:FindFirstChild("HumanoidRootPart") and ZombieTarget:FindFirstChild("HumanoidRootPart") then
local distance = (model.HumanoidRootPart.Position - ZombieTarget.HumanoidRootPart.Position).magnitude
if distance < configs["AttackRange"] then
--print("Within attack range!")
return true
end
end
return false
end
WithinRange.TransitionState = AttackState
local OutsideRange = StateMachine.NewCondition()
OutsideRange.Name = "OutsideRange"
OutsideRange.Evaluate = function()
if ZombieTarget and model:FindFirstChild("HumanoidRootPart") and ZombieTarget:FindFirstChild("HumanoidRootPart") then
local distance = (model.HumanoidRootPart.Position - ZombieTarget.HumanoidRootPart.Position).magnitude
if distance > configs["AttackRange"] then
--print("Outside attack range!")
return true
end
end
return false
end
OutsideRange.TransitionState = PursueState
table.insert(IdleState.Conditions, CanSeeTarget)
table.insert(IdleState.Conditions, GotDamaged)
table.insert(IdleState.Conditions, GotBored)
table.insert(SearchState.Conditions, GotBored)
table.insert(SearchState.Conditions, CanSeeTarget)
table.insert(PursueState.Conditions, LostTarget)
table.insert(PursueState.Conditions, WithinRange)
table.insert(PursueState.Conditions, TargetDead)
table.insert(AttackState.Conditions, OutsideRange)
table.insert(AttackState.Conditions, TargetDead)
table.insert(HuntState.Conditions, GotBored)
table.insert(HuntState.Conditions, CanSeeTarget)
-- Setup arms damage
local canHit = true
local lastHit = os.time()
local function handleHit(other)
if canHit then
if other and other.Parent and other.Parent.Name ~= "Drooling Zombie" and other.Parent:FindFirstChild("Humanoid") then
local enemy = other.Parent
if enemy.Humanoid.WalkSpeed > 0 then
enemy.Humanoid.Health = enemy.Humanoid.Health - configs["Damage"]
canHit = false
end
end
else
local now = os.time()
if now - lastHit > configs["DamageCooldown"] then
lastHit = now
canHit = true
end
end
end
local leftHitConnect, rightHitConnect
leftHitConnect = model:FindFirstChild("Left Arm").Touched:connect(handleHit)
rightHitConnect = model:FindFirstChild("Right Arm").Touched:connect(handleHit)
--ZombieAI.Animate(model)
--updateDisplay()
--updateDisplay(model.BillboardGui.TextLabel, StateMachine.CurrentState)
local thread = coroutine.create(function()
while true do
wait()
-- calculate repulsion force
local humanoids = HumanoidList:GetCurrent()
local localZombies = {}
for _, humanoid in pairs(humanoids) do
if humanoid and humanoid ~= model.Humanoid and humanoid.Parent and humanoid.Parent:FindFirstChild("HumanoidRootPart") then
local torso = humanoid.Parent:FindFirstChild("HumanoidRootPart")
if not model:FindFirstChild("HumanoidRootPart") then continue end
local distance = (model.HumanoidRootPart.Position - torso.Position).magnitude
if distance <= 2.5 then
table.insert(localZombies, torso.Position)
end
end
end
local repulsionDirection
if model:FindFirstChild("HumanoidRootPart") then
repulsionDirection = AIUtilities:GetRepulsionVector(model.HumanoidRootPart.Position, localZombies)
if repulsionDirection.magnitude > 0 then
--print("replusion direction: " .. tostring(repulsionDirection))
end
model.HumanoidRootPart.RepulsionForce.force = repulsionDirection
end
if StateMachine.CurrentState and model.Configurations.Debug.Value then
model.BillboardGui.TextLabel.Visible = true
model.BillboardGui.TextLabel.Text = StateMachine.CurrentState.Name
end
if not model.Configurations.Debug.Value then
model.BillboardGui.TextLabel.Visible = false
end
end
end)
coroutine.resume(thread)
StateMachine.SwitchState(IdleState)
zombie.Stop = function()
StateMachine.SwitchState(nil)
end
return zombie
end
return ZombieAI
|
-- ROBLOX MOVED: expect/jasmineUtils.lua |
local function equals(a: any, b: any, customTesters: Array<Tester>?, strictCheck: boolean?): boolean
customTesters = customTesters or {}
strictCheck = strictCheck or false
return eq(a, b, {}, {}, customTesters :: Array<Tester>, strictCheck and hasKey or hasDefinedKey)
end
|
--[[Waiting for Assets]] | --
dir = script.Parent
dir:WaitForChild("Content")
c = dir.Content
|
-- preload all of the faces |
for i = 1, #toiletFace do
Game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id="..tostring(toiletFace[i]))
end
|
--// Processing |
return function()
local _G, game, script, getfenv, setfenv, workspace,
getmetatable, setmetatable, loadstring, coroutine,
rawequal, typeof, print, math, warn, error, pcall,
pcall, xpcall, select, rawset, rawget, ipairs, pairs,
next, Rect, Axes, os, tick, Faces, unpack, string, Color3,
newproxy, tostring, tonumber, Instance, TweenInfo, BrickColor,
NumberRange, ColorSequence, NumberSequence, ColorSequenceKeypoint,
NumberSequenceKeypoint, PhysicalProperties, Region3int16,
Vector3int16, elapsedTime, 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,
pcall, xpcall, select, rawset, rawget, ipairs, pairs,
next, Rect, Axes, os, tick, Faces, unpack, string, Color3,
newproxy, tostring, tonumber, Instance, TweenInfo, BrickColor,
NumberRange, ColorSequence, NumberSequence, ColorSequenceKeypoint,
NumberSequenceKeypoint, PhysicalProperties, Region3int16,
Vector3int16, elapsedTime, require, table, type, wait,
Enum, UDim, UDim2, Vector2, Vector3, Region3, CFrame, Ray, delay
local script = script
local service = service
local client = 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;
end
getfenv().client = nil
getfenv().service = nil
getfenv().script = nil
client.Process = {
Init = Init;
Remote = function(data,com,...)
local args = {...}
Remote.Received = Remote.Received+1
if type(com) == "string" then
if com == client.DepsName.."GIVE_KEY" then
if not Core.Key then
Core.Key = args[1]
client.Finish_Loading()
end
elseif Remote.UnEncrypted[com] then
Remote.UnEncrypted[com](...)
elseif Core.Key then
local comString = Remote.Decrypt(com,Core.Key)
local command = Remote.Commands[comString]
if command then
--local ran,err = pcall(command, args) --task service.Threads.RunTask("REMOTE:"..comString,command,args)
local ran,err = service.TrackTask("Remote: ".. comString, command, args)
if not ran and err then
logError(err)
end
end
end
end
end;
LogService = function(Message, Type)
--service.FireEvent("Output", Message, Type)
end;
ErrorMessage = function(Message, Trace, Script)
--service.FireEvent("ErrorMessage", Message, Trace, Script)
if Message and Message ~= "nil" and Message ~= "" and (string.find(Message,"::Adonis::") or string.find(Message,script.Name) or Script == script) then
logError(tostring(Message).." - "..tostring(Trace))
end
if (Script == nil or (not Trace or Trace == "")) and not (Trace and string.find(Trace,"CoreGui.RobloxGui")) then
--Anti.Detected("log","Scriptless/Traceless error found. Script: "..tostring(Script).." - Trace: "..tostring(Trace))
end
end;
Chat = function(msg)
--service.FireEvent("Chat",msg)
if not service.Player or service.Player.Parent ~= service.Players then
Remote.Fire("ProcessChat",msg)
end
end;
CharacterAdded = function()
UI.GetHolder()
service.Events.CharacterAdded:fire()
end;
CharacterRemoving = function()
if Variables.UIKeepAlive then
for ind,g in next,client.GUIs do
if g.Class == "ScreenGui" or g.Class == "GuiMain" or g.Class == "TextLabel" then
if g.CanKeepAlive then
g.KeepAlive = true
g.KeepParent = g.Object.Parent
g.Object.Parent = nil
elseif service.StarterGui.ResetPlayerGuiOnSpawn then
pcall(g.Destroy,g)
end
end
end
end
if Variables.GuiViewFolder then
Variables.GuiViewFolder:Destroy()
Variables.GuiViewFolder = nil
end
if Variables.ChatEnabled then
service.StarterGui:SetCoreGuiEnabled("Chat",true)
end
if Variables.PlayerListEnabled then
service.StarterGui:SetCoreGuiEnabled('PlayerList',true)
end
local textbox = service.UserInputService:GetFocusedTextBox()
if textbox then
textbox:ReleaseFocus()
end
service.Events.CharacterRemoving:fire()
end
}
end
|
--slow transitions, looks slick |
script.Parent.Color = Color3.new(1,0,0) --Color3.new(math.random(), math.random(), math.random())
wait(0.2)
script.Parent.Color = Color3.new(.8,.2,0) --Color3.new(math.random(), math.random(), math.random())
wait(0.2)
script.Parent.Color = Color3.new(.6,.4,0) --Color3.new(math.random(), math.random(), math.random())
wait(0.2)
script.Parent.Color = Color3.new(.4,.6,0) --Color3.new(math.random(), math.random(), math.random())
wait(0.2)
script.Parent.Color = Color3.new(.2,.8,0) --Color3.new(math.random(), math.random(), math.random())
wait(0.2)
script.Parent.Color = Color3.new(0,1,0) --Color3.new(math.random(), math.random(), math.random())
wait(0.2)
script.Parent.Color = Color3.new(0,0.8,.2) --Color3.new(math.random(), math.random(), math.random())
wait(0.2)
script.Parent.Color = Color3.new(0,0.6,.4) --Color3.new(math.random(), math.random(), math.random())
wait(0.2)
script.Parent.Color = Color3.new(0,0.4,.6) --Color3.new(math.random(), math.random(), math.random())
wait(0.2)
script.Parent.Color = Color3.new(0,0.2,.8) --Color3.new(math.random(), math.random(), math.random())
wait(0.2)
script.Parent.Color = Color3.new(0,0,1) --Color3.new(math.random(), math.random(), math.random())
wait(0.2)
script.Parent.Color = Color3.new(.2,0,.8) --Color3.new(math.random(), math.random(), math.random())
wait(0.2)
script.Parent.Color = Color3.new(.4,0,.6) --Color3.new(math.random(), math.random(), math.random())
wait(0.2)
script.Parent.Color = Color3.new(.6,0,.4) --Color3.new(math.random(), math.random(), math.random())
wait(0.2)
script.Parent.Color = Color3.new(.8,0,.2) --Color3.new(math.random(), math.random(), math.random())
wait(0.2)
mode2()
end
function mode3() |
--[[
Shorthand for a finally handler that returns the given value.
]] |
function Promise.prototype:finallyReturn(...)
local length, values = pack(...)
return self:_finally(debug.traceback(nil, 2), function()
return unpack(values, 1, length)
end)
end
Promise.prototype.FinallyReturn = Promise.prototype.finallyReturn
|
--[[ Script Variables ]] | --
while not Players.LocalPlayer do
task.wait()
end
local LocalPlayer = Players.LocalPlayer
local IsFollowStick = false
local ThumbstickFrame = nil
local MoveTouchObject = nil
local OnTouchEnded = nil -- defined in Create()
local OnTouchMovedCn = nil
local OnTouchEndedCn = nil
local currentMoveVector = Vector3.new(0,0,0)
|
-- Listen for players joining the game |
game.Players.PlayerAdded:Connect(onPlayerAdded)
|
--[[
Returns an estimate of the amount of time a data store request could take to complete given the
number of attempts, retryConstant, retryExponent and a reasonable worst case estimate for how long
the DataStoreService call might take to complete.
See DataStoreWrapper and retryAsync for actual retrying implementations.
--]] |
local DATA_STORE_REQUEST_TIME = 3
local function getMaxRequestTime(numAttempts: number, retryConstant: number, retryExponent: number)
local requestTime = 0
for attemptNumber = 1, numAttempts do
requestTime += DATA_STORE_REQUEST_TIME
if attemptNumber > 1 then
requestTime += retryConstant + (retryExponent ^ attemptNumber)
end
end
return requestTime
end
return getMaxRequestTime
|
-- FUNCTIONS -- |
return function(Action, Variable2, Variable3, Variable4)
if Action == "Drop" then
local Dropper = Variable2
local dropID = Variable3
local dropValue = Variable4
local dropPart = Dropper:FindFirstChild("Drop")
if not dropPart then return end
local currentValue = dropValue
local drop = Ore:Clone()
drop.Name = Variable3
drop.Position = dropPart.Attachment.WorldPosition
drop.Anchored = false
drop.Parent = workspace.Debris
game.Debris:AddItem(drop, 10)
local billboardGui = PriceUI:Clone()
billboardGui.TextLabel.Text = tostring(numShorten(currentValue))
billboardGui.Parent = drop
drop.Touched:Connect(function(Hit)
if Hit.Name == "Sell" then
drop:Destroy()
print(dropID, " had been sold! - CLIENT")
elseif Hit.Name == "Upgrade" then
if not drop:FindFirstChild(Hit.Parent.Name) then
local upgradeValue = Instance.new("BoolValue")
upgradeValue.Name = Hit.Parent.Name
upgradeValue.Parent = drop
Replicate:FireServer("Upgrade", drop.Name, Hit.Parent)
currentValue = currentValue * Hit.Parent.Data.Upgrade.Value
billboardGui.TextLabel.Text = tostring(numShorten(currentValue))
end
end
end)
end
end
|
--// Core |
return function(Vargs, GetEnv)
local env = GetEnv(nil, {script = script})
setfenv(1, env)
local server = Vargs.Server;
local service = Vargs.Service;
local Functions, Admin, Anti, Core, HTTP, Logs, Remote, Process, Variables, Settings, Deps;
local AddLog, Queue, TrackTask
local function Init(data)
Functions = server.Functions;
Admin = server.Admin;
Anti = server.Anti;
Core = server.Core;
HTTP = server.HTTP;
Logs = server.Logs;
Remote = server.Remote;
Process = server.Process;
Variables = server.Variables;
Settings = server.Settings;
Deps = server.Deps;
AddLog = Logs.AddLog;
Queue = service.Queue;
TrackTask = service.TrackTask;
--// Core variables
Core.Themes = data.Themes or {}
Core.Plugins = data.Plugins or {}
Core.ModuleID = data.ModuleID or 7510592873
Core.LoaderID = data.LoaderID or 7510622625
Core.DebugMode = data.DebugMode or false
Core.Name = server.Functions:GetRandom()
Core.LoadstringObj = Core.GetLoadstring()
Core.Loadstring = require(Core.LoadstringObj)
service.DataStoreService = require(Deps.MockDataStoreService)
disableAllGUIs(server.Client.UI);
Core.Init = nil;
AddLog("Script", "Core Module Initialized")
end;
local function RunAfterPlugins(data)
--// RemoteEvent Handling
Core.MakeEvent()
--// Prepare the client loader
--local existingPlayers = service.Players:GetPlayers();
--Core.MakeClient()
local remoteParent = service.ReplicatedStorage;
remoteParent.ChildRemoved:Connect(function(c)
if server.Core.RemoteEvent and not server.Core.FixingEvent and (function() for i,v in pairs(server.Core.RemoteEvent) do if c == v then return true end end end)() then
wait();
server.Core.MakeEvent()
end
end)
--// Load data
Core.DataStore = server.Core.GetDataStore()
if Core.DataStore then
TrackTask("Thread: DSLoadAndHook", function()
pcall(server.Core.LoadData)
end)
end
--// Save all data on server shutdown & set GAME_CLOSING
game:BindToClose(function()
Core.GAME_CLOSING = true;
Core.SaveAllPlayerData();
end);
--// Start API
if service.NetworkServer then
--service.Threads.RunTask("_G API Manager",server.Core.StartAPI)
TrackTask("Thread: API Manager", Core.StartAPI)
end
--// Occasionally save all player data to the datastore to prevent data loss if the server abruptly crashes
service.StartLoop("SaveAllPlayerData", Core.DS_AllPlayerDataSaveInterval, Core.SaveAllPlayerData, true)
Core.RunAfterPlugins = nil;
AddLog("Script", "Core Module RunAfterPlugins Finished");
end
server.Core = {
Init = Init;
RunAfterPlugins = RunAfterPlugins;
DataQueue = {};
DataCache = {};
PlayerData = {};
CrossServerCommands = {};
CrossServer = function(...) return false end;
ExecuteScripts = {};
LastDataSave = 0;
FixingEvent = false;
ScriptCache = {};
Connections = {};
BytecodeCache = {};
LastEventValue = 1;
Variables = {
TimeBans = {};
};
--// Datastore update/queue timers/delays
DS_WriteQueueDelay = 1;
DS_ReadQueueDelay = 0.5;
DS_AllPlayerDataSaveInterval = 30;
DS_AllPlayerDataSaveQueueDelay = 0.5;
--// Used to change/"reset" specific datastore keys
DS_RESET_SALTS = {
SavedSettings = "32K5j4";
SavedTables = "32K5j4";
};
DS_BLACKLIST = {
Trello_Enabled = true;
Trello_Primary = true;
Trello_Secondary = true;
Trello_Token = true;
Trello_AppKey = true;
DataStore = true;
DataStoreKey = true;
DataStoreEnabled = true;
Creators = true;
Permissions = true;
G_API = true;
G_Access = true;
G_Access_Key = true;
G_Access_Perms = true;
Allowed_API_Calls = true;
LoadAdminsFromDS = true;
["Settings.Ranks.Creators.Users"] = true;
["Admin.SpecialLevels"] = true;
OnStartup = true;
OnSpawn = true;
OnJoin = true;
CustomRanks = true;
Ranks = true;
--// Not gonna let malicious stuff set DS_Blacklist to {} or anything!
DS_BLACKLIST = true;
};
--// Prevent certain keys from loading from the DataStore
PlayerDataKeyBlacklist = {
AdminRank = true;
AdminLevel = true;
LastLevelUpdate = true;
};
DisconnectEvent = function()
if Core.RemoteEvent and not Core.FixingEvent then
Core.FixingEvent = true;
for name,event in pairs(Core.RemoteEvent.Events) do
event:Disconnect()
end
pcall(function() service.Delete(Core.RemoteEvent.Object) end)
pcall(function() service.Delete(Core.RemoteEvent.Function) end)
Core.FixingEvent = false;
Core.RemoteEvent = nil;
end
end;
MakeEvent = function()
local remoteParent = service.ReplicatedStorage;
local ran, error = pcall(function()
if server.Running then
local rTable = {};
local event = service.New("RemoteEvent", {Name = Core.Name, Archivable = false}, true, true)
local func = service.New("RemoteFunction", {Name = "__FUNCTION", Parent = event}, true, true)
local secureTriggered = true
local tripDet = math.random()
local function secure(ev, name, parent)
return ev.Changed:Connect(function()
if Core.RemoteEvent == rTable and not secureTriggered then
if ev == func then
func.OnServerInvoke = Process.Remote
end
if ev.Name ~= name then
ev.Name = name
elseif ev.Parent ~= parent then
secureTriggered = true;
Core.DisconnectEvent();
Core.MakeEvent()
end
end
end)
end
Core.DisconnectEvent();
Core.TripDet = tripDet;
rTable.Events = {};
rTable.Object = event;
rTable.Function = func;
rTable.Events.Security = secure(event, event.Name, remoteParent);
rTable.Events.FuncSec = secure(func, func.Name, event);
func.OnServerInvoke = Process.Remote;
rTable.Events.ProcessEvent = service.RbxEvent(event.OnServerEvent, Process.Remote);
Core.RemoteEvent = rTable;
event.Parent = remoteParent;
secureTriggered = false;
AddLog(Logs.Script,{
Text = "Created RemoteEvent";
Desc = "RemoteEvent was successfully created";
})
end
end)
if error then
warn(error)
end
end;
UpdateConnections = function()
if service.NetworkServer then
for i,cli in ipairs(service.NetworkServer:GetChildren()) do
if cli:IsA("NetworkReplicator") then
Core.Connections[cli] = cli:GetPlayer()
end
end
end
end;
UpdateConnection = function(p)
if service.NetworkServer then
for i,cli in ipairs(service.NetworkServer:GetChildren()) do
if cli:IsA("NetworkReplicator") and cli:GetPlayer() == p then
Core.Connections[cli] = p
end
end
end
end;
GetNetworkClient = function(p)
if service.NetworkServer then
for i,cli in ipairs(service.NetworkServer:GetChildren()) do
if cli:IsA("NetworkReplicator") and cli:GetPlayer() == p then
return cli
end
end
end
end;
MakeClient = function(parent)
if not parent and Core.ClientLoader then
local loader = Core.ClientLoader;
loader.Removing = true;
for i,v in pairs(loader.Events) do
v:Disconnect()
end
loader.Object:Destroy();
end;
local depsName = Functions:GetRandom()
local folder = server.Client:Clone()
local acli = server.Deps.ClientMover:Clone();
local client = folder.Client
local parentObj = parent or service.StarterPlayer:FindFirstChildOfClass("StarterPlayerScripts");
local clientLoader = {
Removing = false;
};
Core.MockClientKeys = Core.MockClientKeys or {
Special = depsName;
Module = client;
}
local depsName = Core.MockClientKeys.Special;
local specialVal = service.New("StringValue")
specialVal.Value = Core.Name.."\\"..depsName
specialVal.Name = "Special"
specialVal.Parent = folder
acli.Parent = folder;
acli.Disabled = false;
folder.Archivable = false;
folder.Name = depsName; --"Adonis_Client"
folder.Parent = parentObj;
if not parent then
local oName = folder.Name;
clientLoader.Object = folder;
clientLoader.Events = {}
clientLoader.Events[folder] = folder.Changed:Connect(function()
if Core.ClientLoader == clientLoader and not clientLoader.Removing then
if folder.Name ~= oName then
folder.Name = oName;
elseif folder.Parent ~= parentObj then
clientLoader.Removing = true;
Core.MakeClient();
end
end
end)
local function sec(child)
local oParent = child.Parent;
local oName = child.Name;
clientLoader.Events[child.Changed] = child.Changed:Connect(function(c)
if Core.ClientLoader == clientLoader and not clientLoader.Removing then
if child.Parent ~= oParent or child == specialVal then
Core.MakeClient();
end
end
end)
local nameEvent = child:GetPropertyChangedSignal("Name"):Connect(function()
if Core.ClientLoader == clientLoader and not clientLoader.Removing then
child.Name = oName;
end
end)
clientLoader.Events[nameEvent] = nameEvent;
clientLoader.Events[child.AncestryChanged] = child.AncestryChanged:Connect(function()
if Core.ClientLoader == clientLoader and not clientLoader.Removing then
Core.MakeClient();
end
end)
end;
for i,child in ipairs(folder:GetDescendants()) do
sec(child);
end
folder.DescendantAdded:Connect(function(d)
if Core.ClientLoader == clientLoader and not clientLoader.Removing then
Core.MakeClient();
end
end)
folder.DescendantRemoving:Connect(function(d)
if Core.ClientLoader == clientLoader and not clientLoader.Removing then
Core.MakeClient();
end
end)
Core.ClientLoader = clientLoader;
end
local ok,err = pcall(function()
folder.Parent = parentObj
end)
clientLoader.Removing = false;
AddLog("Script", "Created client");
end;
HookClient = function(p)
local key = tostring(p.UserId)
local keys = Remote.Clients[key]
if keys then
local depsName = Functions:GetRandom()
local eventName = Functions:GetRandom()
local folder = server.Client:Clone()
local acli = server.Deps.ClientMover:Clone();
local client = folder.Client
local parentTo = "PlayerGui" --// Roblox, seriously, please give the server access to PlayerScripts already so I don't need to do this.
local parentObj = p:FindFirstChildOfClass(parentTo) or p:WaitForChild(parentTo, 600);
if not p.Parent then
return false
elseif not parentObj then
p:Kick("\n[CLI-102495] Loading Error \nPlayerGui Missing (Waited 10 Minutes)")
return false
end
local container = service.New("ScreenGui");
container.ResetOnSpawn = false;
container.Enabled = false;
container.Name = "\0";
local specialVal = service.New("StringValue")
specialVal.Value = Core.Name.."\\"..depsName
specialVal.Name = "Special"
specialVal.Parent = folder
keys.Special = depsName
keys.EventName = eventName
keys.Module = client
acli.Parent = folder;
acli.Disabled = false;
folder.Name = "Adonis_Client"
folder.Parent = container;
--// Event only fires AFTER the client is alive and well
local event; event = service.Events.ClientLoaded:Connect(function(plr)
if p == plr and container.Parent == parentObj then
container.Parent = nil --container:Destroy(); -- Destroy update causes an issue with this pretty sure
p.AncestryChanged:Connect(function() -- after/on remove, not on removing...
if p.Parent == nil then
pcall(function() container:Destroy() end) -- Prevent potential memory leak and ensure this gets properly murdered when they leave and it's no longer needed
end
end)
event:Disconnect();
end
end)
local ok,err = pcall(function()
container.Parent = parentObj
end)
if not ok then
p:Kick("\n[CLI-192385] Loading Error \n[HookClient Error: "..tostring(err).."]")
return false
else
return true
end
else
if p and p.Parent then
p:Kick("\n[CLI-5691283] Loading Error \n[HookClient: Keys Missing]")
end
end
end;
LoadClientLoader = function(p)
local loader = Deps.ClientLoader:Clone()
loader.Name = Functions.GetRandom()
loader.Parent = p:WaitForChild("PlayerGui", 60) or p:WaitForChild("Backpack")
loader.Disabled = false
end;
LoadExistingPlayer = function(p)
warn("Loading existing player: ".. tostring(p))
TrackTask("Thread: Setup Existing Player: ".. tostring(p), function()
Process.PlayerAdded(p)
--Core.MakeClient(p:FindFirstChildOfClass("PlayerGui") or p:WaitForChild("PlayerGui", 120))
end)
end;
ExecutePermission = function(scr, code, isLocal)
local fixscr = service.UnWrap(scr)
for _, val in pairs(Core.ExecuteScripts) do
if not isLocal or (isLocal and val.Type == "LocalScript") then
if (service.UnWrap(val.Script) == fixscr or code == val.Code) and (not val.runLimit or (val.runLimit ~= nil and val.Executions <= val.runLimit)) then
val.Executions = val.Executions+1
return {
Source = val.Source;
noCache = val.noCache;
runLimit = val.runLimit;
Executions = val.Executions;
}
end
end
end
end;
GetScript = function(scr,code)
for i,val in pairs(Core.ExecuteScripts) do
if val.Script == scr or code == val.Code then
return val,i
end
end
end;
UnRegisterScript = function(scr)
for i,dat in pairs(Core.ExecuteScripts) do
if dat.Script == scr or dat == scr then
table.remove(Core.ExecuteScripts, i)
return dat
end
end
end;
RegisterScript = function(data)
data.Executions = 0
data.Time = os.time()
data.Type = data.Script.ClassName
data.Wrapped = service.Wrap(data.Script)
data.Wrapped:SetSpecial("Clone",function()
return Core.RegisterScript {
Script = service.UnWrap(data.Script):Clone();
Code = data.Code;
Source = data.Source;
noCache = data.noCache;
runLimit = data.runLimit;
}
end)
for ind,scr in pairs(Core.ExecuteScripts) do
if scr.Script == data.Script then
return scr.Wrapped or scr.Script
end
end
if not data.Code then
data.Code = Functions.GetRandom()
end
table.insert(Core.ExecuteScripts,data)
return data.Wrapped
end;
GetLoadstring = function()
local newLoad = Deps.Loadstring:Clone();
local lbi = server.Shared.FiOne:Clone();
lbi.Parent = newLoad
return newLoad;
end;
Bytecode = function(str)
if Core.BytecodeCache[str] then return Core.BytecodeCache[str] end
local f, buff = Core.Loadstring(str)
Core.BytecodeCache[str] = buff
return buff
end;
NewScript = function(type,source,allowCodes,noCache,runLimit)
local ScriptType
local execCode = Functions.GetRandom()
if type == 'Script' then
ScriptType = Deps.ScriptBase:Clone()
elseif type == 'LocalScript' then
ScriptType = Deps.LocalScriptBase:Clone()
end
if ScriptType then
ScriptType.Name = "[Adonis] ".. type
if allowCodes then
service.New("StringValue", {
Name = "Execute",
Value = execCode,
Parent = ScriptType,
})
end
local wrapped = Core.RegisterScript {
Script = ScriptType;
Code = execCode;
Source = Core.Bytecode(source);
noCache = noCache;
runLimit = runLimit;
}
return wrapped or ScriptType, ScriptType, execCode
end
end;
SavePlayer = function(p,data)
local key = tostring(p.UserId)
Core.PlayerData[key] = data
end;
DefaultPlayerData = function(p)
return {
Donor = {
Cape = {
Image = '0';
Color = 'White';
Material = 'Neon';
};
Enabled = false;
};
Banned = false;
TimeBan = false;
AdminNotes = {};
Keybinds = {};
Aliases = {};
Client = {};
Warnings = {};
AdminPoints = 0;
};
end;
GetPlayer = function(p)
local key = tostring(p.UserId)
if not Core.PlayerData[key] then
local PlayerData = Core.DefaultPlayerData(p)
Core.PlayerData[key] = PlayerData
if Core.DataStore then
local data = Core.GetData(key)
if data and type(data) == "table" then
data.AdminNotes = (data.AdminNotes and Functions.DSKeyNormalize(data.AdminNotes, true)) or {}
data.Warnings = (data.Warnings and Functions.DSKeyNormalize(data.Warnings, true)) or {}
local BLOCKED_SETTINGS = server.Core.PlayerDataKeyBlacklist
for i,v in pairs(data) do
if not BLOCKED_SETTINGS[i] then
PlayerData[i] = v
end
end
end
end
return PlayerData
else
return Core.PlayerData[key]
end
end;
ClearPlayer = function(p)
Core.PlayerData[tostring(p.UserId)] = Core.DefaultData(p);
end;
SavePlayerData = function(p, customData)
local key = tostring(p.UserId);
local pData = customData or Core.PlayerData[key];
if Core.DataStore then
if pData then
local data = service.CloneTable(pData);
data.LastChat = nil
data.AdminRank = nil
data.AdminLevel = nil
data.LastLevelUpdate = nil
data.LastDataSave = nil
data.AdminNotes = Functions.DSKeyNormalize(data.AdminNotes)
data.Warnings = Functions.DSKeyNormalize(data.Warnings)
Core.SetData(key, data)
AddLog(Logs.Script,{
Text = "Saved data for ".. p.Name;
Desc = "Player data was saved to the datastore";
})
pData.LastDataSave = os.time();
end
end
end;
SaveAllPlayerData = function(queueWaitTime)
local TrackTask = service.TrackTask
for key,pdata in pairs(Core.PlayerData) do
local id = tonumber(key);
local player = id and service.Players:GetPlayerByUserId(id);
if player and (not pdata.LastDataSave or os.time() - pdata.LastDataSave >= Core.DS_AllPlayerDataSaveInterval) then
TrackTask(string.format("Save data for %s", player.Name), Core.SavePlayerData, player);
end
end
--[[ --// OLD METHOD (Kept in case this messes anything up)
for i,p in next,service.Players:GetPlayers() do
local pdata = Core.PlayerData[tostring(p.UserId)];
--// Only save player's data if it has not been saved within the last INTERVAL (default 30s)
if pdata and (not pdata.LastDataSave or os.time() - pdata.LastDataSave >= Core.DS_AllPlayerDataSaveInterval) then
service.Queue("SavePlayerData", function()
Core.SavePlayerData(p)
wait(queueWaitTime or Core.DS_AllPlayerDataSaveQueueDelay)
end)
end
end--]]
end;
GetDataStore = function()
local ran,store = pcall(function()
return service.DataStoreService:GetDataStore(string.sub(Settings.DataStore, 1, 50),"Adonis")
end)
-- DataStore studio check.
if ran and store and service.RunService:IsStudio() then
local success, res = pcall(store.GetAsync, store, math.random())
if not success and string.find(res, "502", 1, true) then
warn("Unable to load data because Studio access to API services is disabled.")
return;
end
end
return ran and store
end;
DataStoreEncode = function(key)
if Core.DS_RESET_SALTS[key] then
key = Core.DS_RESET_SALTS[key] .. key
end
return Functions.Base64Encode(Remote.Encrypt(tostring(key), Settings.DataStoreKey))
end;
SaveData = function(...)
return Core.SetData(...)
end;
DS_GetRequestDelay = function(type)
local requestType, budget;
local reqPerMin = 60 + #service.Players:GetPlayers() * 10;
local reqDelay = 60 / reqPerMin;
if type == "Write" then
requestType = Enum.DataStoreRequestType.SetIncrementAsync;
elseif type == "Read" then
requestType = Enum.DataStoreRequestType.GetAsync;
elseif type == "Update" then
requestType = Enum.DataStoreRequestType.UpdateAsync;
end
repeat
budget = service.DataStoreService:GetRequestBudgetForRequestType(requestType);
until budget > 0 and task.wait(1)
return reqDelay + 0.5;
end;
DS_WriteLimiter = function(type, func, ...)
local vararg = table.pack(...)
return Queue("DataStoreWriteData_" .. tostring(type), function()
local gotDelay = Core.DS_GetRequestDelay(type); --// Wait for budget, also return how long we should wait before the next request is allowed to go
func(unpack(vararg, 1, vararg.n))
task.wait(gotDelay)
end, 120, true)
end;
RemoveData = function(key)
local DataStore = Core.DataStore
if DataStore then
local ran2, err2 = Queue("DataStoreWriteData" .. tostring(key), function()
local ran, ret = Core.DS_WriteLimiter("Write", DataStore.RemoveAsync, DataStore, Core.DataStoreEncode(key))
if ran then
Core.DataCache[key] = nil
else
logError("DataStore RemoveAsync Failed: ".. tostring(ret))
end
task.wait(6)
end, 120, true)
if not ran2 then
warn("DataStore RemoveData Failed: ".. tostring(err2))
end
end
end;
SetData = function(key, value, repeatCount)
if repeatCount then
warn("Retrying SetData request for ".. key);
end
local DataStore = Core.DataStore
if DataStore then
if value == nil then
return Core.RemoveData(key)
else
local ran2, err2 = Queue("DataStoreWriteData" .. tostring(key), function()
local ran, ret = Core.DS_WriteLimiter("Write", DataStore.SetAsync, DataStore, Core.DataStoreEncode(key), value)
if ran then
Core.DataCache[key] = value
else
logError("DataStore SetAsync Failed: ".. tostring(ret));
end
task.wait(6)
end, 120, true)
if not ran2 then
logError("DataStore SetData Failed: ".. tostring(err2))
--// Attempt 3 times, with slight delay between if failed
task.wait(1);
if not repeatCount then
return Core.SetData(key, value, 3);
elseif repeatCount > 0 then
return Core.SetData(key, value, repeatCount - 1);
end
end
end
end
end;
UpdateData = function(key, func, repeatCount)
if repeatCount then
warn("Retrying UpdateData request for ".. key);
end
local DataStore = Core.DataStore
if DataStore then
local err = false;
local ran2, err2 = Queue("DataStoreWriteData" .. tostring(key), function()
local ran, ret = Core.DS_WriteLimiter("Update", DataStore.UpdateAsync, DataStore, Core.DataStoreEncode(key), func)
if not ran then
err = ret;
logError("DataStore UpdateAsync Failed: ".. tostring(ret))
return error(ret);
end
wait(6)
end, 120, true) --// 120 timeout, yield until this queued function runs and completes
if not ran2 then
logError("DataStore UpdateData Failed: ".. tostring(err2))
--// Attempt 3 times, with slight delay between if failed
wait(1);
if not repeatCount then
return Core.UpdateData(key, func, 3);
elseif repeatCount > 0 then
return Core.UpdateData(key, func, repeatCount - 1);
end
end
return err
end
end;
GetData = function(key, repeatCount)
if repeatCount then
warn("Retrying GetData request for ".. key);
end
local DataStore = Core.DataStore
if DataStore then
local ran2, err2 = Queue("DataStoreReadData", function()
local ran, ret = pcall(DataStore.GetAsync, DataStore, Core.DataStoreEncode(key))
if ran then
Core.DataCache[key] = ret
return ret
else
logError("DataStore GetAsync Failed: ".. tostring(ret))
if Core.DataCache[key] then
return Core.DataCache[key];
else
error(ret);
end
end
wait(Core.DS_GetRequestDelay("Read"))
end, 120, true)
if not ran2 then
logError("DataStore GetData Failed: ".. tostring(err2))
--// Attempt 3 times, with slight delay between if failed
wait(1);
if not repeatCount then
return Core.GetData(key, 3);
elseif repeatCount > 0 then
return Core.GetData(key, repeatCount - 1);
end
else
return err2;
end
end
end;
IndexPathToTable = function(tableAncestry)
local Blacklist = Core.DS_BLACKLIST
if type(tableAncestry) == "string" and not Blacklist[tableAncestry] then
return server.Settings[tableAncestry], tableAncestry;
elseif type(tableAncestry) == "table" then
local curTable = server;
local curName = "Server";
for i,ind in ipairs(tableAncestry) do
curTable = curTable[ind];
curName = ind;
if curName and type(curName) == 'string' then
--// Admins do NOT load from the DataStore with this setting
if curName == "Ranks" then
if not Settings.LoadAdminsFromDS then
return nil;
end
end
end
if not curTable then
--warn(tostring(ind) .." could not be found");
--// Not allowed or table is not found
return nil;
end
end
if curName and type(curName) == 'string' then
if Blacklist[curName] then
return nil;
end
end
return curTable, curName;
end
return nil
end;
ClearAllData = function()
local tabs = Core.GetData("SavedTables") or {};
for i,v in pairs(tabs) do
if v.TableKey then
Core.RemoveData(v.TableKey);
end
end
Core.SetData("SavedSettings",{});
Core.SetData("SavedTables",{});
Core.CrossServer("LoadData");
end;
GetTableKey = function(indList)
local tabs = Core.GetData("SavedTables") or {};
local realTable,tableName = Core.IndexPathToTable(indList);
local foundTable = nil;
for i,v in pairs(tabs) do
if type(v) == "table" and v.TableName and v.TableName == tableName then
foundTable = v
break;
end
end
if not foundTable then
foundTable = {
TableName = tableName;
TableKey = "SAVEDTABLE_".. tableName;
}
table.insert(tabs, foundTable);
Core.SetData("SavedTables", tabs);
end
if not Core.GetData(foundTable.TableKey) then
Core.SetData(foundTable.TableKey, {});
end
return foundTable.TableKey;
end;
DoSave = function(data)
local type = data.Type
if type == "ClearSettings" then
Core.ClearAllData();
elseif type == "SetSetting" then
local setting = data.Setting
local value = data.Value
Core.UpdateData("SavedSettings", function(settings)
settings[setting] = value
return settings
end)
Core.CrossServer("LoadData", "SavedSettings", {[setting] = value});
elseif type == "TableRemove" then
local key = Core.GetTableKey(data.Table);
local tab = data.Table
local value = data.Value
data.Action = "Remove"
data.Time = os.time()
local CheckMatch = Functions.CheckMatch
Core.UpdateData(key, function(sets)
sets = sets or {}
for i,v in pairs(sets) do
if CheckMatch(tab, v.Table) and CheckMatch(v.Value, value) then
table.remove(sets,i)
end
end
--// Check that the real table actually has the item to remove, do not create if it does not have it
--// Prevents snowballing
local indList = tab
local continueOperation = false
if indList[1] == "Settings" then
local indClone = table.clone(indList)
indClone[1] = "OriginalSettings"
local realTable,tableName = Core.IndexPathToTable(indClone)
for i,v in pairs(realTable) do
if CheckMatch(v, value) then
continueOperation = true
end
end
else
continueOperation = true
end
if continueOperation then
table.insert(sets, data)
end
return sets
end)
Core.CrossServer("LoadData", "TableUpdate", data);
elseif type == "TableAdd" then
local key = Core.GetTableKey(data.Table);
local tab = data.Table
local value = data.Value
data.Action = "Add"
data.Time = os.time()
local CheckMatch = Functions.CheckMatch
Core.UpdateData(key, function(sets)
sets = sets or {}
for i,v in pairs(sets) do
if CheckMatch(tab, v.Table) and CheckMatch(v.Value, value) then
table.remove(sets, i)
end
end
--// Check that the real table does not have the item to add, do not create if it has it
--// Prevents snowballing
local indList = tab
local continueOperation = true
if indList[1] == "Settings" then
local indClone = table.clone(indList)
indClone[1] = "OriginalSettings"
local realTable,tableName = Core.IndexPathToTable(indClone)
for i,v in pairs(realTable) do
if CheckMatch(v, value) then
continueOperation = false
end
end
end
if continueOperation then
table.insert(sets, data)
end
return sets
end)
Core.CrossServer("LoadData", "TableUpdate", data);
end
AddLog(Logs.Script,{
Text = "Saved setting change to datastore";
Desc = "A setting change was issued and saved";
})
end;
LoadData = function(key, data, serverId)
if serverId and serverId == game.JobId then return end;
local Blacklist = Core.DS_BLACKLIST
local CheckMatch = Functions.CheckMatch;
if key == "TableUpdate" then
local tab = data;
local indList = tab.Table;
local nameRankComp = {--// Old settings backwards compatability
Owners = {"Settings", "Ranks", "HeadAdmins", "Users"};
Creators = {"Settings", "Ranks", "Creators", "Users"};
HeadAdmins = {"Settings", "Ranks", "HeadAdmins", "Users"};
Admins = {"Settings", "Ranks", "Admins", "Users"};
Moderators = {"Settings", "Ranks", "Moderators", "Users"};
}
if type(indList) == "string" and nameRankComp[indList] then
indList = nameRankComp[indList];
end
local realTable,tableName = Core.IndexPathToTable(indList);
local displayName = type(indList) == "table" and table.concat(indList, ".") or tableName;
if displayName and type(displayName) == 'string' then
if Blacklist[displayName] then
return
end
if type(indList) == 'table' and indList[1] == "Settings" and indList[2] == "Ranks" then
if not Settings.SaveAdmins and not Core.WarnedAboutAdminsLoadingWhenSaveAdminsIsOff and not Settings.SaveAdminsWarning and Settings.LoadAdminsFromDS then
warn("Admins are loading from the Adonis DataStore when Settings.SaveAdmins is FALSE!\nDisable this warning by adding the setting \"SaveAdminsWarning\" in Settings (and set it to true!) or set Settings.LoadAdminsFromDS to false")
Core.WarnedAboutAdminsLoadingWhenSaveAdminsIsOff = true
end
end
end
if realTable and tab.Action == "Add" then
for i,v in pairs(realTable) do
if CheckMatch(v,tab.Value) then
table.remove(realTable, i)
end
end
AddLog("Script",{
Text = "Added value to ".. displayName;
Desc = "Added "..tostring(tab.Value).." to ".. displayName .." from datastore";
})
table.insert(realTable, tab.Value)
elseif realTable and tab.Action == "Remove" then
for i,v in pairs(realTable) do
if CheckMatch(v, tab.Value) then
AddLog("Script",{
Text = "Removed value from ".. displayName;
Desc = "Removed "..tostring(tab.Value).." from ".. displayName .." from datastore";
})
table.remove(realTable, i)
end
end
end
else
local SavedSettings
local SavedTables
if Core.DataStore and Settings.DataStoreEnabled then
if Settings.DataStoreKey == server.Defaults.Settings.DataStoreKey then
table.insert(server.Messages, {
Title = "Warning!";
Message = "Using default datastore key!";
Icon = server.MatIcons.Description;
Time = 15;
OnClick = server.Core.Bytecode([[
local window = client.UI.Make("Window", {
Title = "How to change the DataStore key";
Size = {700,300};
Icon = "rbxassetid://7510994359";
})
window:Add("ImageLabel", {
Image = "rbxassetid://1059543904";
})
window:Ready()
]]);
})
end
local GetData, LoadData, SaveData, DoSave = Core.GetData, Core.LoadData, Core.SaveData, Core.DoSave
if not key then
SavedSettings = GetData("SavedSettings")
SavedTables = GetData("SavedTables")
elseif key and not data then
if key == "SavedSettings" then
SavedSettings = GetData("SavedSettings")
elseif key == "SavedTables" then
SavedTables = GetData("SavedTables")
end
elseif key and data then
if key == "SavedSettings" then
SavedSettings = data
elseif key == "SavedTables" then
SavedTables = data
end
end
if not key and not data then
if not SavedSettings then
SavedSettings = {}
SaveData("SavedSettings",{})
end
if not SavedTables then
SavedTables = {}
SaveData("SavedTables",{})
end
end
if SavedSettings then
for setting,value in pairs(SavedSettings) do
if not Blacklist[setting] then
if setting == 'Prefix' or setting == 'AnyPrefix' or setting == 'SpecialPrefix' then
local orig = Settings[setting]
for i,v in pairs(server.Commands) do
if v.Prefix == orig then
v.Prefix = value
end
end
end
Settings[setting] = value
end
end
end
if SavedTables then
for i,tData in pairs(SavedTables) do
if tData.TableName and tData.TableKey and not Blacklist[tData.tableName] then
local data = GetData(tData.TableKey);
if data then
for k,v in ipairs(data) do
LoadData("TableUpdate", v)
end
end
elseif tData.Table and tData.Action then
LoadData("TableUpdate", tData)
end
end
if Core.Variables.TimeBans then
for i,v in pairs(Core.Variables.TimeBans) do
if v.EndTime-os.time() <= 0 then
table.remove(Core.Variables.TimeBans, i)
DoSave({
Type = "TableRemove";
Table = {"Core", "Variables", "TimeBans"};
Value = v;
})
end
end
end
end
AddLog(Logs.Script,{
Text = "Loaded saved data";
Desc = "Data was retrieved from the datastore and loaded successfully";
})
end
end
end;
StartAPI = function()
local _G = _G
local setmetatable = setmetatable
local rawset = rawset
local rawget = rawget
local type = type
local error = error
local print = print
local warn = warn
local pairs = pairs
local next = next
local table = table
local getfenv = getfenv
local setfenv = setfenv
local require = require
local tostring = tostring
local server = server
local service = service
local Routine = Routine
local cPcall = cPcall
local MetaFunc = service.MetaFunc
local StartLoop = service.StartLoop
local API_Special = {
AddAdmin = Settings.Allowed_API_Calls.DataStore;
RemoveAdmin = Settings.Allowed_API_Calls.DataStore;
RunCommand = Settings.Allowed_API_Calls.Core;
SaveTableAdd = Settings.Allowed_API_Calls.DataStore and Settings.Allowed_API_Calls.Settings;
SaveTableRemove = Settings.Allowed_API_Calls.DataStore and Settings.Allowed_API_Calls.Settings;
SaveSetSetting = Settings.Allowed_API_Calls.DataStore and Settings.Allowed_API_Calls.Settings;
ClearSavedSettings = Settings.Allowed_API_Calls.DataStore and Settings.Allowed_API_Calls.Settings;
SetSetting = Settings.Allowed_API_Calls.Settings;
}
setfenv(1,setmetatable({}, {__metatable = getmetatable(getfenv())}))
local API_Specific = {
API_Specific = {
Test = function()
print("We ran the api specific stuff")
end
};
Settings = Settings;
Service = service;
}
local API = {
Access = MetaFunc(function(...)
local args = {...}
local key = args[1]
local ind = args[2]
local targ
if API_Specific[ind] then
targ = API_Specific[ind]
elseif server[ind] and Settings.Allowed_API_Calls[ind] then
targ = server[ind]
end
if Settings.G_Access and key == Settings.G_Access_Key and targ and Settings.Allowed_API_Calls[ind] == true then
if type(targ) == "table" then
return service.NewProxy {
__index = function(tab,inde)
if targ[inde] ~= nil and API_Special[inde] == nil or API_Special[inde] == true then
AddLog(Logs.Script,{
Text = "Access to "..tostring(inde).." was granted";
Desc = "A server script was granted access to "..tostring(inde);
})
if targ[inde]~=nil and type(targ[inde]) == "table" and Settings.G_Access_Perms == "Read" then
return service.ReadOnly(targ[inde])
else
return targ[inde]
end
elseif API_Special[inde] == false then
AddLog(Logs.Script,{
Text = "Access to "..tostring(inde).." was denied";
Desc = "A server script attempted to access "..tostring(inde).." via _G.Adonis.Access";
})
error("Access Denied: "..tostring(inde))
else
error("Could not find "..tostring(inde))
end
end;
__newindex = function(tabl,inde,valu)
if Settings.G_Access_Perms == "Read" then
error("Read-only")
elseif Settings.G_Access_Perms == "Write" then
tabl[inde] = valu
end
end;
__metatable = true;
}
end
else
error("Incorrect key or G_Access is disabled")
end
end);
Scripts = service.ReadOnly({
ExecutePermission = MetaFunc(function(srcScript, code)
local exists;
for i,v in pairs(Core.ScriptCache) do
if v.Script == srcScript then
exists = v
end
end
if exists and exists.noCache ~= true and (not exists.runLimit or (exists.runLimit and exists.Executions <= exists.runLimit)) then
exists.Executions = exists.Executions+1
return exists.Source, exists.Loadstring
end
local data = Core.ExecutePermission(srcScript, code)
if data and data.Source then
local module;
if not exists then
module = require(server.Shared.FiOne:Clone())
table.insert(Core.ScriptCache,{
Script = srcScript;
Source = data.Source;
Loadstring = module;
noCache = data.noCache;
runLimit = data.runLimit;
Executions = data.Executions;
})
else
module = exists.Loadstring
exists.Source = data.Source
end
return data.Source, module
end
end);
}, nil, nil, true);
CheckAdmin = MetaFunc(Admin.CheckAdmin);
IsAdmin = MetaFunc(Admin.CheckAdmin);
IsBanned = MetaFunc(Admin.CheckBan);
IsMuted = MetaFunc(Admin.IsMuted);
CheckDonor = MetaFunc(Admin.CheckDonor);
GetLevel = MetaFunc(Admin.GetLevel);
SetLighting = MetaFunc(Functions.SetLighting);
SetPlayerLighting = MetaFunc(Remote.SetLighting);
NewParticle = MetaFunc(Functions.NewParticle);
RemoveParticle = MetaFunc(Functions.RemoveParticle);
NewLocal = MetaFunc(Remote.NewLocal);
MakeLocal = MetaFunc(Remote.MakeLocal);
MoveLocal = MetaFunc(Remote.MoveLocal);
RemoveLocal = MetaFunc(Remote.RemoveLocal);
Hint = MetaFunc(Functions.Hint);
Message = MetaFunc(Functions.Message);
RunCommandAsNonAdmin = MetaFunc(Admin.RunCommandAsNonAdmin);
}
local AdonisGTable = service.NewProxy({
__index = function(tab,ind)
if Settings.G_API then
return API[ind]
elseif ind == "Scripts" then
return API.Scripts
else
error("_G API is disabled")
end
end;
__newindex = function()
error("Read-only")
end;
__metatable = true;
})
if not rawget(_G, "Adonis") then
if table.isfrozen and not table.isfrozen(_G) or not table.isfrozen then
rawset(_G, "Adonis", AdonisGTable)
StartLoop("APICheck", 1, function()
if rawget(_G, "Adonis") ~= AdonisGTable then
if table.isfrozen and not table.isfrozen(_G) or not table.isfrozen then
rawset(_G, "Adonis", AdonisGTable)
else
warn("ADONIS CRITICAL WARNING! MALICIOUS CODE IS TRYING TO CHANGE THE ADONIS _G API AND IT CAN'T BE SET BACK! PLEASE SHUTDOWN THE SERVER AND REMOVE THE MALICIOUS CODE IF POSSIBLE!")
end
end
end, true)
else
warn("The _G table was locked and the Adonis _G API could not be loaded")
end
end
AddLog(Logs.Script,{
Text = "Started _G API";
Desc = "_G API was initialized and is ready to use";
})
end;
};
end
|
--[=[
@return Promise
Returns a promise that is resolved once Knit has started. This is useful
for any code that needs to tie into Knit controllers but is not the script
that called `Start`.
```lua
Knit.OnStart():andThen(function()
local MyController = Knit.GetController("MyController")
MyController:DoSomething()
end):catch(warn)
```
]=] |
function KnitClient.OnStart()
if startedComplete then
return Promise.resolve()
else
return Promise.fromEvent(onStartedComplete.Event)
end
end
return KnitClient
|