prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
-- same as jump for now |
function moveFreeFall()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder:SetDesiredAngle(3.14)
LeftShoulder:SetDesiredAngle(-3.14)
RightHip:SetDesiredAngle(0)
LeftHip:SetDesiredAngle(0)
end
function moveSit()
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
RightShoulder:SetDesiredAngle(3.14 /2)
LeftShoulder:SetDesiredAngle(-3.14 /2)
RightHip:SetDesiredAngle(3.14 /2)
LeftHip:SetDesiredAngle(-3.14 /2)
end
function getTool()
for _, kid in ipairs(Figure:GetChildren()) do
if kid.className == "Tool" then return kid end
end
return nil
end
function getToolAnim(tool)
for _, c in ipairs(tool:GetChildren()) do
if c.Name == "toolanim" and c.className == "StringValue" then
return c
end
end
return nil
end
function animateTool()
if (toolAnim == "None") then
RightShoulder:SetDesiredAngle(1.57)
return
end
if (toolAnim == "Slash") then
RightShoulder.MaxVelocity = 0.5
RightShoulder:SetDesiredAngle(0)
return
end
if (toolAnim == "Lunge") then
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightHip.MaxVelocity = 0.5
LeftHip.MaxVelocity = 0.5
RightShoulder:SetDesiredAngle(1.57)
LeftShoulder:SetDesiredAngle(1.0)
RightHip:SetDesiredAngle(1.57)
LeftHip:SetDesiredAngle(1.0)
return
end
end
function move(time)
local amplitude
local frequency
if (pose == "Jumping") then
moveJump()
return
end
if (pose == "FreeFall") then
moveFreeFall()
return
end
if (pose == "Seated") then
moveSit()
return
end
local climbFudge = 0
if (pose == "Running") then
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
amplitude = 1
frequency = 9
elseif (pose == "Climbing") then
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
amplitude = 1
frequency = 9
climbFudge = 3.14
else
amplitude = 0.1
frequency = 1
end
desiredAngle = amplitude * math.sin(time*frequency)
RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
RightHip:SetDesiredAngle(-desiredAngle)
LeftHip:SetDesiredAngle(-desiredAngle)
local tool = getTool()
if tool then
animStringValueObject = getToolAnim(tool)
if animStringValueObject then
toolAnim = animStringValueObject.Value
-- message recieved, delete StringValue
animStringValueObject.Parent = nil
toolAnimTime = time + .3
end
if time > toolAnimTime then
toolAnimTime = 0
toolAnim = "None"
end
animateTool()
else
toolAnim = "None"
toolAnimTime = 0
end
end
|
-- dayLength defines how long, in minutes, a day in your game is. Feel free to alter it. |
local dayLength = 12
local cycleTime = dayLength*60
local minutesInADay = 24*60
local lighting = game:GetService("Lighting")
local startTime = tick() - (lighting:getMinutesAfterMidnight() / minutesInADay)*cycleTime
local endTime = startTime + cycleTime
local timeRatio = minutesInADay / cycleTime
if dayLength == 0 then
dayLength = 1
end
repeat
local currentTime = tick()
if currentTime > endTime then
startTime = endTime
endTime = startTime + cycleTime
end
lighting:setMinutesAfterMidnight((currentTime - startTime)*timeRatio)
wait(1/15)
until false
|
--// Core |
return function(Vargs, GetEnv)
local env = GetEnv(nil, {script = script})
setfenv(1, env)
local server = Vargs.Server;
local service = Vargs.Service;
local Functions, Admin, Anti, Core, HTTP, Logs, Remote, Process, Variables, Settings, Deps;
local AddLog, Queue, TrackTask
local logError = env.logError
local function Init(data)
Functions = server.Functions;
Admin = server.Admin;
Anti = server.Anti;
Core = server.Core;
HTTP = server.HTTP;
Logs = server.Logs;
Remote = server.Remote;
Process = server.Process;
Variables = server.Variables;
Settings = server.Settings;
Deps = server.Deps;
AddLog = Logs.AddLog;
Queue = service.Queue;
TrackTask = service.TrackTask;
logError = logError or env.logError;
--// Core variables
Core.Themes = data.Themes or {}
Core.Plugins = data.Plugins or {}
Core.ModuleID = data.ModuleID or 7510592873
Core.LoaderID = data.LoaderID or 7510622625
Core.DebugMode = data.DebugMode or false
Core.Name = Functions:GetRandom()
Core.LoadstringObj = Core.GetLoadstring()
Core.Loadstring = require(Core.LoadstringObj)
service.DataStoreService = require(Deps.MockDataStoreService)(Settings.LocalDatastore)
local function disableAllGuis(folder: Folder)
for _, v in folder:GetChildren() do
if v:IsA("ScreenGui") then
v.Enabled = false
elseif v:IsA("Folder") or v:IsA("Model") then
disableAllGuis(v)
end
end
end
disableAllGuis(server.Client.UI)
Core.Init = nil;
AddLog("Script", "Core Module Initialized")
end;
local function RunAfterPlugins(data)
--// RemoteEvent Handling
Core.MakeEvent()
--// Prepare the client loader
--local existingPlayers = service.Players:GetPlayers();
--Core.MakeClient()
local remoteParent = service.ReplicatedStorage;
remoteParent.ChildRemoved:Connect(function(c)
task.wait(1/60)
if server.Core.RemoteEvent and not Core.FixingEvent and (function() for i,v in Core.RemoteEvent do if c == v then return true end end end)() then
Core.MakeEvent()
end
end)
--// Load data
Core.DataStore = Core.GetDataStore()
if Core.DataStore then
TrackTask("Thread: DSLoadAndHook", function()
--// Catch any errors and print it to the console; allow for debugging.
task.defer(env.Pcall, Core.LoadData)
end)
end
--// Save all data on server shutdown & set GAME_CLOSING
game:BindToClose(function()
Core.GAME_CLOSING = true;
task.defer(Core.SaveAllPlayerData);
end);
--// Start API
if service.NetworkServer then
--service.Threads.RunTask("_G API Manager",server.Core.StartAPI)
TrackTask("Thread: API Manager", Core.StartAPI)
end
--// Occasionally save all player data to the datastore to prevent data loss if the server abruptly crashes
service.StartLoop("SaveAllPlayerData", Core.DS_AllPlayerDataSaveInterval, Core.SaveAllPlayerData, true)
Core.RunAfterPlugins = nil;
AddLog("Script", "Core Module RunAfterPlugins Finished");
end
server.Core = {
Init = Init;
RunAfterPlugins = RunAfterPlugins;
DataQueue = {};
DataCache = {};
PlayerData = {};
CrossServerCommands = {};
CrossServer = function(...) return false end;
ExecuteScripts = {};
LastDataSave = 0;
FixingEvent = false;
ScriptCache = {};
Connections = {};
BytecodeCache = {};
LastEventValue = 1;
Variables = {
TimeBans = {};
};
--// Datastore update/queue timers/delays
DS_WriteQueueDelay = 1;
DS_ReadQueueDelay = 0.5;
DS_AllPlayerDataSaveInterval = 30;
DS_AllPlayerDataSaveQueueDelay = 0.5;
--// Used to change/"reset" specific datastore keys
DS_RESET_SALTS = {
SavedSettings = "32K5j4";
SavedTables = "32K5j4";
};
DS_BLACKLIST = {
Trello_Enabled = true;
Trello_Primary = true;
Trello_Secondary = true;
Trello_Token = true;
Trello_AppKey = true;
DataStore = true;
DataStoreKey = true;
DataStoreEnabled = true;
LocalDatastore = true;
Creators = true;
Permissions = true;
G_API = true;
G_Access = true;
G_Access_Key = true;
G_Access_Perms = true;
Allowed_API_Calls = true;
LoadAdminsFromDS = true;
WebPanel_ApiKey = true;
WebPanel_Enabled = true;
["Settings.Ranks.Creators.Users"] = true;
["Admin.SpecialLevels"] = true;
OnStartup = true;
OnSpawn = true;
OnJoin = true;
CustomRanks = true;
Ranks = true;
Commands = true;
--// Not gonna let malicious stuff set DS_Blacklist to {} or anything!
DS_BLACKLIST = true;
};
--// Prevent certain keys from loading from the DataStore
PlayerDataKeyBlacklist = {
AdminRank = true;
AdminLevel = true;
LastLevelUpdate = true;
};
UpdatePlayerConnection = function(p)
for i, cli in next,service.NetworkServer:GetChildren() do
if cli:GetPlayer() == p then
Core.Connections[cli] = p
end
end
end;
DisconnectEvent = function()
if Core.RemoteEvent and not Core.FixingEvent then
Core.FixingEvent = true
for name,event in Core.RemoteEvent.Events do
event:Disconnect()
end
pcall(function() service.Delete(Core.RemoteEvent.Object) end)
pcall(function() service.Delete(Core.RemoteEvent.Function) end)
Core.FixingEvent = false
Core.RemoteEvent = nil
end
end;
MakeEvent = function()
local remoteParent = service.ReplicatedStorage
local ran, err = pcall(function()
if server.Running then
local rTable = {};
local event = service.New("RemoteEvent", {Name = Core.Name, Archivable = false}, true, true)
local func = service.New("RemoteFunction", {Name = "__FUNCTION", Parent = event}, true, true)
local secureTriggered = true
local tripDet = math.random()
local function secure(ev, name, parent)
return ev.Changed:Connect(function()
if Core.RemoteEvent == rTable and not secureTriggered then
if ev == func then
func.OnServerInvoke = Process.Remote
end
if ev.Name ~= name then
ev.Name = name
elseif ev.Parent ~= parent then
secureTriggered = true;
Core.DisconnectEvent();
Core.MakeEvent()
end
end
end)
end
Core.DisconnectEvent()
Core.TripDet = tripDet
rTable.Events = {}
rTable.Object = event
rTable.Function = func
rTable.Events.Security = secure(event, event.Name, remoteParent)
rTable.Events.FuncSec = secure(func, func.Name, event)
func.OnServerInvoke = Process.Remote;
rTable.Events.ProcessEvent = service.RbxEvent(event.OnServerEvent, Process.Remote)
Core.RemoteEvent = rTable
event.Parent = remoteParent
secureTriggered = false
AddLog(Logs.Script, {
Text = "Created RemoteEvent";
Desc = "RemoteEvent was successfully created";
})
end
end)
if err then
warn(err)
end
end;
UpdateConnections = function()
if service.NetworkServer then
for _, cli in service.NetworkServer:GetChildren() do
if cli:IsA("NetworkReplicator") then
Core.Connections[cli] = cli:GetPlayer()
end
end
end
end;
UpdateConnection = function(p)
if service.NetworkServer then
for _, cli in service.NetworkServer:GetChildren() do
if cli:IsA("NetworkReplicator") and cli:GetPlayer() == p then
Core.Connections[cli] = p
end
end
end
end;
GetNetworkClient = function(p)
if service.NetworkServer then
for _, cli in service.NetworkServer:GetChildren() do
if cli:IsA("NetworkReplicator") and cli:GetPlayer() == p then
return cli
end
end
end
end;
MakeClient = function(parent)
if not parent and Core.ClientLoader then
local loader = Core.ClientLoader
loader.Removing = true
for _, v in loader.Events do
v:Disconnect()
end
loader.Object:Destroy()
end;
local depsName = Functions:GetRandom()
local folder = server.Client:Clone()
local acli = Deps.ClientMover:Clone();
local client = folder.Client
local parentObj = parent or service.StarterPlayer:FindFirstChildOfClass("StarterPlayerScripts");
local clientLoader = {
Removing = false;
};
Core.MockClientKeys = Core.MockClientKeys or {
Special = depsName;
Module = client;
}
local depsName = Core.MockClientKeys.Special;
local specialVal = service.New("StringValue")
specialVal.Value = Core.Name.."\\"..depsName
specialVal.Name = "Special"
specialVal.Parent = folder
acli.Parent = folder;
acli.Disabled = false;
folder.Archivable = false;
folder.Name = depsName; --"Adonis_Client"
folder.Parent = parentObj;
if not parent then
local oName = folder.Name
clientLoader.Object = folder
clientLoader.Events = {}
clientLoader.Events[folder] = folder.Changed:Connect(function()
if Core.ClientLoader == clientLoader and not clientLoader.Removing then
if folder.Name ~= oName then
folder.Name = oName;
elseif folder.Parent ~= parentObj then
clientLoader.Removing = true
Core.MakeClient()
end
end
end)
for _, child in folder:GetDescendants() do
local oParent = child.Parent
local oName = child.Name
clientLoader.Events[child.Changed] = child.Changed:Connect(function(c)
if Core.ClientLoader == clientLoader and not clientLoader.Removing then
if child.Parent ~= oParent or child == specialVal then
Core.MakeClient()
end
end
end)
local nameEvent = child:GetPropertyChangedSignal("Name"):Connect(function()
if Core.ClientLoader == clientLoader and not clientLoader.Removing then
child.Name = oName
end
end)
clientLoader.Events[nameEvent] = nameEvent
clientLoader.Events[child.AncestryChanged] = child.AncestryChanged:Connect(function()
if Core.ClientLoader == clientLoader and not clientLoader.Removing then
Core.MakeClient()
end
end)
end
folder.DescendantAdded:Connect(function(d)
if Core.ClientLoader == clientLoader and not clientLoader.Removing then
Core.MakeClient()
end
end)
folder.DescendantRemoving:Connect(function(d)
if Core.ClientLoader == clientLoader and not clientLoader.Removing then
Core.MakeClient()
end
end)
Core.ClientLoader = clientLoader
end
local ok,err = pcall(function()
folder.Parent = parentObj
end)
clientLoader.Removing = false;
AddLog("Script", "Created client")
end;
HookClient = function(p)
local key = tostring(p.UserId)
local keys = Remote.Clients[key]
if keys then
local depsName = Functions:GetRandom()
local eventName = Functions:GetRandom()
local folder = server.Client:Clone()
local acli = Deps.ClientMover:Clone();
local client = folder.Client
local parentTo = "PlayerGui" --// Roblox, seriously, please give the server access to PlayerScripts already so I don't need to do this.
local parentObj = p:FindFirstChildOfClass(parentTo) or p:WaitForChild(parentTo, 600);
if not p.Parent then
return false
elseif not parentObj then
p:Kick("\n[CLI-102495] Loading Error \nPlayerGui Missing (Waited 10 Minutes)")
return false
end
local container = service.New("ScreenGui");
container.ResetOnSpawn = false;
container.Enabled = false;
container.Name = "\0";
local specialVal = service.New("StringValue")
specialVal.Value = Core.Name.."\\"..depsName
specialVal.Name = "Special"
specialVal.Parent = folder
keys.Special = depsName
keys.EventName = eventName
keys.Module = client
acli.Parent = folder;
acli.Disabled = false;
folder.Name = "Adonis_Client"
folder.Parent = container;
--// Event only fires AFTER the client is alive and well
local event; event = service.Events.ClientLoaded:Connect(function(plr)
if p == plr and container.Parent == parentObj then
--container:Destroy(); -- Destroy update causes an issue with this pretty sure
container.Parent = nil
local leaveEvent; leaveEvent = p.AncestryChanged:Connect(function() -- after/on remove, not on removing...
task.wait()
if p.Parent == nil then
-- Prevent potential memory leak and ensure this gets properly murdered when they leave and it's no longer needed
pcall(function()
container:Destroy()
end)
end
end)
leaveEvent:Disconnect()
leaveEvent = nil
event:Disconnect();
event = nil
end
end)
local ok, err = pcall(function()
container.Parent = parentObj
end)
if not ok then
p:Kick("\n[CLI-192385] Loading Error \n[HookClient Error: "..tostring(err).."]")
return false
else
return true
end
else
if p and p.Parent then
p:Kick("\n[CLI-5691283] Loading Error \n[HookClient: Keys Missing]")
end
end
end;
LoadClientLoader = function(p)
local loader = Deps.ClientLoader:Clone()
loader.Name = Functions.GetRandom()
loader.Parent = p:WaitForChild("PlayerGui", 60) or p:WaitForChild("Backpack")
loader.Disabled = false
end;
LoadExistingPlayer = function(p)
warn("Loading existing player: ".. tostring(p))
TrackTask("Thread: Setup Existing Player: ".. tostring(p), function()
Process.PlayerAdded(p)
--Core.MakeClient(p:FindFirstChildOfClass("PlayerGui") or p:WaitForChild("PlayerGui", 120))
end)
end;
ExecutePermission = function(scr, code, isLocal)
local fixscr = service.UnWrap(scr)
for _, val in Core.ExecuteScripts do
if not isLocal or (isLocal and val.Type == "LocalScript") then
if (service.UnWrap(val.Script) == fixscr or code == val.Code) and (not val.runLimit or (val.runLimit ~= nil and val.Executions <= val.runLimit)) then
val.Executions += 1
return {
Source = val.Source;
noCache = val.noCache;
runLimit = val.runLimit;
Executions = val.Executions;
}
end
end
end
end;
GetScript = function(scr, code)
for i, val in Core.ExecuteScripts do
if val.Script == scr or code == val.Code then
return val, i
end
end
end;
UnRegisterScript = function(scr)
for i, dat in Core.ExecuteScripts do
if dat.Script == scr or dat == scr then
table.remove(Core.ExecuteScripts, i)
return dat
end
end
end;
RegisterScript = function(data)
data.Executions = 0
data.Time = os.time()
data.Type = data.Script.ClassName
data.Wrapped = service.Wrap(data.Script)
data.Wrapped:SetSpecial("Clone",function()
return Core.RegisterScript({
Script = service.UnWrap(data.Script):Clone();
Code = data.Code;
Source = data.Source;
noCache = data.noCache;
runLimit = data.runLimit;
})
end)
for ind,scr in Core.ExecuteScripts do
if scr.Script == data.Script then
return scr.Wrapped or scr.Script
end
end
if not data.Code then
data.Code = Functions.GetRandom()
end
table.insert(Core.ExecuteScripts, data)
return data.Wrapped
end;
GetLoadstring = function()
local newLoad = Deps.Loadstring:Clone()
local lbi = server.Shared.FiOne:Clone()
lbi.Parent = newLoad
return newLoad
end;
Bytecode = function(str: string)
if Core.BytecodeCache[str] then return Core.BytecodeCache[str] end
local f, buff = Core.Loadstring(str)
Core.BytecodeCache[str] = buff
return buff
end;
NewScript = function(scriptType: string, source: string, allowCodes: boolean?, noCache: boolean?, runLimit: number?)
local scr = assert(
if scriptType == "Script" then Deps.ScriptBase:Clone()
elseif scriptType == "LocalScript" then Deps.LocalScriptBase:Clone()
else nil,
"Invalid script type '"..tostring(scriptType).."'"
)
local execCode = Functions.GetRandom()
scr.Name = "[Adonis] "..scriptType
if allowCodes then
service.New("StringValue", {
Name = "Execute",
Value = execCode,
Parent = scr,
})
end
local wrapped = Core.RegisterScript({
Script = scr;
Code = execCode;
Source = Core.Bytecode(source);
noCache = noCache;
runLimit = runLimit;
})
return wrapped or scr, scr, execCode
end;
SavePlayer = function(p, data)
local key = tostring(p.UserId)
Core.PlayerData[key] = data
end;
DefaultPlayerData = function(p)
return {
Donor = {
Cape = {
Image = "0";
Color = "White";
Material = "Neon";
};
Enabled = false;
};
Banned = false;
TimeBan = false;
AdminNotes = {};
Keybinds = {};
Aliases = {};
Client = {};
Warnings = {};
}
end;
GetPlayer = function(p)
local key = tostring(p.UserId)
if not Core.PlayerData[key] then
local PlayerData = Core.DefaultPlayerData(p)
Core.PlayerData[key] = PlayerData
if Core.DataStore then
local data = Core.GetData(key)
if type(data) == "table" then
data.AdminNotes = if data.AdminNotes then Functions.DSKeyNormalize(data.AdminNotes, true) else {}
data.Warnings = if data.Warnings then Functions.DSKeyNormalize(data.Warnings, true) else {}
local BLOCKED_SETTINGS = Core.PlayerDataKeyBlacklist
for i, v in data do
if not BLOCKED_SETTINGS[i] then
PlayerData[i] = v
end
end
end
end
return PlayerData
else
return Core.PlayerData[key]
end
end;
ClearPlayer = function(p)
Core.PlayerData[tostring(p.UserId)] = Core.DefaultData(p)
end;
SavePlayerData = function(p, customData)
local key = tostring(p.UserId)
local pData = customData or Core.PlayerData[key]
if Core.DataStore then
if pData then
local data = service.CloneTable(pData)
data.LastChat = nil
data.AdminRank = nil
data.AdminLevel = nil
data.LastLevelUpdate = nil
data.LastDataSave = nil
data.AdminNotes = Functions.DSKeyNormalize(data.AdminNotes)
data.Warnings = Functions.DSKeyNormalize(data.Warnings)
Core.SetData(key, data)
AddLog(Logs.Script, {
Text = "Saved data for ".. p.Name;
Desc = "Player data was saved to the datastore";
})
pData.LastDataSave = os.time()
end
end
end;
SaveAllPlayerData = function(queueWaitTime)
local TrackTask = service.TrackTask
for key,pdata in Core.PlayerData do
local id = tonumber(key);
local player = id and service.Players:GetPlayerByUserId(id);
if player and (not pdata.LastDataSave or os.time() - pdata.LastDataSave >= Core.DS_AllPlayerDataSaveInterval) then
TrackTask(string.format("Save data for %s", player.Name), Core.SavePlayerData, player);
end
end
--[[ --// OLD METHOD (Kept in case this messes anything up)
for i,p in next,service.Players:GetPlayers() do
local pdata = Core.PlayerData[tostring(p.UserId)];
--// Only save player's data if it has not been saved within the last INTERVAL (default 30s)
if pdata and (not pdata.LastDataSave or os.time() - pdata.LastDataSave >= Core.DS_AllPlayerDataSaveInterval) then
service.Queue("SavePlayerData", function()
Core.SavePlayerData(p)
wait(queueWaitTime or Core.DS_AllPlayerDataSaveQueueDelay)
end)
end
end--]]
end;
GetDataStore = function()
local ran,store = pcall(function()
return service.DataStoreService:GetDataStore(string.sub(Settings.DataStore, 1, 50),"Adonis")
end)
-- DataStore studio check.
if ran and store and service.RunService:IsStudio() then
local success, res = pcall(store.GetAsync, store, math.random())
if not success and string.find(res, "502", 1, true) then
warn("Unable to load data because Studio access to API services is disabled.")
return;
end
end
return ran and store
end;
DataStoreEncode = function(key)
if Core.DS_RESET_SALTS[key] then
key = Core.DS_RESET_SALTS[key] .. key
end
return Functions.Base64Encode(Remote.Encrypt(tostring(key), Settings.DataStoreKey))
end;
SaveData = function(...)
return Core.SetData(...)
end;
DS_GetRequestDelay = function(reqTypeName: string)
local reqType = assert(
if reqTypeName == "Write" then Enum.DataStoreRequestType.SetIncrementAsync
elseif reqTypeName == "Read" then Enum.DataStoreRequestType.GetAsync
elseif reqTypeName == "Update" then Enum.DataStoreRequestType.UpdateAsync
else nil,
"Invalid request type name '"..tostring(reqTypeName).."'"
)
local reqPerMin = 60 + #service.Players:GetPlayers() * 10
local reqDelay = 60 / reqPerMin
local budget
repeat
budget = service.DataStoreService:GetRequestBudgetForRequestType(reqType);
until budget > 0 and task.wait(1)
return reqDelay + 0.5
end;
DS_WriteLimiter = function(reqTypeName: string, func, ...)
local vararg = table.pack(...)
return Queue("DataStoreWriteData_"..tostring(reqTypeName), function()
local gotDelay = Core.DS_GetRequestDelay(reqTypeName); --// Wait for budget; also return how long we should wait before the next request is allowed to go
func(unpack(vararg, 1, vararg.n))
task.wait(gotDelay)
end, 120, true)
end;
RemoveData = function(key)
local DataStore = Core.DataStore
if DataStore then
local ran2, err2 = Queue("DataStoreWriteData"..tostring(key), function()
local ran, ret = Core.DS_WriteLimiter("Write", DataStore.RemoveAsync, DataStore, Core.DataStoreEncode(key))
if ran then
Core.DataCache[key] = nil
else
logError("DataStore RemoveAsync Failed: ".. tostring(ret))
end
task.wait(6)
end, 120, true)
if not ran2 then
warn("DataStore RemoveData Failed: ".. tostring(err2))
end
end
end;
SetData = function(key: string, value: any?, repeatCount: number?)
if repeatCount then
warn("Retrying SetData request for ".. key);
end
local DataStore = Core.DataStore
if DataStore then
if value == nil then
return Core.RemoveData(key)
else
local ran2, err2 = Queue("DataStoreWriteData"..tostring(key), function()
local ran, ret = Core.DS_WriteLimiter("Write", DataStore.SetAsync, DataStore, Core.DataStoreEncode(key), value)
if ran then
Core.DataCache[key] = value
else
logError("DataStore SetAsync Failed: ".. tostring(ret));
end
task.wait(6)
end, 120, true)
if not ran2 then
logError("DataStore SetData Failed: ".. tostring(err2))
--// Attempt 3 times, with slight delay between if failed
task.wait(1)
if not repeatCount then
return Core.SetData(key, value, 3);
elseif repeatCount > 0 then
return Core.SetData(key, value, repeatCount - 1);
end
end
end
end
end;
UpdateData = function(key: string, callback: (currentData: any?)->any?, repeatCount: number?)
if repeatCount then
warn("Retrying UpdateData request for ".. key)
end
local DataStore = Core.DataStore
if DataStore then
local err = false
local ran2, err2 = Queue("DataStoreWriteData"..tostring(key), function()
local ran, ret = Core.DS_WriteLimiter("Update", DataStore.UpdateAsync, DataStore, Core.DataStoreEncode(key), callback)
if not ran then
err = ret
logError("DataStore UpdateAsync Failed: ".. tostring(ret))
return error(ret)
end
wait(6)
end, 120, true) --// 120 timeout, yield until this queued function runs and completes
if not ran2 then
logError("DataStore UpdateData Failed: ".. tostring(err2))
--// Attempt 3 times, with slight delay between if failed
wait(1)
if not repeatCount then
return Core.UpdateData(key, callback, 3)
elseif repeatCount > 0 then
return Core.UpdateData(key, callback, repeatCount - 1)
end
end
return err
end
end;
GetData = function(key: string, repeatCount: number?)
if repeatCount then
warn("Retrying GetData request for ".. key)
end
local DataStore = Core.DataStore
if DataStore then
local ran2, err2 = Queue("DataStoreReadData", function()
--wait(Core.DS_GetRequestDelay("Read")) -- TODO: re-implement this effectively and without an unnecessary delay
local ran, ret = pcall(DataStore.GetAsync, DataStore, Core.DataStoreEncode(key))
if ran then
Core.DataCache[key] = ret
return ret
else
logError("DataStore GetAsync Failed: ".. tostring(ret))
if Core.DataCache[key] then
return Core.DataCache[key]
else
error(ret)
end
end
end, 120, true)
if not ran2 then
logError("DataStore GetData Failed: ".. tostring(err2))
--// Attempt 3 times, with slight delay between if failed
wait(1)
if not repeatCount then
return Core.GetData(key, 3)
elseif repeatCount > 0 then
return Core.GetData(key, repeatCount - 1)
end
else
return err2
end
end
end;
IndexPathToTable = function(tableAncestry)
local ds_blacklist = Core.DS_BLACKLIST
if type(tableAncestry) == "string" and not ds_blacklist[tableAncestry] then
return Settings[tableAncestry], tableAncestry
elseif type(tableAncestry) == "table" then
local curTable = server
local curName = "Server"
for index, ind in tableAncestry do
--// Prevent stuff like {t1 = "Settings", t2 = ...} from bypassing datastore blocks
if type(index) ~= 'number' then
return nil
end
curTable = curTable[ind]
curName = ind
if type(curName) == "string" then
--// Admins do NOT load from the DataStore with this setting
if curName == "Ranks" and Settings.LoadAdminsFromDS == false then
return nil
end
end
if not curTable then
--warn(tostring(ind) .." could not be found");
--// Not allowed or table is not found
return nil
end
end
if type(curName) == "string" and ds_blacklist[curName] then
return nil
end
return curTable, curName
end
return nil
end;
ClearAllData = function()
local tabs = Core.GetData("SavedTables") or {}
for _, v in tabs do
if v.TableKey then
Core.RemoveData(v.TableKey)
end
end
Core.SetData("SavedSettings", {})
Core.SetData("SavedTables", {})
Core.CrossServer("LoadData")
end;
GetTableKey = function(indList: {string})
local tabs = Core.GetData("SavedTables") or {}
local realTable, tableName = Core.IndexPathToTable(indList)
local foundTable = nil
for _, v in tabs do
if type(v) == "table" and v.TableName and v.TableName == tableName then
foundTable = v
break
end
end
if not foundTable then
foundTable = {
TableName = tableName;
TableKey = "SAVEDTABLE_" .. tableName;
}
table.insert(tabs, foundTable)
Core.SetData("SavedTables", tabs)
end
if not Core.GetData(foundTable.TableKey) then
Core.SetData(foundTable.TableKey, {})
end
return foundTable.TableKey;
end;
DoSave = function(data: TableData)
if data.Type == "ClearSettings" then
Core.ClearAllData()
elseif data.Type == "SetSetting" then
local setting = data.Setting
local val = data.Value
Core.UpdateData("SavedSettings", function(savedSettings)
savedSettings[setting] = val
return savedSettings
end)
Core.CrossServer("LoadData", "SavedSettings", {[setting] = val})
elseif data.Type == "TableRemove" then
local tab = data.Table
local val = data.Value
local key = Core.GetTableKey(tab)
--// Storing an old reference of data.Table as we may override it later on.
local originalTable = tab
if type(tab) == "string" then
tab = {"Settings", tab}
elseif type(tab) == "table" and tab[1] == "Settings" then
originalTable = tab[2]
end
data.Action = "Remove"
data.Time = os.time()
local CheckMatch = if type(data) == "table" and data.LaxCheck then Functions.LaxCheckMatch else Functions.CheckMatch
Core.UpdateData(key, function(sets: {TableData})
sets = sets or {}
local index = 1
for i, v in sets do
if type(i) ~= "number" then
sets[i] = nil
elseif (CheckMatch(tab, v.Table) or CheckMatch(originalTable, v.Table)) and CheckMatch(v.Value, val) then
table.remove(sets, index)
else
index += 1
end
end
--// Check that the real table actually has the item to remove; do not create if it does not have it
--// (prevents snowballing)
local continueOperation = false
if tab[1] == "Settings" or tab[2] == "Settings" then
local indClone = table.clone(tab)
indClone[1] = "OriginalSettings"
for _, v in Core.IndexPathToTable(indClone) or {} do
if CheckMatch(v, val) then
continueOperation = true
break
end
end
else
continueOperation = true
end
if continueOperation then
table.insert(sets, data)
end
return sets
end)
Core.CrossServer("LoadData", "TableUpdate", data)
elseif data.Type == "TableAdd" then
local tab = data.Table
local originalTable = tab
local val = data.Value
local key = Core.GetTableKey(tab)
if type(tab) == "string" then
tab = {"Settings", tab}
end
data.Action = "Add"
data.Time = os.time()
local CheckMatch = if type(data) == "table" and data.LaxCheck then Functions.LaxCheckMatch else Functions.CheckMatch
Core.UpdateData(key, function(sets: {TableData})
sets = sets or {}
local index = 1
for i, v in sets do
if type(i) ~= "number" then
sets[i] = nil
elseif (CheckMatch(tab, v.Table) or CheckMatch(originalTable, v.Table)) and CheckMatch(v.Value, val) then
table.remove(sets, index)
else
index += 1
end
end
--// Check that the real table does not already have the item to add; do not create if it has it
--// (prevents snowballing)
local continueOperation = true
if tab[1] == "Settings" or tab[2] == "Settings" then
local indClone = table.clone(tab)
indClone[1] = "OriginalSettings"
for _, v in Core.IndexPathToTable(indClone) or {} do
if CheckMatch(v, val) then
continueOperation = false
break
end
end
end
if continueOperation then
table.insert(sets, data)
end
return sets
end)
Core.CrossServer("LoadData", "TableUpdate", data)
else
error("Invalid data action type '"..tostring(data.Type).."'", 2)
end
AddLog(Logs.Script, {
Text = "Saved setting change to datastore";
Desc = "A setting change was issued and saved ("..data.Type..")";
})
end;
LoadData = function(key: string, data: TableData, serverId: string?)
if serverId and serverId == game.JobId then
return
end
data = data or {}
local CheckMatch = if data.LaxCheck then Functions.LaxCheckMatch else Functions.CheckMatch
local ds_blacklist = Core.DS_BLACKLIST
if key == "TableUpdate" then
local indList = data.Table
local nameRankComp = { --// Old settings backwards compatability
Owners = { "Settings", "Ranks", "HeadAdmins", "Users" },
Creators = { "Settings", "Ranks", "Creators", "Users" },
HeadAdmins = { "Settings", "Ranks", "HeadAdmins", "Users" },
Admins = { "Settings", "Ranks", "Admins", "Users" },
Moderators = { "Settings", "Ranks", "Moderators", "Users" },
}
if type(indList) == "string" and nameRankComp[indList] then
indList = nameRankComp[indList]
end
local realTable, tableName = Core.IndexPathToTable(indList)
local displayName = type(indList) == "table" and table.concat(indList, ".") or tableName
if type(displayName) == "string" then
if ds_blacklist[displayName] then
return
end
if type(indList) == "table" and indList[1] == "Settings" and indList[2] == "Ranks" then
if
not Settings.SaveAdmins
and not Core.WarnedAboutAdminsLoadingWhenSaveAdminsIsOff
and not Settings.SaveAdminsWarning
and Settings.LoadAdminsFromDS
then
warn(
'Admins are loading from the Adonis DataStore when Settings.SaveAdmins is FALSE!\nDisable this warning by adding the setting "SaveAdminsWarning" in Settings (and set it to true!) or set Settings.LoadAdminsFromDS to false'
)
Core.WarnedAboutAdminsLoadingWhenSaveAdminsIsOff = true
end
--// No adding to Trello or WebPanel rank users list via Datastore
if type(indList[3]) == 'string' and (indList[3]:match("Trello") or indList[3]:match("WebPanel")) then
return
end
end
end
if realTable and data.Action == "Add" then
for i, v in realTable do
if CheckMatch(v, data.Value) then
table.remove(realTable, i)
end
end
AddLog("Script", {
Text = "Added value to " .. displayName,
Desc = "Added " .. tostring(data.Value) .. " to " .. displayName .. " from datastore",
})
table.insert(realTable, data.Value)
service.Events["DataStoreAdd_" .. displayName]:Fire(data.Value)
elseif realTable and data.Action == "Remove" then
for i, v in realTable do
if CheckMatch(v, data.Value) then
AddLog("Script", {
Text = "Removed value from " .. displayName,
Desc = "Removed " .. tostring(data.Value) .. " from " .. displayName .. " from datastore",
})
table.remove(realTable, i)
end
end
end
else
local SavedSettings
local SavedTables
if Core.DataStore and Settings.DataStoreEnabled then
local GetData, LoadData, SaveData, DoSave = Core.GetData, Core.LoadData, Core.SaveData, Core.DoSave
if not key then
SavedSettings = GetData("SavedSettings")
SavedTables = GetData("SavedTables")
elseif key and not data then
if key == "SavedSettings" then
SavedSettings = GetData("SavedSettings")
elseif key == "SavedTables" then
SavedTables = GetData("SavedTables")
end
elseif key and data then
if key == "SavedSettings" then
SavedSettings = data
elseif key == "SavedTables" then
SavedTables = data
end
end
if not key and not data then
if not SavedSettings then
SavedSettings = {}
SaveData("SavedSettings", {})
end
if not SavedTables then
SavedTables = {}
SaveData("SavedTables", {})
end
end
if SavedSettings then
for setting, value in SavedSettings do
if not ds_blacklist[setting] then
if setting == "Prefix" or setting == "AnyPrefix" or setting == "SpecialPrefix" then
local orig = Settings[setting]
for _, cmd in server.Commands do
if cmd.Prefix == orig then
cmd.Prefix = value
end
end
end
Settings[setting] = value
end
end
end
if SavedTables then
for _, tData in SavedTables do
if tData.TableName and tData.TableKey and not ds_blacklist[tData.TableName] then
local data = GetData(tData.TableKey)
if data then
for _, v in data do
LoadData("TableUpdate", v)
end
end
elseif tData.Table and tData.Action then
LoadData("TableUpdate", tData)
end
end
if Core.Variables.TimeBans then
for i, v in Core.Variables.TimeBans do
if v.EndTime - os.time() <= 0 then
table.remove(Core.Variables.TimeBans, i)
DoSave({
Type = "TableRemove",
Table = { "Core", "Variables", "TimeBans" },
Value = v,
LaxCheck = true,
})
end
end
end
end
AddLog(Logs.Script, {
Text = "Loaded saved data",
Desc = "Data was retrieved from the datastore and loaded successfully",
})
end
end
end,
StartAPI = function()
local _G = _G
local setmetatable = setmetatable
local rawset = rawset
local rawget = rawget
local type = type
local error = error
local print = print
local warn = warn
local pairs = pairs
local next = next
local table = table
local getfenv = getfenv
local setfenv = setfenv
local require = require
local tostring = tostring
local server = server
local service = service
local Routine = env.Routine
local cPcall = env.cPcall
local MetaFunc = service.MetaFunc
local StartLoop = service.StartLoop
local API_Special = {
AddAdmin = Settings.Allowed_API_Calls.DataStore;
RemoveAdmin = Settings.Allowed_API_Calls.DataStore;
RunCommand = Settings.Allowed_API_Calls.Core;
SaveTableAdd = Settings.Allowed_API_Calls.DataStore and Settings.Allowed_API_Calls.Settings;
SaveTableRemove = Settings.Allowed_API_Calls.DataStore and Settings.Allowed_API_Calls.Settings;
SaveSetSetting = Settings.Allowed_API_Calls.DataStore and Settings.Allowed_API_Calls.Settings;
ClearSavedSettings = Settings.Allowed_API_Calls.DataStore and Settings.Allowed_API_Calls.Settings;
SetSetting = Settings.Allowed_API_Calls.Settings;
}
setfenv(1,setmetatable({}, {__metatable = getmetatable(getfenv())}))
local API_Specific = {
API_Specific = {
Test = function()
print("We ran the api specific stuff")
end
};
Settings = Settings;
Service = service;
}
local API = {
Access = MetaFunc(function(...)
local args = {...}
local key = args[1]
local ind = args[2]
local targ
if API_Specific[ind] then
targ = API_Specific[ind]
elseif server[ind] and Settings.Allowed_API_Calls[ind] then
targ = server[ind]
end
if Settings.G_Access and key == Settings.G_Access_Key and targ and Settings.Allowed_API_Calls[ind] == true then
if type(targ) == "table" then
return service.NewProxy {
__index = function(tab,inde)
if targ[inde] ~= nil and API_Special[inde] == nil or API_Special[inde] == true then
AddLog(Logs.Script, {
Text = "Access to "..tostring(inde).." was granted";
Desc = "A server script was granted access to "..tostring(inde);
})
if targ[inde]~=nil and type(targ[inde]) == "table" and Settings.G_Access_Perms == "Read" then
return service.ReadOnly(targ[inde])
else
return targ[inde]
end
elseif API_Special[inde] == false then
AddLog(Logs.Script, {
Text = "Access to "..tostring(inde).." was denied";
Desc = "A server script attempted to access "..tostring(inde).." via _G.Adonis.Access";
})
error("Access Denied: "..tostring(inde))
else
error("Could not find "..tostring(inde))
end
end;
__newindex = function(tabl, inde, valu)
if Settings.G_Access_Perms == "Read" then
error("Read-only")
elseif Settings.G_Access_Perms == "Write" then
tabl[inde] = valu
end
end;
__metatable = true;
}
end
else
error("Incorrect key or G_Access is disabled")
end
end);
Scripts = service.ReadOnly({
ExecutePermission = MetaFunc(function(srcScript, code)
local exists;
for _, v in Core.ScriptCache do
if v.Script == srcScript then
exists = v
end
end
if exists and exists.noCache ~= true and (not exists.runLimit or (exists.runLimit and exists.Executions <= exists.runLimit)) then
exists.Executions += 1
return exists.Source, exists.Loadstring
end
local data = Core.ExecutePermission(srcScript, code)
if data and data.Source then
local module;
if not exists then
module = require(server.Shared.FiOne:Clone())
table.insert(Core.ScriptCache, {
Script = srcScript;
Source = data.Source;
Loadstring = module;
noCache = data.noCache;
runLimit = data.runLimit;
Executions = data.Executions;
})
else
module = exists.Loadstring
exists.Source = data.Source
end
return data.Source, module
end
end);
}, nil, nil, true);
CheckAdmin = MetaFunc(Admin.CheckAdmin);
IsAdmin = MetaFunc(Admin.CheckAdmin);
IsBanned = MetaFunc(Admin.CheckBan);
IsMuted = MetaFunc(Admin.IsMuted);
CheckDonor = MetaFunc(Admin.CheckDonor);
GetLevel = MetaFunc(Admin.GetLevel);
SetLighting = MetaFunc(Functions.SetLighting);
SetPlayerLighting = MetaFunc(Remote.SetLighting);
NewParticle = MetaFunc(Functions.NewParticle);
RemoveParticle = MetaFunc(Functions.RemoveParticle);
NewLocal = MetaFunc(Remote.NewLocal);
MakeLocal = MetaFunc(Remote.MakeLocal);
MoveLocal = MetaFunc(Remote.MoveLocal);
RemoveLocal = MetaFunc(Remote.RemoveLocal);
Hint = MetaFunc(Functions.Hint);
Message = MetaFunc(Functions.Message);
RunCommandAsNonAdmin = MetaFunc(Admin.RunCommandAsNonAdmin);
}
local AdonisGTable = service.NewProxy({
__index = function(tab,ind)
if Settings.G_API then
return API[ind]
elseif ind == "Scripts" then
return API.Scripts
else
error("_G API is disabled")
end
end;
__newindex = function()
error("Read-only")
end;
__metatable = true;
})
if not rawget(_G, "Adonis") then
if table.isfrozen and not table.isfrozen(_G) or not table.isfrozen then
rawset(_G, "Adonis", AdonisGTable)
StartLoop("APICheck", 1, function()
if rawget(_G, "Adonis") ~= AdonisGTable then
if table.isfrozen and not table.isfrozen(_G) or not table.isfrozen then
rawset(_G, "Adonis", AdonisGTable)
else
warn("⚠️ ADONIS CRITICAL WARNING! MALICIOUS CODE IS TRYING TO CHANGE THE ADONIS _G API AND IT CAN'T BE SET BACK! PLEASE SHUTDOWN THE SERVER AND REMOVE THE MALICIOUS CODE IF POSSIBLE!")
end
end
end, true)
else
warn("The _G table was locked and the Adonis _G API could not be loaded")
end
end
AddLog(Logs.Script, {
Text = "Started _G API";
Desc = "The Adonis _G API was initialized and is ready to use";
})
end;
};
end
|
-- This will assume whether or not the object is a Promise or a regular object. |
function Janitor.__index:AddObject(Object)
local Id = newproxy(false)
--[[
if Promise.is(Object) then
if Object:getStatus() == Promise.Status.Started then
local NewPromise = self:Add(Promise.resolve(Object), "cancel", Id)
NewPromise:finallyCall(self.Remove, self, Id)
return NewPromise, Id
else
return Object
end
else
return self:Add(Object, false, Id), Id
end---]]
return self:Add(Object, false, Id), Id
end
Janitor.__index.GiveObject = Janitor.__index.AddObject
|
-- (VR) Screen effects -------------- |
function VRBaseCamera:StartFadeFromBlack()
local VRFade = Lighting:FindFirstChild("VRFade")
if not VRFade then
VRFade = Instance.new("ColorCorrectionEffect")
VRFade.Name = "VRFade"
VRFade.Parent = Lighting
end
VRFade.Brightness = -1
self.VRFadeResetTimer = 0.1
end
function VRBaseCamera:UpdateFadeFromBlack(timeDelta: number)
local VRFade = Lighting:FindFirstChild("VRFade")
if self.VRFadeResetTimer > 0 then
self.VRFadeResetTimer = math.max(self.VRFadeResetTimer - timeDelta, 0)
local VRFade = Lighting:FindFirstChild("VRFade")
if VRFade and VRFade.Brightness < 0 then
VRFade.Brightness = math.min(VRFade.Brightness + timeDelta * VR_FADE_SPEED, 0)
end
else
if VRFade then -- sanity check, VRFade off
VRFade.Brightness = 0
end
end
end
function VRBaseCamera:StartVREdgeBlur(player)
local VRScreen = player.PlayerGui:FindFirstChild("VRBlurScreen")
local VRBlur = nil
if VRScreen then
VRBlur = VRScreen:FindFirstChild("VRBlur")
end
if not VRBlur then
if not VRScreen then
VRScreen = Instance.new("ScreenGui")
end
VRScreen.Name = "VRBlurScreen"
VRScreen.Parent = player.PlayerGui
VRBlur = Instance.new("ImageLabel")
VRBlur.Name = "VRBlur"
VRBlur.Parent = VRScreen
VRBlur.Image = "rbxasset://textures/ui/VR/edgeBlur.png"
VRBlur.AnchorPoint = Vector2.new(0.5, 0.5)
VRBlur.Position = UDim2.new(0.5, 0, 0.5, 0)
-- this computes the ratio between the GUI 3D panel and the VR viewport
-- adding 15% overshoot for edges on 2 screen headsets
local ratioX = workspace.CurrentCamera.ViewportSize.X * 2.3 / VR_PANEL_SIZE
local ratioY = workspace.CurrentCamera.ViewportSize.Y * 2.3 / VR_PANEL_SIZE
VRBlur.Size = UDim2.fromScale(ratioX, ratioY)
VRBlur.BackgroundTransparency = 1
VRBlur.Active = true
VRBlur.ScaleType = Enum.ScaleType.Stretch
end
VRBlur.Visible = true
VRBlur.ImageTransparency = 0
self.VREdgeBlurTimer = VR_SCREEN_EGDE_BLEND_TIME
end
function VRBaseCamera:UpdateEdgeBlur(player, timeDelta)
local VRScreen = player.PlayerGui:FindFirstChild("VRBlurScreen")
local VRBlur = nil
if VRScreen then
VRBlur = VRScreen:FindFirstChild("VRBlur")
end
if VRBlur then
if self.VREdgeBlurTimer > 0 then
self.VREdgeBlurTimer = self.VREdgeBlurTimer - timeDelta
local VRScreen = player.PlayerGui:FindFirstChild("VRBlurScreen")
if VRScreen then
local VRBlur = VRScreen:FindFirstChild("VRBlur")
if VRBlur then
VRBlur.ImageTransparency = 1.0 - math.clamp(self.VREdgeBlurTimer, 0.01,
VR_SCREEN_EGDE_BLEND_TIME) * (1/VR_SCREEN_EGDE_BLEND_TIME)
end
end
else
VRBlur.Visible = false
end
end
end
function VRBaseCamera:GetCameraHeight()
if not self.inFirstPerson then
return math.sin(VR_ANGLE) * self.currentSubjectDistance
end
return 0
end
function VRBaseCamera:GetSubjectCFrame(): CFrame
local result = BaseCamera.GetSubjectCFrame(self)
local camera = workspace.CurrentCamera
local cameraSubject = camera and camera.CameraSubject
if not cameraSubject then
return result
end
-- new VR system overrides
if cameraSubject:IsA("Humanoid") then
local humanoid = cameraSubject
local humanoidIsDead = humanoid:GetState() == Enum.HumanoidStateType.Dead
if humanoidIsDead and humanoid == self.lastSubject then
result = self.lastSubjectCFrame
end
end
if result then
self.lastSubjectCFrame = result
end
return result
end
function VRBaseCamera:GetSubjectPosition(): Vector3
local result = BaseCamera.GetSubjectPosition(self)
-- new VR system overrides
local camera = game.Workspace.CurrentCamera
local cameraSubject = camera and camera.CameraSubject
if cameraSubject then
if cameraSubject:IsA("Humanoid") then
local humanoid = cameraSubject
local humanoidIsDead = humanoid:GetState() == Enum.HumanoidStateType.Dead
if humanoidIsDead and humanoid == self.lastSubject then
result = self.lastSubjectPosition
end
elseif cameraSubject:IsA("VehicleSeat") then
local offset = VR_SEAT_OFFSET
result = cameraSubject.CFrame.p + cameraSubject.CFrame:vectorToWorldSpace(offset)
end
else
return
end
self.lastSubjectPosition = result
return result
end
|
-- these should not be undefined |
export type DoneTakingTestFn = (this: TestContext | nil, done: DoneFn) -> ValidTestReturnValues
export type PromiseReturningTestFn = (this: TestContext | nil) -> TestReturnValue
export type GeneratorReturningTestFn = (this: TestContext | nil) -> TestReturnValueGenerator
export type TestName = string
export type TestFn = PromiseReturningTestFn | GeneratorReturningTestFn | DoneTakingTestFn
export type ConcurrentTestFn = () -> TestReturnValuePromise
export type BlockFn = () -> ()
export type BlockName = string
export type HookFn = TestFn
export type Col = any
export type Row = Array<Col>
export type Table = Array<Row>
export type ArrayTable = Table | Row
export type TemplateTable = TemplateStringsArray
export type TemplateData = Array<any>
|
-- print(animName .. " " .. idx .. " [" .. origRoll .. "]") |
local anim = animTable[animName][idx].anim
-- switch animation
if (anim ~= currentAnimInstance) then
if (currentAnimTrack ~= nil) then
currentAnimTrack:Stop(transitionTime)
currentAnimTrack:Destroy()
end
currentAnimSpeed = 1.0
-- load it to the humanoid; get AnimationTrack
currentAnimTrack = humanoid:LoadAnimation(anim)
-- play the animation
currentAnimTrack:Play(transitionTime)
currentAnim = animName
currentAnimInstance = anim
-- set up keyframe name triggers
if (currentAnimKeyframeHandler ~= nil) then
currentAnimKeyframeHandler:Disconnect()
end
currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:Connect(keyFrameReachedFunc)
end
end
|
--[[
INSTRUCTIONS: Place both teleporter1a and teleporter1b in the same directory
(e.g. both in workspace directly, or both directly in the same group or model)
Otherwise it wont work. Once youve done that, jump on the teleporter to teleport to the other.
If you want more than one set of teleporters I will be adding more types in the future.
Send me requests and ideas - Demotico.
--]] | |
--[[ LawlR fix ]] | --
local ds = game:GetService("Debris")
local ps = game:GetService("Players")
local rng = Random.new()
local potato = script.Parent
local potatoOwner = potato:WaitForChild("Owner").Value
local ownerName = potatoOwner.Name
local dmg = 49
local lifetime = 500
local function tagHum(hum)
local tag = Instance.new("ObjectValue")
tag.Name = "creator"
tag.Value = potatoOwner
tag.Parent = hum
ds:AddItem(tag, 2)
end
local function isTeamMate(hitPlr)
return (hitPlr and potatoOwner and not hitPlr.Neutral and not potatoOwner.Neutral and hitPlr.TeamColor == potatoOwner.TeamColor)
end
potato.Touched:Connect(function(hit)
local hitHum = hit.Parent:FindFirstChildWhichIsA("Humanoid") or hit.Parent.Parent:FindFirstChildWhichIsA("Humanoid")
if hitHum and hitHum.Health > 0 then
local hitChr = hitHum.Parent
if hitChr then
if hitChr.Name ~= ownerName then
local hitPlr = ps:GetPlayerFromCharacter(hitChr)
if hitPlr and isTeamMate(hitPlr) then
return
end
tagHum(hitHum)
hitHum:TakeDamage(dmg)
hitHum.WalkSpeed = 0
wait(3)
hitHum.WalkSpeed = 16
end
end
end
end)
ds:AddItem(potato, lifetime)
|
--- |
local Paint = false
script.Parent.MouseButton1Click:connect(function()
Paint = not Paint
handler:FireServer("Nougat",Paint)
end)
|
--[[
Better don't change anything. This script is WIP v.0.4
This thing still glitchy and still needs an improvement
Don't edit pass this line you may break the whole script ]]
----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
function StartSound()
NightTheme:Pause()
Found:Play()
FlashEffect.BackgroundTransparency = 0.6
wait(0.4)
ScreenShake.Disabled = false
FlashEffect.BackgroundTransparency = 1
RakeTheme:Play()
end
function StopSound()
ScreenShake.Disabled = true
FlashEffect.BackgroundTransparency = 1
RakeTheme:Stop()
NightTheme:Play()
Camera.FieldOfView = 70
end
function UpdateNightThemeID()
local RandomNTIDS = math.random(1,#NightThemeIDS)
local ChosenNTID = NightThemeIDS[RandomNTIDS] |
--[[
Reference renderer intended for use in tests as well as for documenting the
minimum required interface for a Roact renderer.
]] |
local NoopRenderer = {}
function NoopRenderer.isHostObject(target)
-- Attempting to use NoopRenderer to target a Roblox instance is almost
-- certainly a mistake.
return target == nil
end
function NoopRenderer.mountHostNode(_reconciler, _node) end
function NoopRenderer.unmountHostNode(_reconciler, _node) end
function NoopRenderer.updateHostNode(_reconciler, node, _newElement)
return node
end
return NoopRenderer
|
--//Services//-- |
local Chat = game:GetService("Chat")
|
--Leave script alone! |
game.Players.PlayerAdded:Connect(function(plr)
wait()
local SunFX = script.LensFlareGui:Clone()
SunFX.Parent = plr.PlayerGui
end)
print('Voxel: SEGI LIGHTING loaded..')
wait(2)
script.Beep:Play()
Lighting = game:GetService("Lighting")
wait(0.1)
Lighting.Brightness = 3
Lighting.ExposureCompensation = 1.2
Lighting.ShadowSoftness = 0.2
Lighting.OutdoorAmbient = Color3.new(139/255, 139/255, 139/255)
Lighting.Ambient = Color3.new(2/255, 2/255, 2/255)
SunFlare = Instance.new("SunRaysEffect", Lighting)
SunFlare.Intensity = 0.059
SunFlare.Spread = 0.356
ColorCorrection = Instance.new("ColorCorrectionEffect", Lighting)
ColorCorrection.TintColor = Color3.new(229/255, 231/255, 255/255)
ColorCorrection.Contrast = 0.1
ColorCorrection.Brightness = 0
ColorCorrection.Saturation = 0.1
Lighting.FogEnd = 2500
Lighting.FogStart = 0
Lighting.FogColor = Color3.new(160/255, 214/255, 255/255)
|
--[[ Script Variables ]] | --
while not Players.LocalPlayer do
wait()
end
local LocalPlayer = Players.LocalPlayer
local JumpButton = nil
local OnInputEnded = nil -- defined in Create()
|
-- Public Functions |
function UpgradeManager:AddUpgrade(player)
local stats = player:WaitForChild("stats")
local points = stats:WaitForChild(GameSettings.pointsName)
local upgrades = stats:WaitForChild(GameSettings.upgradeName)
upgrades.Value = upgrades.Value + 1
self:SetWalkspeedToCurrentUpgrade(player)
ParticleController:CreateUpgradeParticle(player)
DataStore:SetPoints(player, points.Value)
DataStore:SetUpgrades(player, upgrades.Value)
end
function UpgradeManager:BuyUpgrade(player)
local stats = player:WaitForChild("stats")
local points = stats:WaitForChild(GameSettings.pointsName)
local upgrades = stats:WaitForChild(GameSettings.upgradeName)
local cost = GameSettings.upgradeCost(upgrades.Value)
-- Check if the player can make the purchase and if so, allow them
if points.Value >= cost then
points.Value = points.Value - cost
upgrades.Value = upgrades.Value + 1
self:SetWalkspeedToCurrentUpgrade(player)
DataStore:SetPoints(player, points.Value)
DataStore:SetUpgrades(player, upgrades.Value)
ParticleController:CreateUpgradeParticle(player)
else
-- Not enough points
end
end
return UpgradeManager
|
-- goro7 |
local plr = game.Players.LocalPlayer
script.Parent.ItemIcon.MouseButton1Click:connect(function()
-- Play sound
plr.PlayerGui.GUIClick:Play()
-- Open display
plr.PlayerGui.MainGui.Shop.MainFrame.Display.Container.ShowItems:Fire("Toy")
end)
|
-- The amount of RotVelocity.Magnitude the anticheat will stay cool
-- with. Exploit scripts usually create ludicrous velocities, so they
-- often trigger even generous limits. |
config.RotVelocityTolerance = 360 * 4
|
--returns the wielding player of this tool |
function getPlayer()
local char = Tool.Parent
return game:GetService("Players"):GetPlayerFromCharacter(Character)
end
function Toss(direction)
local OriginalWalkSpeed = Humanoid.WalkSpeed
OriginalWalkSpeed = OriginalWalkSpeed
Humanoid.WalkSpeed = 0
local handlePos = Vector3.new(Tool.Handle.Position.X, 0, Tool.Handle.Position.Z)
local spawnPos = Character.Head.Position
spawnPos = spawnPos + (direction * 5)
Tool.Handle.Transparency = 1
Object.Parent = workspace
Object.Transparency = 1
Object.Swing.Pitch = math.random(90, 110)/100
Object.Swing:Play()
Object.CanCollide = true
Object.CFrame = Tool.Handle.CFrame
Object.Velocity = (direction*AttackVelocity) + Vector3.new(0,AttackVelocity/7.5,0)
Object.Fuse:Play()
Object.Sparks.Enabled = true
local rand = 11.25
Object.RotVelocity = Vector3.new(math.random(-rand,rand),math.random(-rand,rand),math.random(-rand,rand))
Object:SetNetworkOwner(getPlayer())
local ScriptClone = DamageScript:Clone()
ScriptClone.FriendlyFire.Value = FriendlyFire
ScriptClone.Damage.Value = AttackDamage
ScriptClone.Parent = Object
ScriptClone.Disabled = false
local tag = Instance.new("ObjectValue")
tag.Value = getPlayer()
tag.Name = "creator"
tag.Parent = Object
Humanoid.WalkSpeed = OriginalWalkSpeed
Tool:Destroy()
end
Remote.OnServerEvent:Connect(function(player, mousePosition)
if not AttackAble then return end
AttackAble = false
if Humanoid and Humanoid.RigType == Enum.HumanoidRigType.R15 then
Remote:FireClient(getPlayer(), "PlayAnimation", "Animation")
end
local targetPos = mousePosition.p
local lookAt = (targetPos - Character.Head.Position).unit
Toss(lookAt)
LeftDown = true
end)
function onLeftUp()
LeftDown = false
end
Tool.Equipped:Connect(function()
Character = Tool.Parent
Humanoid = Character:FindFirstChildOfClass("Humanoid")
end)
Tool.Unequipped:Connect(function()
Character = nil
Humanoid = nil
end)
|
-- initiate |
repeat local success = pcall(function() StarterGui:SetCore("TopbarEnabled", false) end) wait() until success
|
--------------------) Settings |
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 3 -- cooldown for use of the tool again
ZoneModelName = "Supernova" -- name the zone model
MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage |
-- External services |
local contentProvider = game:GetService("ContentProvider")
|
--[=[
Construct a new Promise that will be resolved or rejected with the given callbacks.
If you `resolve` with a Promise, it will be chained onto.
You can safely yield within the executor function and it will not block the creating thread.
```lua
local myFunction()
return Promise.new(function(resolve, reject, onCancel)
wait(1)
resolve("Hello world!")
end)
end
myFunction():andThen(print)
```
You do not need to use `pcall` within a Promise. Errors that occur during execution will be caught and turned into a rejection automatically. If `error()` is called with a table, that table will be the rejection value. Otherwise, string errors will be converted into `Promise.Error(Promise.Error.Kind.ExecutionError)` objects for tracking debug information.
You may register an optional cancellation hook by using the `onCancel` argument:
* This should be used to abort any ongoing operations leading up to the promise being settled.
* Call the `onCancel` function with a function callback as its only argument to set a hook which will in turn be called when/if the promise is cancelled.
* `onCancel` returns `true` if the Promise was already cancelled when you called `onCancel`.
* Calling `onCancel` with no argument will not override a previously set cancellation hook, but it will still return `true` if the Promise is currently cancelled.
* You can set the cancellation hook at any time before resolving.
* When a promise is cancelled, calls to `resolve` or `reject` will be ignored, regardless of if you set a cancellation hook or not.
@param executor (resolve: (...: any) -> (), reject: (...: any) -> (), onCancel: (abortHandler: () -> boolean)) -> ()
@return Promise
]=] |
function Promise.new(executor)
return Promise._new(debug.traceback(nil, 2), executor)
end
function Promise:__tostring()
return string.format("Promise(%s)", self._status)
end
|
--[[
Dax,
See the MeleeScript.
]] |
local canmelee = true;
local tool = script.Parent;
function onKeyDown(key)
key:lower();
if key == "f" then
if canmelee == false then
return;
end
tool.Melee:play()
canmelee = false;
local rgrip = tool.Parent["Right Arm"].RightGrip;
script.melee.Value = true;
for i = 1,6 do
rgrip.C1 = rgrip.C1 * CFrame.fromEulerAnglesXYZ(-0.55,0,0);
wait();
end
wait(0.25);
for i = 1, 6 do
rgrip.C1 = rgrip.C1 * CFrame.fromEulerAnglesXYZ(0.55,0,0);
wait();
end
script.melee.Value = false;
wait(0.5);
canmelee = true;
end
end
function onSelect(mouse)
mouse.KeyDown:connect(onKeyDown);
end
function blow(hit)
local humanoid = hit.Parent:findFirstChild("Humanoid")
if not humanoid then return end
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
if humanoid ~= hum and hum ~= nil and game.Players:playerFromCharacter(humanoid.Parent) and game.Players:playerFromCharacter(humanoid.Parent).TeamColor~=cc then
tagHumanoid(humanoid, vPlayer)
humanoid:TakeDamage(300)
wait(1)
untagHumanoid(humanoid)
end
end
tool.Equipped:connect(onSelect);
|
-- Make sure all music "Loop" properties are true |
for _,song in pairs(music:GetChildren()) do
song.Looped = true
end
|
---[[ Window Settings ]] |
module.MinimumWindowSize = UDim2.new(0.3, 0, 0.25, 0)
module.MaximumWindowSize = UDim2.new(1, 0, 1, 0) -- Should always be less than the full screen size.
module.DefaultWindowPosition = UDim2.new(0, 0, 0, 0)
local extraOffset = (7 * 2) + (5 * 2) -- Extra chatbar vertical offset
module.DefaultWindowSizePhone = UDim2.new(0.5, 0, 0.5, extraOffset)
module.DefaultWindowSizeTablet = UDim2.new(0.4, 0, 0.3, extraOffset)
module.DefaultWindowSizeDesktop = UDim2.new(0.23, 0, 0.2, extraOffset)
|
--Button size |
local ButtonSX = Button.Size.X.Scale
local ButtonSY = Button.Size.Y.Scale
Button.MouseEnter:Connect(function(x,y)
--HolaMousee
Button:TweenSize(
UDim2.new(ButtonSX + 0.027 , 0,ButtonSY + 0.024, 0),
Enum.EasingDirection.Out,
Enum.EasingStyle.Back,
0.2,
true
)
end)
Button.MouseLeave:Connect(function(x,y)
--AdiosMousee
Button:TweenSize(
UDim2.new(ButtonSX, 0,ButtonSY, 0),
Enum.EasingDirection.Out,
Enum.EasingStyle.Back,
0.2,
true
)
end)
Button.MouseButton1Down:Connect(function(x,y)
--Holding mouse
Button:TweenSize(
UDim2.new(ButtonSX - 0.027 , 0,ButtonSY - 0.024 , 0),
Enum.EasingDirection.Out,
Enum.EasingStyle.Back,
0.15,
true
)
end)
Button.MouseButton1Up:Connect(function(x,y)
--Holding mouse
Button:TweenSize(
UDim2.new(ButtonSX + 0.027,0, ButtonSY + 0.024,0),
Enum.EasingDirection.Out,
Enum.EasingStyle.Back,
0.15,
true
)
end)
|
-- NOTE: Specifically listens for Gamepad1 controls only!!! | |
-- Welcome to the variable museum: |
local player = script.Parent.Parent.Parent
local plane,mainParts,animationParts,info,main,move,gryo,seat,landingGear,accel,canCrash,crashForce,crashSpin,crashVisual,maxBank,maxSpeed,speedVary,stallSpeed,throttleInc,altRestrict,altMin,altMax,altSet
local desiredSpeed,currentSpeed,realSpeed = 0,0,0
local mouseSave
local gearParts = {}
local selected,flying,on,dead,gear,throttle,feThrottle,cruising = false,false,false,false,true,0,0,false
local gui = script.Parent
local panel = gui.Panel
local camtype = 1
local lowestPoint = 0
local A = math.abs -- Creating a shortcut for the function
local keys = {
engine={key};
landing = {key};
spdup={byte=0;down=false};
spddwn={byte=0;down=false};
}
function waitFor(parent,array) -- Backup system to wait for objects to 'load'
if (array) then
for _,name in pairs(array) do
while (not parent:findFirstChild(name)) do wait() end -- If the object is found right away, no time will be spent waiting. That's why 'while' loops work better than 'repeat' in this case
end
elseif (parent:IsA("ObjectValue")) then
while (not parent.Value) do wait() end
end
end
function fixVars() -- Correct your mistakes to make sure the plane still flies correctly!
maxBank = (maxBank < -90 and -90 or maxBank > 90 and 90 or maxBank)
throttleInc = (throttleInc < 0.01 and 0.01 or throttleInc > 1 and 1 or throttleInc)
stallSpeed = (stallSpeed > maxSpeed and maxSpeed or stallSpeed)
accel = (accel < 0.01 and 0.01 or accel > maxSpeed and maxSpeed or accel)
altMax = ((altMax-100) < altMin and (altMin+100) or altMax)
altMax = (altSet and (altMax+main.Position.y) or altMax)
altMin = (altSet and (altMin+main.Position.y) or altMin)
keys.engine.key = (keys.engine.key == "" and "e" or keys.engine.key)
keys.spdup.byte = (keys.spdup.byte == 0 and 17 or keys.spdup.byte)
keys.spddwn.byte = (keys.spddwn.byte == 0 and 18 or keys.spddwn.byte)
keys.landing.key = (keys.landing.key == "" and "g" or keys.landing.key)
end
function getVars() -- Since this plane kit is supposed to make you avoid scripting altogether, I have to go the extra mile and write a messy function to account for all those object variables
plane = script.Parent.Plane.Value
waitFor(plane,{"MainParts","OtherParts","EDIT_THESE","Dead"})
mainParts,info = plane.MainParts,plane.EDIT_THESE
waitFor(plane.Parent,{"AnimationParts"})
animationParts = plane.Parent.AnimationParts
waitFor(mainParts,{"Main","MainSeat","LandingGear"})
main,seat,landingGear = mainParts.Main,mainParts.MainSeat,mainParts.LandingGear
waitFor(main,{"Move","Gyro"})
move,gyro = main.Move,main.Gyro
accel,canCrash,crashForce,crashSpin,crashVisual,maxBank,maxSpeed,speedVary,stallSpeed,throttleInc,altRestrict,altMin,altMax,altSet = -- Quickest way to assign tons of variables
A(info.Acceleration.Value),info.CanCrash.Value,A(info.CanCrash.Force.Value),info.CanCrash.SpinSpeed.Value,info.CanCrash.VisualFX.Value,
info.MaxBank.Value,A(info.MaxSpeed.Value),A(info.SpeedDifferential.Value),A(info.StallSpeed.Value),A(info.ThrottleIncrease.Value),
info.AltitudeRestrictions.Value,info.AltitudeRestrictions.MinAltitude.Value,info.AltitudeRestrictions.MaxAltitude.Value,info.AltitudeRestrictions.SetByOrigin.Value
keys.engine.key = info.Hotkeys.Engine.Value:gmatch("%a")():lower()
keys.landing.key = info.Hotkeys.Gear.Value:gmatch("%a")():lower()
local sU,sD = info.Hotkeys.SpeedUp.Value:lower(),info.Hotkeys.SpeedDown.Value:lower()
keys.spdup.byte = (sU == "arrowkeyup" and 17 or sU == "arrowkeydown" and 18 or sU:gmatch("%a")():byte()) -- Ternary operations use logical figures to avoid 'if' statements
keys.spddwn.byte = (sD == "arrowkeyup" and 17 or sD == "arrowkeydown" and 18 or sD:gmatch("%a")():byte())
fixVars()
plane.Dead.Changed:connect(function()
if ((plane.Dead.Value) and (not dead)) then -- DIE!
dead,flying,on = true,false,false
main.Fire.Enabled,main.Smoke.Enabled = info.CanCrash.VisualFX.Value,info.CanCrash.VisualFX.Value
move.maxForce = Vector3.new(0,0,0)
gyro.D = 1e3
while ((selected) and (not plane.Dead.Stop.Value)) do
gyro.cframe = (gyro.cframe*CFrame.Angles(0,0,math.rad(crashSpin)))
wait()
end
end
end)
end
function getGear(parent) -- Very common way to scan through every descendant of a model:
for _,v in pairs(parent:GetChildren()) do
if (v:IsA("BasePart")) then
local t,r,c = Instance.new("NumberValue",v),Instance.new("NumberValue",v),Instance.new("BoolValue",v) -- Saving original properties
t.Name,r.Name,c.Name = "Trans","Ref","Collide"
t.Value,r.Value,c.Value = v.Transparency,v.Reflectance,v.CanCollide
table.insert(gearParts,v)
end
getGear(v)
end
end
function getLowestPoint() -- Plane will use LowestPoint to determine where to look to make sure the plane is either flying or on the ground
if (#gearParts == 0) then
lowestPoint = (main.Position.y+5+(main.Size.y/2))
return
end
for _,v in pairs(gearParts) do -- Not very efficient, but it basically does what I designed it to do:
local _0 = (main.Position.y-(v.CFrame*CFrame.new((v.Size.x/2),0,0)).y)
local _1 = (main.Position.y-(v.CFrame*CFrame.new(-(v.Size.x/2),0,0)).y)
local _2 = (main.Position.y-(v.CFrame*CFrame.new(0,(v.Size.y/2),0)).y)
local _3 = (main.Position.y-(v.CFrame*CFrame.new(0,-(v.Size.y/2),0)).y)
local _4 = (main.Position.y-(v.CFrame*CFrame.new(0,0,(v.Size.z/2))).y)
local _5 = (main.Position.y-(v.CFrame*CFrame.new(0,0,-(v.Size.z/2))).y)
local n = (math.max(_0,_1,_2,_3,_4,_5)+5)
lowestPoint = (n > lowestPoint and n or lowestPoint)
end
end
function guiSetup() -- Setting up the GUI buttons and such
local cur = 0
panel.Controls.Position = UDim2.new(0,0,0,-(panel.Controls.AbsolutePosition.y+panel.Controls.AbsoluteSize.y))
panel.ControlsButton.MouseButton1Click:connect(function()
cur = (cur == 0 and 1 or 0)
if (cur == 0) then
panel.Controls:TweenPosition(UDim2.new(0,0,0,-(panel.Controls.AbsolutePosition.y+panel.Controls.AbsoluteSize.y)),"In","Sine",0.35)
else
panel.Controls.Visible = true
panel.Controls:TweenPosition(UDim2.new(0,0,1.5,0),"Out","Back",0.5)
end
end)
panel.Controls.C1.Text = (keys.engine.key:upper() .. " Key")
panel.Controls.C2.Text = (keys.spdup.byte == 17 and "UP Arrow Key" or keys.spdup.byte == 18 and "DOWN Arrow Key" or (string.char(keys.spdup.byte):upper() .. " Key"))
panel.Controls.C3.Text = (keys.spddwn.byte == 17 and "UP Arrow Key" or keys.spddwn.byte == 18 and "DOWN Arrow Key" or (string.char(keys.spddwn.byte):upper() .. " Key"))
panel.Controls.C4.Text = (keys.landing.key:upper() .. " Key")
end
waitFor(script.Parent,{"Plane","Deselect0","Deselect1","CurrentSelect"})
waitFor(script.Parent.Plane)
getVars()
getGear(landingGear)
getLowestPoint()
guiSetup() |
--[[
Returns a new list, ordered with the given sort callback.
If no callback is given, the default table.sort will be used.
]] |
local function sort(list, callback)
local new = {}
for i = 1, #list do
new[i] = list[i]
end
table.sort(new, callback)
return new
end
return sort
|
-- the Tool, reffered to here as "Block." Do not change it! |
Block = script.Parent.Parent.Bell2 -- You CAN change the name in the quotes "Example Tool"
|
-- tweens a given object in the path made by the Bezier (cframe version)
-- works for any object that has the properties given by the property table |
function Bezier:CreateCFrameTween(object: Instance | {[any]: any}, propertyTable: {any}, bezierTweenInfo: TweenInfo, RelativeToLength: boolean?): Tween
-- check if there are enough points to calculate a cframe within the Bezier
if #self.Points <= 1 then
error("Bezier:CreateVector3Tween() only works if there are at least 2 BezierPoints in the Bezier!")
end
-- check if the object given is a valid object
if typeof(object) ~= "Instance" and typeof(object) ~= "table" then
error("Bezier:CreateCFrameTween() requires an Instance or a table as the first argument!")
end
-- check if the bezierTweenInfo given is a TweenInfo object
if not (typeof(bezierTweenInfo) == "TweenInfo") then
error("Bezier:CreateCFrameTween() requires a TweenInfo object as the third argument!")
end
-- check if the object given has the CFrame properties given
local success, foundProperties = pcall(function()
local foundProperties = true
for _, propertyName in pairs(propertyTable) do
if typeof(object[propertyName]) ~= "CFrame" and typeof(object[propertyName]) ~= "nil" then
foundProperties = false
break
end
end
return foundProperties
end)
-- check if the properties were found
if success and foundProperties then
local tweenService = game:GetService("TweenService")
local numValue = Instance.new("NumberValue")
local tween = tweenService:Create(numValue, bezierTweenInfo, {Value = 1})
local numValueChangedConnection
tween.Changed:Connect(function(prop)
if prop == "PlaybackState" then
local playbackState = tween.PlaybackState
if playbackState == Enum.PlaybackState.Playing then
numValueChangedConnection = numValue.Changed:Connect(function(t)
for _, propName in pairs(propertyTable) do
local position = RelativeToLength and self:CalculatePositionRelativeToLength(t) or self:CalculatePositionAt(t)
local derivative = RelativeToLength and self:CalculateDerivativeRelativeToLength(t) or self:CalculateDerivativeAt(t)
object[propName] = CFrame.new(position, position + derivative)
end
end)
else
if numValueChangedConnection then
numValueChangedConnection:Disconnect()
numValueChangedConnection = nil
end
end
end
end)
return tween
else
error("Bezier:CreateCFrameTween() requires a matching property table with CFrame or nil property names for the object as the second argument!")
end
end
|
----------------------------------------------------------------------
--------------------[ GET WELD CFRAMES ]------------------------------
---------------------------------------------------------------------- |
for _, v in pairs(Gun:GetChildren()) do
if v:IsA("BasePart") and v ~= Handle then
if v:FindFirstChild("mainWeld") then v.mainWeld:Destroy() end
if (not v:FindFirstChild("weldCF")) then
local weldCF = Instance.new("CFrameValue")
weldCF.Name = "weldCF"
weldCF.Value = Handle.CFrame:toObjectSpace(v.CFrame)
weldCF.Parent = v
end
if string.sub(v.Name, 1, 3) == "Mag" then
if (not v:FindFirstChild("magTrans")) then
local magTrans = Instance.new("NumberValue")
magTrans.Name = "magTrans"
magTrans.Value = v.Transparency
magTrans.Parent = v
end
end
v.Anchored = true
v.CanCollide = false
end
end
Handle.Anchored = false
Handle.CanCollide = true
|
------------------------------------------------------------------------------------------------------------ |
function configureAnimationSetOld(name, fileList)
if (animTable[name] ~= nil) then
for _, Connection in pairs(animTable[name].Connections) do
Connection:Disconnect()
end
end
animTable[name] = {}
animTable[name].count = 0
animTable[name].totalWeight = 0
animTable[name].Connections = {}
local allowCustomAnimations = true
local success, msg = pcall(function() allowCustomAnimations = game:GetService("StarterPlayer").AllowCustomAnimations end)
if not success then
allowCustomAnimations = true
end
-- check for config values
local config = script:FindFirstChild(name)
if (allowCustomAnimations and config ~= nil) then
table.insert(animTable[name].Connections, config.ChildAdded:Connect(function(child) configureAnimationSet(name, fileList) end))
table.insert(animTable[name].Connections, config.ChildRemoved:Connect(function(child) configureAnimationSet(name, fileList) end))
local idx = 1
for _, childPart in pairs(config:GetChildren()) do
if (childPart:IsA("Animation")) then
table.insert(animTable[name].Connections, childPart.Changed:Connect(function(property) configureAnimationSet(name, fileList) end))
animTable[name][idx] = {}
animTable[name][idx].anim = childPart
local weightObject = childPart:FindFirstChild("Weight")
if (weightObject == nil) then
animTable[name][idx].weight = 1
else
animTable[name][idx].weight = weightObject.Value
end
animTable[name].count = animTable[name].count + 1
animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
idx = idx + 1
end
end
end
-- fallback to defaults
if (animTable[name].count <= 0) then
for idx, anim in pairs(fileList) do
animTable[name][idx] = {}
animTable[name][idx].anim = Instance.new("Animation")
animTable[name][idx].anim.Name = name
animTable[name][idx].anim.AnimationId = anim.id
animTable[name][idx].weight = anim.weight
animTable[name].count = animTable[name].count + 1
animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
-- print(name .. " [" .. idx .. "] " .. anim.id .. " (" .. anim.weight .. ")")
end
end
-- preload anims
for i, animType in pairs(animTable) do
for idx = 1, animType.count, 1 do
Humanoid:LoadAnimation(animType[idx].anim)
end
end
end
|
--RbxApi |
local function PropertyIsHidden(propertyData)
local tags = propertyData["tags"]
for _,name in pairs(tags) do
if name == "deprecated"
or name == "hidden"
or name == "writeonly" then
return true
end
end
return false
end
function Set(object, propertyData, value)
local propertyName = propertyData["Name"]
local propertyType = propertyData["ValueType"]
if value == nil then return end
for i,v in pairs(GetSelection()) do
if CanEditProperty(v,propertyData) then
pcall(function()
--print("Setting " .. propertyName .. " to " .. tostring(value))
v[propertyName] = value
end)
end
end
end
function CreateRow(object, propertyData, isAlternateRow)
local propertyName = propertyData["Name"]
local propertyType = propertyData["ValueType"]
local propertyValue = object[propertyName]
--rowValue, rowValueType, isAlternate
local backColor = Row.BackgroundColor;
if (isAlternateRow) then
backColor = Row.BackgroundColorAlternate
end
local readOnly = not CanEditProperty(object, propertyData)
if propertyType == "Instance" or propertyName == "Parent" then readOnly = true end
local rowFrame = Instance.new("Frame")
rowFrame.Size = UDim2.new(1,0,0,Row.Height)
rowFrame.BackgroundTransparency = 1
rowFrame.Name = 'Row'
local propertyLabelFrame = CreateCell()
propertyLabelFrame.Parent = rowFrame
propertyLabelFrame.ClipsDescendants = true
local propertyLabel = CreateLabel(readOnly)
propertyLabel.Text = propertyName
propertyLabel.Size = UDim2.new(1, -1 * Row.TitleMarginLeft, 1, 0)
propertyLabel.Position = UDim2.new(0, Row.TitleMarginLeft, 0, 0)
propertyLabel.Parent = propertyLabelFrame
local propertyValueFrame = CreateCell()
propertyValueFrame.Size = UDim2.new(0.5, -1, 1, 0)
propertyValueFrame.Position = UDim2.new(0.5, 0, 0, 0)
propertyValueFrame.Parent = rowFrame
local control = GetControl(object, propertyData, readOnly)
control.Parent = propertyValueFrame
rowFrame.MouseEnter:connect(function()
propertyLabelFrame.BackgroundColor3 = Row.BackgroundColorMouseover
propertyValueFrame.BackgroundColor3 = Row.BackgroundColorMouseover
end)
rowFrame.MouseLeave:connect(function()
propertyLabelFrame.BackgroundColor3 = backColor
propertyValueFrame.BackgroundColor3 = backColor
end)
propertyLabelFrame.BackgroundColor3 = backColor
propertyValueFrame.BackgroundColor3 = backColor
return rowFrame
end
function ClearPropertiesList()
for _,instance in pairs(ContentFrame:GetChildren()) do
instance:Destroy()
end
end
local selection = Gui:FindFirstChild("Selection", 1)
print(selection)
function displayProperties(props)
for i,v in pairs(props) do
pcall(function()
local a = CreateRow(v.object, v.propertyData, ((numRows % 2) == 0))
a.Position = UDim2.new(0,0,0,numRows*Row.Height)
a.Parent = ContentFrame
numRows = numRows + 1
end)
end
end
function checkForDupe(prop,props)
for i,v in pairs(props) do
if v.propertyData.Name == prop.Name and v.propertyData.ValueType == prop.ValueType then
return true
end
end
return false
end
function sortProps(t)
table.sort(t,
function(x,y) return x.propertyData.Name < y.propertyData.Name
end)
end
function showProperties(obj)
ClearPropertiesList()
if obj == nil then return end
local propHolder = {}
local foundProps = {}
numRows = 0
for _,nextObj in pairs(obj) do
if not foundProps[nextObj.className] then
foundProps[nextObj.className] = true
for i,v in pairs(RbxApi.GetProperties(nextObj.className)) do
local suc, err = pcall(function()
if not (PropertyIsHidden(v)) and not checkForDupe(v,propHolder) then
if string.find(string.lower(v.Name),string.lower(propertiesSearch.Text)) or not searchingProperties() then
table.insert(propHolder,{propertyData = v, object = nextObj})
end
end
end)
--[[if not suc then
warn("Problem getting the value of property " .. v.Name .. " | " .. err)
end --]]
end
end
end
sortProps(propHolder)
displayProperties(propHolder)
ContentFrame.Size = UDim2.new(1, 0, 0, numRows * Row.Height)
scrollBar.ScrollIndex = 0
scrollBar.TotalSpace = numRows * Row.Height
scrollBar.Update()
end
|
--[=[
Represents a value that can operate in linear space
@class LinearValue
]=] |
local LinearValue = {}
LinearValue.ClassName = "LinearValue"
LinearValue.__index = LinearValue
|
-- Events |
local Events = ReplicatedStorage:FindFirstChild("Events")
local CheckpointEvent = Events:FindFirstChild("CheckpointEvent")
|
--[[
A utility used to create a function spy that can be used to robustly test
that functions are invoked the correct number of times and with the correct
number of arguments.
This should only be used in tests.
]] |
local assertDeepEqual = require(script.Parent.assertDeepEqual)
local function createSpy(inner)
local self = {
callCount = 0,
values = {},
valuesLength = 0,
}
self.value = function(...)
self.callCount = self.callCount + 1
self.values = {...}
self.valuesLength = select("#", ...)
if inner ~= nil then
return inner(...)
end
end
self.assertCalledWith = function(_, ...)
local len = select("#", ...)
if self.valuesLength ~= len then
error(("Expected %d arguments, but was called with %d arguments"):format(
self.valuesLength,
len
), 2)
end
for i = 1, len do
local expected = select(i, ...)
assert(self.values[i] == expected, "value differs")
end
end
self.assertCalledWithDeepEqual = function(_, ...)
local len = select("#", ...)
if self.valuesLength ~= len then
error(("Expected %d arguments, but was called with %d arguments"):format(
self.valuesLength,
len
), 2)
end
for i = 1, len do
local expected = select(i, ...)
assertDeepEqual(self.values[i], expected)
end
end
self.captureValues = function(_, ...)
local len = select("#", ...)
local result = {}
assert(self.valuesLength == len, "length of expected values differs from stored values")
for i = 1, len do
local key = select(i, ...)
result[key] = self.values[i]
end
return result
end
setmetatable(self, {
__index = function(_, key)
error(("%q is not a valid member of spy"):format(key))
end,
})
return self
end
return createSpy
|
--Prompts the player to purchase the GearItem |
script.Parent.ClickDetector.MouseClick:connect(function(player)
Game:GetService("MarketplaceService"):PromptPurchase(player, shirtId)
end)
|
---------------------------
--[[
--Main anchor point is the DriveSeat <car.DriveSeat>
Usage:
MakeWeld(Part1,Part2,WeldType*,MotorVelocity**) *default is "Weld" **Applies to Motor welds only
ModelWeld(Model,MainPart)
Example:
MakeWeld(car.DriveSeat,misc.PassengerSeat)
MakeWeld(car.DriveSeat,misc.SteeringWheel,"Motor",.2)
ModelWeld(car.DriveSeat,misc.Door)
]]
--Weld stuff here |
car.DriveSeat.ChildAdded:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
child.C0=CFrame.new(-1.2,-.5,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0)
end
end)
|
-- DefaultValue for spare ammo |
local SpareAmmo = 250 |
--adjustspeedLoop |
function module.adjustSpeedLoop(wai, anim, hum ,speed)
local animation = hum.Animator:LoadAnimation(anim)
animation:AdjustSpeed(speed)
animation:Play()
task.delay(wai, function()
animation:Stop()
end)
end
|
--- Manages the cleaning of events and other things.
-- Useful for encapsulating state and make deconstructors easy
-- @classmod Maid
-- @see Signal |
local Maid = {}
Maid.ClassName = "Maid"
Maid.Replicated = true
|
--[[local EnableBackpack = script:WaitForChild("EnableBackpack")
if Services.Players:GetPlayerFromCharacter(Character) and Services.Players:GetPlayerFromCharacter(Character):FindFirstChild("PlayerGui") then
EnableBackpack.Parent = Services.Players:GetPlayerFromCharacter(Character):FindFirstChild("PlayerGui")
EnableBackpack.Disabled = false
Services.Debris:AddItem(EnableBackpack,1)
end]] |
if UnequipLoop then UnequipLoop:Disconnect();UnequipLoop = nil end
if Humanoid then
Humanoid.Health = Humanoid.Health + 15
end
Character:SetPrimaryPartCFrame(CFrame.new(TargetLocation)*(Center.CFrame-Center.CFrame.p))
for i=1,#AffectedParts do
for property, value in pairs(AffectedParts[i]) do
if property ~= "Part" then
AffectedParts[i].Part[property] = value
end
end
end
if ForceField then
ForceField:Destroy()
end
if HeldTool then
Humanoid:EquipTool(HeldTool)
end
if Services.Players:GetPlayerFromCharacter(Character) and Services.Players:GetPlayerFromCharacter(Character):FindFirstChild("PlayerGui") then
FixCam.Parent = Services.Players:GetPlayerFromCharacter(Character):FindFirstChild("PlayerGui")
FixCam.Disabled = false
end
|
--DO NOT CHANGE ANYTHING INSIDE OF THIS SCRIPT BESIDES WHAT YOU ARE TOLD TO UNLESS YOU KNOW WHAT YOU'RE DOING OR THE SCRIPT WILL NOT WORK!! |
local hitPart = script.Parent
local debounce = true
local tool = game.ServerStorage.HeartThrower -- Change "Sword" to the name of your tool, make sure your tool is in ServerStorage
hitPart.Touched:Connect(function(hit)
if debounce == true then
if hit.Parent:FindFirstChild("Humanoid") then
local plr = game.Players:FindFirstChild(hit.Parent.Name)
if plr then
debounce = false
hitPart.BrickColor = BrickColor.new("Bright red")
tool:Clone().Parent = plr.Backpack
wait(3) -- Change "3" to however long you want the player to have to wait before they can get the tool again
debounce = true
hitPart.BrickColor = BrickColor.new("Bright green")
end
end
end
end)
|
-- Projection UI for Vulpix |
local PUI = {}; -- Yes, it's pronounced pooy, it stands for Projection User Interface [service].
local TS = game.TweenService;
local HB = game["Run Service"].Heartbeat;
function PUI:UpdateUI(UI, Object, Character, CameraCF, Data) -- UI Object, NPC / Object, Player.Character, Data
local Time = 0.08; -- was 0.16
local Info = TweenInfo.new(
Time,
Enum.EasingStyle.Sine,
Enum.EasingDirection.InOut
);
local CharPos = Character.HumanoidRootPart.CFrame.p;
local ObjectPos = Object.CFrame.p;
local Look = CFrame.new(ObjectPos, CharPos) - ObjectPos;
local LV = CameraCF.p;
-- ^ or CharPos / CameraCF.p
local Distance = 1; -- 4
local Projected = Object.CFrame;
local ProjectLook = CFrame.new(Object.Position, CameraCF.p) - ObjectPos;
Projected = CFrame.new(ObjectPos) * CFrame.new( ProjectLook.lookVector * Distance );
Projected = CFrame.new(Projected.p, LV);
local Goals = {
CFrame = Projected;
};
TS:Create(UI, Info, Goals):Play();
--wait(Time);
end
return PUI
|
--//Setup//-- |
local DBOn = false
local World = game.Workspace.World
local Start = World.Start
local End = World.End
local CamPart = World.CamPart
local Camera = game.Workspace.CurrentCamera
|
--local function handleAction(actionName, inputState, inputObject)
-- if inputState == Enum.UserInputState.Begin then | |
--// Variables |
local L_1_ = PlayersService.LocalPlayer
|
-- setup emote chat hook
--[[
game.Players.LocalPlayer.Chatted:connect(function(msg)
local emote = ""
if msg == "/e dance" then
emote = dances[math.random(1, #dances)]
elseif (string.sub(msg, 1, 3) == "/e ") then
emote = string.sub(msg, 4)
elseif (string.sub(msg, 1, 7) == "/emote ") then
emote = string.sub(msg, 8)
end
if (pose == "Standing" and emoteNames[emote] ~= nil) then
playAnimation(emote, 0.1, Humanoid)
end
end)
]] | --
|
--!strict |
local function run(LightChanger, reverse)
local lights = LightChanger:GetLights("Numbered")
for groupNumber, lightGroup in lights do
local angle = if groupNumber % 2 == 0 then 30 else -30
if reverse then
angle *= -1
end
LightChanger:Pan(angle, lightGroup)
end
end
return function(LightChangerA, LightChangerB, reverse: boolean)
run(LightChangerA, reverse)
run(LightChangerB, reverse)
end
|
-- ROBLOX deviation START: Bindings are unique to Roact |
export type ReactBinding<T> = {
getValue: (self: ReactBinding<T>) -> T,
-- FIXME Luau: can't create recursive type with different parameters, so we
-- approximate for now
map: <U>(self: ReactBinding<T>, (T) -> U) -> any,
_source: string?,
}
export type ReactBindingUpdater<T> = (T) -> () |
--[=[
Repeatedly calls a Promise-returning function up to `times` number of times, until the returned Promise resolves.
If the amount of retries is exceeded, the function will return the latest rejected Promise.
```lua
local function canFail(a, b, c)
return Promise.new(function(resolve, reject)
-- do something that can fail
local failed, thing = doSomethingThatCanFail(a, b, c)
if failed then
reject("it failed")
else
resolve(thing)
end
end)
end
local MAX_RETRIES = 10
local value = Promise.retry(canFail, MAX_RETRIES, "foo", "bar", "baz") -- args to send to canFail
```
@since 3.0.0
@param callback (...: P) -> Promise<T>
@param times number
@param ...? P
@return Promise<T>
]=] |
function Promise.retry(callback, times, ...)
assert(isCallable(callback), "Parameter #1 to Promise.retry must be a function")
assert(type(times) == "number", "Parameter #2 to Promise.retry must be a number")
local args, length = { ... }, select("#", ...)
return Promise.resolve(callback(...)):catch(function(...)
if times > 0 then
return Promise.retry(callback, times - 1, unpack(args, 1, length))
else
return Promise.reject(...)
end
end)
end
|
--[[Engine]] |
--Torque Curve
Tune.Horsepower = 250 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 800 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 8000 -- Use sliders to manipulate values
Tune.Redline = 8500 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 6800
Tune.PeakSharpness = 3.8
Tune.CurveMult = 0.07
--Incline Compensation
Tune.InclineComp = .5 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 250 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 470 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 150 -- Clutch engagement threshold (higher = faster response)
|
--[colorbin contents] NOT NUMBERED IN ORDER I WAS JUST KEEPING TRACK OF HOW MANY THERE ARE!
--red 1
--yellow 2
--orange 3
--viridian 4
--green 5
--magenta 6
--violet 7
--white 8
--silver 9
--navyblue 10
--blue 11
--black 12
--cyan 13 |
if k == "z" and ibo.Value==true then |
--("no gui found - wierd...") |
end
end
end
end
end
end)
|
-- a-z |
for Index = 97, 122 do
table.insert(Alphabet, Index)
end
|
--------------------------------------- |
ba=Instance.new("Part")
ba.CastShadow = false
ba.TopSurface=0
ba.BottomSurface=0
ba.Anchored=false
ba.CanCollide=false
ba.formFactor="Custom"
ba.Size=Vector3.new(1,0.1,1)
ba.CFrame=CFrame.new(script.Parent.CFrame.p)*CFrame.fromEulerAnglesXYZ(math.pi/2,0,0)
ba.Name="Effect"
ba.BrickColor=BrickColor.new "White"
ao=script.RingMesh:clone()
ao.Parent = ba
local fade = script.RingFade:Clone()
fade.Parent = ba
fade.Disabled = false
ba.Parent=script.Parent
fo=Instance.new("BodyPosition")
fo.maxForce= Vector3.new (99999999999999999,99999999999999999,99999999999999999)
fo.position = ba.Position
fo.Parent = ba
aa=Instance.new("BodyAngularVelocity")
aa.P=3000
aa.maxTorque=aa.maxTorque*30
aa.angularvelocity=Vector3.new(math.random(-70,70)/3,math.random(-70,70)/3,math.random(-70,70)/5)*100
aa.Parent=ba |
--Launches a rocket. |
local function LaunchRocket(Rocket,TargetPos)
local Character = game.Players.LocalPlayer.Character
local SpawnPosition = Handle.Position + (Handle.CFrame.lookVector * (Handle.Size.Z/2))
local BodyVelocity = Rocket:FindFirstChild("BodyVelocity")
local BodyGyro = Rocket:FindFirstChild("BodyGyro")
local ExplodeEvent = Rocket:FindFirstChild("Explode")
Rocket.Velocity = Vector3.new(0,0,0)
Rocket.CFrame = CFrame.new(SpawnPosition,TargetPos)
--Set the velocity and direction.
if BodyVelocity and BodyGyro then
local Direction = (TargetPos - SpawnPosition).unit
BodyVelocity.Velocity = Direction * ROCKET_LAUNCH_SPEED
BodyGyro.CFrame = CFrame.new(Vector3.new(0,0,0),Direction)
end
--Fire the event when touched.
if ExplodeEvent then
Rocket.Touched:Connect(function(TouchPart)
if not IGNORE_LIST[string.lower(TouchPart.Name)] and not TouchPart:IsDescendantOf(Character) then
ExplodeEvent:FireServer(Rocket.Position)
end
end)
end
end
|
-------------------------------------------------------------------------------- |
while true do
while Humanoid.Health < Humanoid.MaxHealth do
local dt = wait(REGEN_STEP)
local dh = dt*REGEN_RATE*Humanoid.MaxHealth
if Character:FindFirstChild("Status").Value >=0 then
Humanoid.Health = math.min(Humanoid.Health + dh, Humanoid.MaxHealth)
end
end
Humanoid.HealthChanged:Wait()
end
|
--[[
Calls any :finally handlers. We need this to be a separate method and
queue because we must call all of the finally callbacks upon a success,
failure, *and* cancellation.
]] |
function Promise.prototype:_finalize()
for _, callback in ipairs(self._queuedFinally) do
-- Purposefully not passing values to callbacks here, as it could be the
-- resolved values, or rejected errors. If the developer needs the values,
-- they should use :andThen or :catch explicitly.
coroutine.wrap(callback)(self._status)
end
self._queuedFinally = nil
self._queuedReject = nil
self._queuedResolve = nil
-- Clear references to other Promises to allow gc
if not Promise.TEST then
self._parent = nil
self._consumers = nil
end
task.defer(coroutine.close, self._thread)
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
local runFilter = false
if (runFilter) 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
if allSpaces(message) 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
|
--------------------) Settings |
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 10 -- cooldown for use of the tool again
ZoneModelName = "void" -- name the zone model
MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage |
--[[Weight and CG]] |
Tune.Weight = 2900 -- Total weight (in pounds)
Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable)
--[[Width]] 6 ,
--[[Height]] 3.5 ,
--[[Length]] 15 }
Tune.WeightDist = 50 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
Tune.CGHeight = .8 -- Center of gravity height (studs relative to median of all wheels)
Tune.WBVisible = false -- Makes the weight brick visible
--Unsprung Weight
Tune.FWheelDensity = .1 -- Front Wheel Density
Tune.RWheelDensity = .1 -- Rear Wheel Density
Tune.FWLgcyDensity = 1 -- Front Wheel Density [PGS OFF]
Tune.RWLgcyDensity = 1 -- Rear Wheel Density [PGS OFF]
Tune.AxleSize = 2 -- Size of structural members (larger = more stable/carry more weight)
Tune.AxleDensity = .1 -- Density of structural members
|
--[[
Used to catch any errors that may have occurred in the promise.
]] |
function Promise.prototype:catch(failureCallback)
assert(
failureCallback == nil or type(failureCallback) == "function",
string.format(ERROR_NON_FUNCTION, "Promise:catch")
)
return self:_andThen(debug.traceback(nil, 2), nil, failureCallback)
end
|
--[[
Returns the wagon model in workspace belonging to a player with a user ID
matching the given ownerId. This is based on the OwnerId attribute of farm
models, which gets set by the server when the farm is loaded for a player.
The Wagon is identified by the Wagon CollectionService tag.
--]] |
local CollectionService = game:GetService("CollectionService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local WagonTag = require(ReplicatedStorage.Source.SharedConstants.CollectionServiceTag.WagonTag)
local Sift = require(ReplicatedStorage.Dependencies.Sift)
local getFarmModelFromOwnerId = require(ReplicatedStorage.Source.Utility.Farm.getFarmModelFromOwnerId)
local function getWagonModelFromOwnerId(ownerId: number): Model?
local maybeFarm = getFarmModelFromOwnerId(ownerId)
if not maybeFarm then
return nil
end
local farm = maybeFarm :: Model
local wagons = Sift.Array.filter(farm:GetChildren(), function(instance: Instance)
return CollectionService:HasTag(instance, WagonTag.Wagon)
end)
-- At most, only one wagon will exist matching in a farm, so it's safe to grab the first list item
return wagons[1] :: Model
end
return getWagonModelFromOwnerId
|
-- не забыть бы убрать!!!
--local Debris = game:GetService("Debris") -- это сервисная команда
--local TimeForDestroy = 10*60 -- минимальное время жизни (10 минут = 10*60) |
local turret = require(game.ServerScriptService.GAVturret)
local V1 = 10 -- скорострельность
local SPEED = 400 -- скорость снарядов
local MAX_DIST = 70 -- дистанция срабатывания
local DAMAGE = 10 -- наносимые повреждения
local TYPE = "Single" -- AOE, SINGLE
wait()
me=script.Parent
pos = me.PrimaryPart
while true do
local target = turret.findNearestHead(pos,MAX_DIST) --findNearestHead()
if target ~= nil then
if target ~= nil and target.Parent ~= nil and target.Parent.Humanoid.Health>0 then
alt=turret.lookAt(target.Position,pos.Position) -- пушка только по горизотали!
me:SetPrimaryPartCFrame(alt) -- направляем туда пушку
-- вычисляем направление выстрела
alt=turret.lookAtY(target.Position,me.Rocket.Position)-- ракета (пусковой механизм) полностью ориентируется
me.Rocket.CFrame= alt
-- в снаряд суём чья турель
if me.Rocket:FindFirstChild("Owner") == nil then
tmp=me.Owner:Clone()
tmp.Parent = me.Rocket
end
turret.Fire(me.Rocket,DAMAGE,SPEED, TYPE) -- стреляем (место снаряда, повреждение) -- добавить создателя пушки
wait()
end
end
wait(V1/10)
end
|
--[=[
Returns `true` if the shake instance is currently running,
otherwise returns `false`.
]=] |
function Shake:IsShaking(): boolean
return self._running
end
|
-- << LOCAL FUNCTIONS >> |
local defaultSettingsToAdd = {"NoticeSoundId", "NoticeVolume", "NoticePitch", "ErrorSoundId", "ErrorVolume", "ErrorPitch", "AlertSoundId", "AlertVolume", "AlertPitch", "Prefix", "SplitKey"}
local defaultSettings = {}
coroutine.wrap(function()
if not main.initialized then
main.client.Signals.Initialized.Event:Wait()
end
for i,v in pairs(defaultSettingsToAdd) do
defaultSettings[v] = settings[v]
end
end)()
local function getDataTemplate()
if not main.initialized then
main.client.Signals.Initialized.Event:Wait()
end
return{
DataKey = 0;
DataToUpdate = true;
Theme = settings.Theme;
NoticeSoundId = settings.NoticeSoundId;
NoticeVolume = settings.NoticeVolume;
NoticePitch = settings.NoticePitch;
ErrorSoundId = settings.ErrorSoundId;
ErrorVolume = settings.ErrorVolume;
ErrorPitch = settings.ErrorPitch;
AlertSoundId = settings.AlertSoundId;
AlertVolume = settings.AlertVolume;
AlertPitch = settings.AlertPitch;
Prefix = settings.Prefix;
SplitKey = settings.SplitKey;
MusicList = settings.MusicList;
MuteLocalSound = false;
PreviousServer = game.JobId;
Rank = 0;
SaveRank = true;
PermRankedBy = 3682;
Donor = false;
Gamepasses = {};
Assets = {};
DefaultSettings = defaultSettings; --If the owner changes these Settings, then update everyones data to the new setting.
Groups = {};
Friends = {};
CommandsActive = {};
LaserColor = Color3.fromRGB(255,0,0);
PromptedDonor = false;
AutomaticRank = false;
Items = {};
SetupData = false;
}
end
local function dataNotToSave()
return{
"Groups";
"Friend";
"CommandsActive";
"LaserColor";
"PromptedDonor";
"AutomaticRank";
"Items";
"SetupData"
}
end
|
-- Decompiled with the Synapse X Luau decompiler. |
local u1 = require(game:GetService("Chat"):WaitForChild("ClientChatModules"):WaitForChild("ChatSettings"));
local l__StarterGui__2 = game:GetService("StarterGui");
function SetCoreGuiChatConnections(p1)
local v1 = 0;
while true do
if v1 < 10 then
else
break;
end;
v1 = v1 + 1;
local v2, v3 = pcall(function()
l__StarterGui__2:SetCore("CoreGuiChatConnections", p1);
end);
if not v2 then
else
break;
end;
if not v2 then
if v1 == 10 then
error("Error calling SetCore CoreGuiChatConnections: " .. v3);
end;
end;
wait();
end;
end;
function checkBothChatTypesDisabled()
if u1.BubbleChatEnabled ~= nil then
if u1.ClassicChatEnabled ~= nil then
else
return false;
end;
else
return false;
end;
return not (u1.BubbleChatEnabled or u1.ClassicChatEnabled);
end;
if not game:GetService("GuiService"):IsTenFootInterface() and not game:GetService("UserInputService").VREnabled then
if checkBothChatTypesDisabled() then
local v4 = {
ChatWindow = {}
};
v4.ChatWindow.ChatTypes = {};
v4.ChatWindow.ChatTypes.BubbleChatEnabled = false;
v4.ChatWindow.ChatTypes.ClassicChatEnabled = false;
SetCoreGuiChatConnections(v4);
return;
end;
else
return;
end;
(function()
local v5 = {
ChatWindow = {},
SetCore = {},
GetCore = {}
};
v5.ChatWindow.ChatTypes = {};
v5.ChatWindow.ChatTypes.BubbleChatEnabled = u1.BubbleChatEnabled;
v5.ChatWindow.ChatTypes.ClassicChatEnabled = u1.ClassicChatEnabled;
local u3 = require(script:WaitForChild("ChatMain"));
local v6 = Instance.new("BindableEvent");
v6.Name = "ToggleVisibility";
v5.ChatWindow.ToggleVisibility = v6;
local u4 = "ToggleVisibility";
v6.Event:connect(function(...)
u3[u4](u3, ...);
end);
local v7 = Instance.new("BindableEvent");
v7.Name = "SetVisible";
v5.ChatWindow.SetVisible = v7;
u4 = "SetVisible";
v7.Event:connect(function(...)
u3[u4](u3, ...);
end);
local v8 = Instance.new("BindableEvent");
v8.Name = "FocusChatBar";
v5.ChatWindow.FocusChatBar = v8;
u4 = "FocusChatBar";
v8.Event:connect(function(...)
u3[u4](u3, ...);
end);
local v9 = Instance.new("BindableFunction");
v9.Name = "GetVisibility";
v5.ChatWindow.GetVisibility = v9;
local u5 = "GetVisibility";
function v9.OnInvoke(...)
return u3[u5](u3, ...);
end;
local v10 = Instance.new("BindableFunction");
v10.Name = "GetMessageCount";
v5.ChatWindow.GetMessageCount = v10;
u5 = "GetMessageCount";
function v10.OnInvoke(...)
return u3[u5](u3, ...);
end;
local v11 = Instance.new("BindableEvent");
v11.Name = "TopbarEnabledChanged";
v5.ChatWindow.TopbarEnabledChanged = v11;
local l__Event__12 = v11.Event;
u4 = "TopbarEnabledChanged";
u5 = l__Event__12;
l__Event__12.connect(u5, function(...)
u3[u4](u3, ...);
end);
local v13 = Instance.new("BindableFunction");
v13.Name = "IsFocused";
v5.ChatWindow.IsFocused = v13;
u5 = "IsFocused";
function v13.OnInvoke(...)
return u3[u5](u3, ...);
end;
local v14 = Instance.new("BindableEvent");
v14.Name = "ChatBarFocusChanged";
v5.ChatWindow.ChatBarFocusChanged = v14;
local l__ChatBarFocusChanged__15 = u3.ChatBarFocusChanged;
local u6 = v14;
u5 = l__ChatBarFocusChanged__15;
l__ChatBarFocusChanged__15.connect(u5, function(...)
u6:Fire(...);
end);
u6 = Instance.new;
u6 = u6("BindableEvent");
u6.Name = "VisibilityStateChanged";
v5.ChatWindow.VisibilityStateChanged = u6;
local l__VisibilityStateChanged__16 = u3.VisibilityStateChanged;
u5 = l__VisibilityStateChanged__16;
l__VisibilityStateChanged__16.connect(u5, function(...)
u6:Fire(...);
end);
u6 = Instance.new;
u6 = u6("BindableEvent");
u6.Name = "MessagesChanged";
v5.ChatWindow.MessagesChanged = u6;
local l__MessagesChanged__17 = u3.MessagesChanged;
u5 = l__MessagesChanged__17;
l__MessagesChanged__17.connect(u5, function(...)
u6:Fire(...);
end);
u6 = Instance.new;
u6 = u6("BindableEvent");
u6.Name = "MessagePosted";
v5.ChatWindow.MessagePosted = u6;
local l__MessagePosted__18 = u3.MessagePosted;
u5 = l__MessagePosted__18;
l__MessagePosted__18.connect(u5, function(...)
u6:Fire(...);
end);
u6 = Instance.new;
u6 = u6("BindableEvent");
u6.Name = "CoreGuiEnabled";
v5.ChatWindow.CoreGuiEnabled = u6;
local l__Event__19 = u6.Event;
u4 = "CoreGuiEnabled";
u5 = l__Event__19;
l__Event__19.connect(u5, function(...)
u3[u4]:fire(...);
end);
u6 = Instance.new;
u6 = u6("BindableEvent");
u6.Name = "ChatMakeSystemMessage";
v5.SetCore.ChatMakeSystemMessage = u6;
local l__Event__20 = u6.Event;
u4 = "ChatMakeSystemMessage";
u5 = l__Event__20;
l__Event__20.connect(u5, function(...)
u3[u4 .. "Event"]:fire(...);
end);
u6 = Instance.new;
u6 = u6("BindableEvent");
u6.Name = "ChatWindowPosition";
v5.SetCore.ChatWindowPosition = u6;
local l__Event__21 = u6.Event;
u4 = "ChatWindowPosition";
u5 = l__Event__21;
l__Event__21.connect(u5, function(...)
u3[u4 .. "Event"]:fire(...);
end);
u6 = Instance.new;
u6 = u6("BindableEvent");
u6.Name = "ChatWindowSize";
v5.SetCore.ChatWindowSize = u6;
local l__Event__22 = u6.Event;
u4 = "ChatWindowSize";
u5 = l__Event__22;
l__Event__22.connect(u5, function(...)
u3[u4 .. "Event"]:fire(...);
end);
u6 = Instance.new;
u6 = u6("BindableFunction");
u6.Name = "ChatWindowPosition";
v5.GetCore.ChatWindowPosition = u6;
u5 = "ChatWindowPosition";
function u6.OnInvoke(...)
return u3["f" .. u5](...);
end;
u6 = Instance.new;
u6 = u6("BindableFunction");
u6.Name = "ChatWindowSize";
v5.GetCore.ChatWindowSize = u6;
u5 = "ChatWindowSize";
function u6.OnInvoke(...)
return u3["f" .. u5](...);
end;
u6 = Instance.new;
u6 = u6("BindableEvent");
u6.Name = "ChatBarDisabled";
v5.SetCore.ChatBarDisabled = u6;
local l__Event__23 = u6.Event;
u4 = "ChatBarDisabled";
u5 = l__Event__23;
l__Event__23.connect(u5, function(...)
u3[u4 .. "Event"]:fire(...);
end);
u6 = Instance.new;
u6 = u6("BindableFunction");
u6.Name = "ChatBarDisabled";
v5.GetCore.ChatBarDisabled = u6;
u5 = "ChatBarDisabled";
function u6.OnInvoke(...)
return u3["f" .. u5](...);
end;
u6 = Instance.new;
u6 = u6("BindableEvent");
u6.Name = "SpecialKeyPressed";
v5.ChatWindow.SpecialKeyPressed = u6;
local l__Event__24 = u6.Event;
u4 = "SpecialKeyPressed";
u5 = l__Event__24;
l__Event__24.connect(u5, function(...)
u3[u4](u3, ...);
end);
u6 = SetCoreGuiChatConnections;
u6(v5);
end)();
|
-- ================================================================================
-- PUBLIC FUNCTIONS
-- ================================================================================ |
function Damping.new()
local damping = setmetatable({
P = 5;
D = 0.1;
Position = V3();
Velocity = V3();
Goal = V3();
Last = tick();
}, Damping)
return damping
end -- Damping.new()
function Damping:CheckNAN()
self.Velocity = V3(CheckNAN(self.Velocity.X, 0), CheckNAN(self.Velocity.Y, 0), CheckNAN(self.Velocity.Z, 0))
self.Position = V3(CheckNAN(self.Position.X, self.Goal.X), CheckNAN(self.Position.Y, self.Goal.Y), CheckNAN(self.Position.Z, self.Goal.Z))
end -- Damping:CheckNAN()
function Damping:Update()
local t = tick()
local dt = (t - self.Last)
self.Last = t
self.Velocity = (self.Velocity + (self.P * ((self.Goal - self.Position) + (-self.Velocity * self.D))))
self.Position = (self.Position + (self.Velocity * dt))
self:CheckNAN()
return self.Position
end -- Damping:Update()
function Damping:UpdateAngle()
self.Goal = (self.Position + DeltaAngleV3(self.Position, self.Goal))
return self:Update()
end -- Damping:UpdateAngle() |
-- Constants |
local Current_Camera = workspace:WaitForChild("Camera")
local Local_Player = PlayersService.LocalPlayer
|
--[[
enumList = EnumList.new(name: string, enums: string[])
enumList:Is(item)
Example:
direction = EnumList.new("Direction", {"Up", "Down", "Left", "Right"})
leftDir = direction.Left
print("IsDirection", direction:Is(leftDir))
--]] |
type EnumNames = {string}
local Symbol = require(script.Parent.Symbol)
local EnumList = {}
function EnumList.new(name: string, enums: EnumNames)
local scope = Symbol.new(name, nil)
local enumItems: {[string]: Symbol.Symbol} = {}
for _,enumName in ipairs(enums) do
enumItems[enumName] = Symbol.new(enumName, scope)
end
local self = setmetatable({
_scope = scope;
}, {
__index = function(_t, k)
if (enumItems[k]) then
return enumItems[k]
elseif (EnumList[k]) then
return EnumList[k]
else
error("Unknown " .. name .. ": " .. tostring(k), 2)
end
end;
__newindex = function()
error("Cannot add new " .. name, 2)
end;
})
return self
end
function EnumList:Is(obj: any): boolean
return Symbol.IsInScope(obj, self._scope)
end
export type EnumList = typeof(EnumList.new("", {""}))
return EnumList
|
--[[
Singleton, holds the current minigame, and constructs new minigames
]] |
local ServerStorage = game:GetService("ServerStorage")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local BaseMinigame = require(ServerStorage.Source.BaseMinigame)
local Flags = require(ReplicatedStorage.Source.Common.Flags)
local minigameModules = {
require(ServerStorage.Source.Minigames.Platform),
require(ServerStorage.Source.Minigames.Bombs),
require(ServerStorage.Source.Minigames.Volcano)
}
local nextRoundIndex = Flags.FirstRound and (Flags.FirstRound - 1) or math.random(1, #minigameModules)
local RoundController = {}
local currentMinigame
function RoundController.selectNextMinigame()
nextRoundIndex = nextRoundIndex + 1
if nextRoundIndex > #minigameModules then
nextRoundIndex = 1
end
end
function RoundController.getNextMinigame()
return minigameModules[nextRoundIndex]
end
function RoundController.initialiseMinigame()
local minigameClass = minigameModules[nextRoundIndex]
currentMinigame = BaseMinigame.new(minigameClass)
end
|
--[=[
Constructs a new DataStoreWriter. In general, you will not use this API directly.
@return DataStoreWriter
]=] |
function DataStoreWriter.new()
local self = setmetatable({}, DataStoreWriter)
self._rawSetData = {}
self._writers = {}
return self
end
|
--[=[
Subscriptions are used in the callback for an [Observable](/api/Observable). Standard usage
is as follows.
```lua
-- Constucts an observable which will emit a, b, c via a subscription
Observable.new(function(sub)
sub:Fire("a")
sub:Fire("b")
sub:Fire("c")
sub:Complete() -- ends stream
end)
```
@class Subscription
]=] |
local require = require(script.Parent.loader).load(script)
local MaidTaskUtils = require("MaidTaskUtils")
local ENABLE_STACK_TRACING = false
local Subscription = {}
Subscription.ClassName = "Subscription"
Subscription.__index = Subscription
local stateTypes = {
PENDING = "pending";
FAILED = "failed";
COMPLETE = "complete";
CANCELLED = "cancelled";
}
|
--//Configure//-- |
local EngineSound = "http://www.roblox.com/asset/?id=426479434"
local enginevolume = 3
local enginePitchAdjust = 1
local IdleSound = "http://www.roblox.com/asset/?id=426479434" --{If you dont have a separate sound, use engine sound ID}
local idlePitchAdjust = 0.9
local TurboSound = "http://www.roblox.com/asset/?id=286070281"
local turbovolume = 10
local SuperchargerSound = "http://www.roblox.com/asset/?id=404779487"
local superchargervolume = 10
local HornSound = "http://www.roblox.com/asset/?id=143133249"
local hornvolume = 4
local StartupSound = "http://www.roblox.com/asset/?id=169394147"
local startupvolume = 3
local startuplength = 0 --{adjust this for a longer startup duration}
local WHEELS_VISIBLE = false --If your wheels transparency is a problem, change this value to false
local BRAKES_VISIBLE = false --This is to hide the realistic brakes, you can set this to false if you'd like to see how the brakes work
local AUTO_FLIP = true --If false, your car will not flip itself back over in the event of a turnover
local SpeedoReading = "KPH" --{KPH, MPH}
local RevDecay = 150 --{The higher this value, the faster it will decay}
--//INSPARE//--
--//SS6//--
--//Build 1.0//--
--and i'll write your name.
script.Parent.Name = "VehicleSeat"
wait(0.1)
checker = Instance.new("Model")
checker.Name = "PGSCH"
checker.Parent = game.Workspace
checkertb = Instance.new("Part")
checkertb.Name = "Test"
checkertb.Parent = checker
checkertb.CanCollide = false
checkertb.TopSurface = Enum.SurfaceType.SmoothNoOutlines
checkertb.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
checkertb.Transparency = 0.8
checkertop = Instance.new("Part")
checkertop.Name = "Top"
checkertop.Parent = checker
checkertop.Anchored = true
checkertop.CanCollide = false
checkertop.TopSurface = Enum.SurfaceType.SmoothNoOutlines
checkertop.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
checkertop.Transparency = 0.8
checker1 = Instance.new("Attachment", checkertb)
checker2 = Instance.new("Attachment", checkertop)
checkerrope = Instance.new("RopeConstraint", checkertb)
checkerrope.Attachment0 = checker1
checkerrope.Attachment1 = checker2
checkerbf = Instance.new("BodyForce", checkertb)
checkerbf.Force = Vector3.new(0, -1000000, 0)
alertbbg = Instance.new("BillboardGui", script.Parent)
alertbbg.Size = UDim2.new(0, 500, 0, 100)
alertbbg.StudsOffset = Vector3.new(0,8,0)
alertbbg.AlwaysOnTop = true
alertbbg.Enabled = false
alerttext = Instance.new("TextLabel", alertbbg)
alerttext.BackgroundColor3 = Color3.new(97/255, 255/255, 176/255)
alerttext.BackgroundTransparency = 0.5
alerttext.TextSize = 24
alerttext.TextStrokeTransparency = 0.8
alerttext.Size = UDim2.new(1,0,1,0)
alerttext.BorderSizePixel = 0
alerttext.TextColor3 = Color3.new(1,1,1)
alerttext.TextWrapped = true
alerttext.Font = "SourceSans"
alerttext.Text = "PGSPhysicsSolver must be enabled to use this chassis! Enable this feature in the Workspace."
finesse = true
vr = 0
checker.ChildRemoved:connect(function(instance)
if finesse == true then
alertbbg.Enabled = true
vr = 1
end
end)
wait(0.35)
if vr == 0 then
finesse = false
checker:remove()
local PreS = script.Assets.PreSet:Clone()
PreS.Parent = script.Parent
PreS.Disabled = false
script.Parent:WaitForChild("PreSet")
script.Parent.CFrame = script.Parent.CFrame * CFrame.Angles(math.rad(0.59), math.rad(0), math.rad(0))
if BRAKES_VISIBLE == true then
bv = 0
else
bv = 1
end |
--[[
Functions like a hypothetical 'Instance.Destroyed' event - when the instance
is destroyed, cleans up the given task using the default `cleanup` function.
Returns a function which can be called to stop listening for destruction.
Relying on this function is dangerous - this should only ever be used when
no more suitable solution exists. In particular, it's almost certainly the
wrong solution if you're not dealing with instances passed in by the user.
NOTE: yes, this uses polling. I've been working on making this function
work better with events for months, and even then I can't avoid polling. I
just want something that works in all edge cases, even it if might not be
the theoretically best solution. This is the best choice for the short term.
You can find the 'better' version with less polling in the
`cleanupOnDestroy_smart` file if you're interested in helping out :)
]] |
local RunService = game:GetService("RunService")
local Package = script.Parent.Parent
local cleanup = require(Package.Utility.cleanup)
type TaskData = {
connection: RBXScriptConnection,
task: cleanup.Task,
cleaned: boolean
}
local function noOp()
-- intentionally blank - no operation!
end
local tasks: {TaskData} = {}
local numTasks = 0
local currentIndex = 1
|
--//Setup//-- |
local Button = script.Parent
local ID = Button.EmoteID
local EmotesHolder = Button.Parent
local CurrentAnimation = EmotesHolder.CurrentAnimation
local Action
|
--MasterControl needs access to ControlState in order to be able to fully enable and disable control |
MasterControl.ControlState = ControlState
local DynamicThumbstickModule = require(script.MasterControl:WaitForChild('DynamicThumbstick'))
local ThumbstickModule = require(script.MasterControl:WaitForChild('Thumbstick'))
local ThumbpadModule = require(script.MasterControl:WaitForChild('Thumbpad'))
local DPadModule = require(script.MasterControl:WaitForChild('DPad'))
local DefaultModule = ControlModules.Thumbstick
local TouchJumpModule = require(script.MasterControl:WaitForChild('TouchJump'))
local ClickToMoveModule = FFlagUserNoCameraClickToMove and require(script.MasterControl:WaitForChild('ClickToMoveController')) or nil
MasterControl.TouchJumpModule = TouchJumpModule
local VRNavigationModule = require(script.MasterControl:WaitForChild('VRNavigation'))
local keyboardModule = require(script.MasterControl:WaitForChild('KeyboardMovement'))
ControlModules.Gamepad = require(script.MasterControl:WaitForChild('Gamepad'))
function getTouchModule()
local module = nil
if not IsUserChoice then
if DynamicThumbstickAvailable and DevMovementMode == Enum.DevTouchMovementMode.DynamicThumbstick then
module = DynamicThumbstickModule
isJumpEnabled = false
elseif DevMovementMode == Enum.DevTouchMovementMode.Thumbstick then
module = ThumbstickModule
isJumpEnabled = true
elseif DevMovementMode == Enum.DevTouchMovementMode.Thumbpad then
module = ThumbpadModule
isJumpEnabled = true
elseif DevMovementMode == Enum.DevTouchMovementMode.DPad then
module = DPadModule
isJumpEnabled = false
elseif DevMovementMode == Enum.DevTouchMovementMode.ClickToMove then
if FFlagUserNoCameraClickToMove then
module = ClickToMoveModule
isJumpEnabled = false -- TODO: What should this be, true or false?
else
module = nil
end
elseif DevMovementMode == Enum.DevTouchMovementMode.Scriptable then
module = nil
end
else
if DynamicThumbstickAvailable and UserMovementMode == Enum.TouchMovementMode.DynamicThumbstick then
module = DynamicThumbstickModule
isJumpEnabled = false
elseif UserMovementMode == Enum.TouchMovementMode.Default or UserMovementMode == Enum.TouchMovementMode.Thumbstick then
module = ThumbstickModule
isJumpEnabled = true
elseif UserMovementMode == Enum.TouchMovementMode.Thumbpad then
module = ThumbpadModule
isJumpEnabled = true
elseif UserMovementMode == Enum.TouchMovementMode.DPad then
module = DPadModule
isJumpEnabled = false
elseif UserMovementMode == Enum.TouchMovementMode.ClickToMove then
if FFlagUserNoCameraClickToMove then
module = ClickToMoveModule
isJumpEnabled = false -- TODO: What should this be, true or false?
else
module = nil
end
end
end
return module
end
function setJumpModule(isEnabled)
if not isEnabled then
TouchJumpModule:Disable()
elseif ControlState.Current == ControlModules.Touch then
TouchJumpModule:Enable()
end
end
function setClickToMove()
if DevMovementMode == Enum.DevTouchMovementMode.ClickToMove or DevMovementMode == Enum.DevComputerMovementMode.ClickToMove or
UserMovementMode == Enum.ComputerMovementMode.ClickToMove or UserMovementMode == Enum.TouchMovementMode.ClickToMove then
if lastInputType == Enum.UserInputType.Touch then
ClickToMoveTouchControls = ControlState.Current
end
elseif ClickToMoveTouchControls then
ClickToMoveTouchControls:Disable()
ClickToMoveTouchControls = nil
end
end
ControlModules.Touch = {}
ControlModules.Touch.Current = nil
ControlModules.Touch.LocalPlayerChangedCon = nil
ControlModules.Touch.GameSettingsChangedCon = nil
function ControlModules.Touch:RefreshControlStyle()
if ControlModules.Touch.Current then
ControlModules.Touch.Current:Disable()
end
setJumpModule(false)
TouchJumpModule:Disable()
ControlModules.Touch:Enable()
end
function ControlModules.Touch:DisconnectEvents()
if ControlModules.Touch.LocalPlayerChangedCon then
ControlModules.Touch.LocalPlayerChangedCon:disconnect()
ControlModules.Touch.LocalPlayerChangedCon = nil
end
if ControlModules.Touch.GameSettingsChangedCon then
ControlModules.Touch.GameSettingsChangedCon:disconnect()
ControlModules.Touch.GameSettingsChangedCon = nil
end
end
function ControlModules.Touch:Enable()
DevMovementMode = LocalPlayer.DevTouchMovementMode
IsUserChoice = DevMovementMode == Enum.DevTouchMovementMode.UserChoice
if IsUserChoice then
UserMovementMode = GameSettings.TouchMovementMode
end
local newModuleToEnable = getTouchModule()
if newModuleToEnable then
setClickToMove()
setJumpModule(isJumpEnabled)
newModuleToEnable:Enable()
ControlModules.Touch.Current = newModuleToEnable
if isJumpEnabled then TouchJumpModule:Enable() end
end
-- This being within the above if statement was causing issues with ClickToMove, which isn't a module within this script.
ControlModules.Touch:DisconnectEvents()
ControlModules.Touch.LocalPlayerChangedCon = LocalPlayer:GetPropertyChangedSignal("DevTouchMovementMode"):connect(function()
ControlModules.Touch:RefreshControlStyle()
end)
ControlModules.Touch.GameSettingsChangedCon = GameSettings:GetPropertyChangedSignal("TouchMovementMode"):connect(function()
ControlModules.Touch:RefreshControlStyle()
end)
end
function ControlModules.Touch:Disable()
ControlModules.Touch:DisconnectEvents()
local newModuleToDisable = getTouchModule()
if newModuleToDisable == ThumbstickModule or
newModuleToDisable == DPadModule or
newModuleToDisable == ThumbpadModule or
newModuleToDisable == DynamicThumbstickModule then
newModuleToDisable:Disable()
setJumpModule(false)
TouchJumpModule:Disable()
end
-- UserMovementMode will still have the previous value at this point
if FFlagUserNoCameraClickToMove and UserMovementMode == Enum.ComputerMovementMode.ClickToMove then
ClickToMoveModule:Disable()
end
end
local function getKeyboardModule()
-- NOTE: Click to move still uses keyboard. Leaving cases in case this ever changes.
local whichModule = nil
if not IsUserChoice then
if DevMovementMode == Enum.DevComputerMovementMode.KeyboardMouse then
whichModule = keyboardModule
elseif DevMovementMode == Enum.DevComputerMovementMode.ClickToMove then
whichModule = keyboardModule
end
else
if UserMovementMode == Enum.ComputerMovementMode.KeyboardMouse or UserMovementMode == Enum.ComputerMovementMode.Default then
whichModule = keyboardModule
elseif UserMovementMode == Enum.ComputerMovementMode.ClickToMove then
whichModule = keyboardModule
end
end
return whichModule
end
ControlModules.Keyboard = {}
function ControlModules.Keyboard:RefreshControlStyle()
ControlModules.Keyboard:Disable()
ControlModules.Keyboard:Enable()
end
function ControlModules.Keyboard:Enable()
DevMovementMode = LocalPlayer.DevComputerMovementMode
IsUserChoice = DevMovementMode == Enum.DevComputerMovementMode.UserChoice
if IsUserChoice then
UserMovementMode = GameSettings.ComputerMovementMode
end
local newModuleToEnable = getKeyboardModule()
if newModuleToEnable then
newModuleToEnable:Enable()
end
if FFlagUserNoCameraClickToMove and UserMovementMode == Enum.ComputerMovementMode.ClickToMove then
ClickToMoveModule:Enable()
end
ControlModules.Keyboard:DisconnectEvents()
ControlModules.Keyboard.LocalPlayerChangedCon = LocalPlayer.Changed:connect(function(property)
if property == 'DevComputerMovementMode' then
ControlModules.Keyboard:RefreshControlStyle()
end
end)
ControlModules.Keyboard.GameSettingsChangedCon = GameSettings.Changed:connect(function(property)
if property == 'ComputerMovementMode' then
ControlModules.Keyboard:RefreshControlStyle()
end
end)
end
function ControlModules.Keyboard:DisconnectEvents()
if ControlModules.Keyboard.LocalPlayerChangedCon then
ControlModules.Keyboard.LocalPlayerChangedCon:disconnect()
ControlModules.Keyboard.LocalPlayerChangedCon = nil
end
if ControlModules.Keyboard.GameSettingsChangedCon then
ControlModules.Keyboard.GameSettingsChangedCon:disconnect()
ControlModules.Keyboard.GameSettingsChangedCon = nil
end
end
function ControlModules.Keyboard:Disable()
ControlModules.Keyboard:DisconnectEvents()
local newModuleToDisable = getKeyboardModule()
if newModuleToDisable then
newModuleToDisable:Disable()
end
-- UserMovementMode will still be set to previous movement type
if FFlagUserNoCameraClickToMove and UserMovementMode == Enum.ComputerMovementMode.ClickToMove then
ClickToMoveModule:Disable()
end
end
ControlModules.VRNavigation = {}
function ControlModules.VRNavigation:Enable()
VRNavigationModule:Enable()
end
function ControlModules.VRNavigation:Disable()
VRNavigationModule:Disable()
end
if not FFlagUserNoCameraClickToMove and IsTouchDevice then
BindableEvent_OnFailStateChanged = script.Parent:WaitForChild("OnClickToMoveFailStateChange")
end
|
--bp.Position = shelly.PrimaryPart.Position |
if not shellyGood then bp.Parent,bg.Parent= nil,nil return end
bp.Parent = nil
wait(math.random(3,8))
end
local soundBank = game.ReplicatedStorage.Sounds.NPC.Shelly:GetChildren()
shelly.Health.Changed:connect(function()
if shellyGood then
bp.Parent,bg.Parent= nil,nil
shelly.PrimaryPart.Transparency =1
shelly.PrimaryPart.CanCollide = false
shelly.Shell.Transparency = 1
shelly.HitShell.Transparency = 0
shelly.HitShell.CanCollide = true
shellyGood = false
ostrich = tick()
shelly:SetPrimaryPartCFrame(shelly.PrimaryPart.CFrame*CFrame.new(0,2,0))
local hitSound = soundBank[math.random(1,#soundBank)]:Clone()
hitSound.PlayOnRemove = true
hitSound.Parent = shelly.PrimaryPart
wait()
hitSound:Destroy()
repeat task.wait() until tick()-ostrich > 20
shelly.PrimaryPart.Transparency = 0
shelly.PrimaryPart.CanCollide = true
shelly.Shell.Transparency = 0
shelly.HitShell.Transparency = 1
shelly.HitShell.CanCollide = false
bp.Parent,bg.Parent = shelly.PrimaryPart,shelly.PrimaryPart
shellyGood = true
end
end)
while true do
if shellyGood then
MoveShelly()
else
task.wait(1)
end
end
|
--s.Pitch = 0
--[[for x = 1, 50 do
s.Pitch = s.Pitch + 0.10 1.900
s:play()
wait(0.001)
end]]
--[[Chopper level 5=1.2, Chopper level 4=1.04]] |
while s.Pitch<1 do
s.Pitch=s.Pitch+1
s:Play()
if s.Pitch>1 then
s.Pitch=1
end
wait(-9)
end
while true do
for x = 1, 500 do
s:play()
wait(-9)
end
end
|
--- me.Size=UDim2.new(0,me.AbsoluteSize.X,0,UDim2.new(0,0,0,ui.AbsoluteContentSize.Y)) |
sizeY=ui.AbsoluteContentSize.Y
sizeX=me.AbsoluteSize.X
me.Size=UDim2.new(0,sizeX,0,sizeY)
|
--Tune |
OverheatSpeed = .35 --How fast the car will overheat
CoolingEfficiency = .075 --How fast the car will cool down
RunningTemp = 85 --In degrees
Fan = true --Cooling fan
FanTemp = 105 --At what temperature the cooling fan will activate
FanSpeed = .15
FanVolume = .25
BlowupTemp = 130 --At what temperature the engine will blow up
|
--Updated 7/6/2019
--Not made by me, i just fixed some things and added a sound. | |
-- Decompiled with the Synapse X Luau decompiler. |
local u1 = nil;
coroutine.wrap(function()
u1 = require(game.ReplicatedStorage:WaitForChild("Resources"));
end)();
return function(p1, p2)
p2 = p2 or 1;
local v1 = u1.GFX.CacheProperty(p1, "TextColor3");
if v1 == Color3.new(1, 1, 1) then
p1.TextColor3 = Color3.new(v1.r / 2, v1.g / 2, v1.b / 2);
else
p1.TextColor3 = Color3.new(v1.r * 2, v1.g * 2, v1.b * 2);
end;
return u1.Functions.Tween(p1, { p2, 5, 1 }, {
TextColor3 = v1
});
end;
|
-- ================================================================================
-- VARIABLES
-- ================================================================================
-- Services |
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerScriptService = game:GetService("ServerScriptService")
local PhysicsService = game:GetService("PhysicsService")
|
--CHANGE THIS TO FALSE IF YOU DO NOT WANT TO SUPPORT THE CREATOR WITH ADVERTISEMENTS. |
local doModelAdvertisement = false |
-- 5.) Put this in MiscWeld under Weld stuff here: |
MakeWeld(car.Misc.Tach.M,car.DriveSeat,"Motor").Name="M"
ModelWeld(misc.Tach.Parts,misc.Tach.M)
|
-- << SERVICES/VARIABLES >> |
local players = game:GetService("Players")
local tweenService = game:GetService("TweenService")
local debris = game:GetService("Debris")
local hdMain = require(game:GetService("ReplicatedStorage"):WaitForChild("HDAdminSetup")):GetMain()
local hd = hdMain:GetModule("API")
local rankId = tonumber(rankAndBelowToRemove) or hd:GetRankId(rankAndBelowToRemove)
|
--[[ Main Script ]] | --
local Seat = script.Parent
Seat.ChildAdded:connect(function(Child)
if Child.Name == "SeatWeld" then
script.Parent.Parent.Union.Transparency = 1
script.Parent.Parent.open.Transparency = 0
end
end)
Seat.ChildRemoved:connect(function(child)
if child.Name == "SeatWeld" then
script.Parent.Parent.Union.Transparency = 0
script.Parent.Parent.open.Transparency = 01
end
end)
|
--Combat Variables-- |
local munition = combat.resetMunition()
local lastAttack = tick()
local target = nil
if not _G.ApachePathing then
pathing.init()
end
function takeOff()
startEngine()
criticalAction = true
while flight.checkHeight(desiredHeight) == 1 do
wait(0.2)
end
criticalAction = false
end
function startEngine()
bp.Position = body.Position
bp.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
bg.CFrame = myRoot.CFrame
bg.MaxTorque = bgTorque
body.BackBladeHinge.AngularVelocity = 1000
body.FrontBladeHinge.AngularVelocity = 1000
local soundTween = game:GetService("TweenService"):Create(body.Sound,TweenInfo.new(5),{Volume = 1})
soundTween:Play()
wait(5)
engineRunning = true
end
function killEngine()
engineRunning = false
bp.MaxForce = Vector3.new()
body.BackBladeHinge.AngularVelocity = 0
body.FrontBladeHinge.AngularVelocity = 0
body.FrontBladeHinge.AngularSpeed = 0
game:GetService("TweenService"):Create(script.Parent["Main Propeller"],TweenInfo.new(5),{AssemblyAngularVelocity = Vector3.new()}):Play()
local soundTween = game:GetService("TweenService"):Create(body.Sound,TweenInfo.new(5),{Volume = 0})
soundTween:Play()
wait(5)
bg.MaxTorque = Vector3.new()
end
function findTurns(waypoints)
local importantWaypoints = {}
table.insert(importantWaypoints,waypoints[1])
local index = 0
local canseeIndex = 1
local currentWaypoint = importantWaypoints[1]
while true do
if canseeIndex ~= #waypoints then
local lookCFrame = CFrame.lookAt(currentWaypoint.Position,waypoints[canseeIndex].Position)
for offset = -15, 15, 5 do
local params = RaycastParams.new()
params.FilterDescendantsInstances = {script.Parent}
local tempCFrame = lookCFrame * CFrame.new(offset,0,0)
local dist = core.checkDist(tempCFrame.Position,waypoints[canseeIndex])
local result = workspace:Raycast(tempCFrame.Position,tempCFrame.LookVector*dist,params)
if result then
currentWaypoint = waypoints[canseeIndex]
table.insert(importantWaypoints,waypoints[canseeIndex-1])
break
end
end
canseeIndex = canseeIndex + 1
else
table.insert(importantWaypoints,waypoints[canseeIndex])
break
end
end
return importantWaypoints
end
function flyPath(pos)
local waypoints = pathing.findPath(myRoot.Position,pos)
if not waypoints then
warn("No valid path to target")
wait(30)
return false
end
waypoints = findTurns(waypoints)
local timeout = core.checkDist(myRoot,pos)
local killPath = false
if waypoints then
for _,waypoint in ipairs(waypoints) do
local currentTarget = target
--While flying to next point
while not flight.flyToPos(waypoint.Position) and not dodgingObstacles.Value do
if currentTarget ~= target or (target and not combat.getMunition(munition)) then
killPath = true
break
end
timeout = timeout - 1
if timeout < 0 then
killPath = true
break
end
wait()
end
if killPath then
break
end
end
end
end
function combatFlight()
if core.checkSight(target) then
local turnAngle = core.findAngle(myRoot.Position,target.Position,myRoot)
if core.checkDistXZ(myRoot,target) > 25 then
--Angles the helicopter to fly towards the target
flight.flyTowards(-35,-turnAngle)
else
flight.flyTowards(0,-turnAngle)
end
else
flyPath(target.Position)
end
--When too close to target fly forward to gain some distance
if target and core.checkDistXZ(target,myRoot) < 50 then
for i = 1, 20 do
wait()
flight.flyTowards(-25,0)
if dodgingObstacles.Value then
break
end
end
end
end
function flyHome()
local params = RaycastParams.new()
params.FilterDescendantsInstances = {script.Parent}
local dist = (myRoot.Position-home.Position).Magnitude
local result = workspace:Raycast(myRoot.Position,(home.Position - myRoot.Position).Unit * dist, params)
if not result then
if flight.flyToPos(home.Position) then
criticalAction = true
engineRunning = false
flight.land(home)
--Once we completely land we are available for other missions
if core.checkDist(home.Position,myRoot) < 30 then
criticalAction = false
munition = combat.resetMunition()
killEngine()
end
end
else
flyPath(home.Position)
end
end
function crash()
body.BladeAttach.Smoke.Enabled = true
body.RearBladeAttach.Smoke.Enabled = true
flight.flyTowards(math.random(-80,80),nil,math.random(-80,80))
for i = 1, math.random(4,10) do
local posX = math.random(-body.Size.X,body.Size.X)
local posY = math.random(-body.Size.Y,body.Size.Y)
local posZ = math.random(-body.Size.Z,body.Size.Z)/3
local pos = Vector3.new(posX,posY,posZ)
pos = pos/2
local attach = Instance.new("Attachment")
attach.Parent = body
attach.Position = pos
local fire = Instance.new("Fire")
--fire.Parent = attach
fire.Size = math.random(3,8)
fire.Heat = math.random(math.random(10,20))
end
bg.MaxTorque = Vector3.new(100,100,100)
local crashSpeed = math.random(1,3)/5
local crashed = false
body.Touched:Connect(function(part)
if part:GetMass() > 50 or part:IsGrounded() then
crashed = true
end
end)
local maxIterations = 200
while not crashed do
flight.physics()
bp.Position = bp.Position - Vector3.new(0,crashSpeed,0)
maxIterations = maxIterations - 1
if maxIterations < 0 then
break
end
wait()
end
body.Sound:Stop()
bp:Destroy()
bg:Destroy()
body.FrontBladeHinge:Destroy()
body.BackBladeHinge:Destroy()
script.Parent["Main Propeller"].CanCollide = false
local x = Instance.new("Explosion")
x.Parent = myRoot
x.BlastRadius = 50
x.BlastPressure = 0
x.DestroyJointRadiusPercent = 0
x.Position = myRoot.Position
end
|
--[=[
@param keyCode Enum.KeyCode
@return isDown: boolean
Returns `true` if the key is down.
```lua
local w = keyboard:IsKeyDown(Enum.KeyCode.W)
if w then ... end
```
]=] |
function Keyboard:IsKeyDown(keyCode)
return UserInputService:IsKeyDown(keyCode)
end
|
--[[ TELEPORT SERVICE ]] | --
if (game.VIPServerId ~= "" and game.VIPServerOwnerId == 0) then
warn("Booting Server !")
local waitTime = 30
Players.PlayerAdded:connect(function(player)
wait(waitTime)
waitTime = waitTime / 2
TeleportService:Teleport(game.PlaceId, player)
end)
for _,player in pairs(Players:GetPlayers()) do
TeleportService:Teleport(game.PlaceId, player)
wait(waitTime)
waitTime = waitTime / 2
end
else
game:BindToClose(function()
local con
if (#Players:GetPlayers() == 0) then
return
end
if (game:GetService("RunService"):IsStudio()) then
return
end
for i,v in pairs(game.Players:GetChildren()) do
AddUI(v)
end
con = Players.PlayerAdded:connect(function(v)
wait(1)
AddUI(v)
end)
wait(15)
con:Disconnect()
local reservedServerCode = TeleportService:ReserveServer(game.PlaceId)
for _,player in pairs(Players:GetPlayers()) do
TeleportService:TeleportToPrivateServer(game.PlaceId, reservedServerCode, { player })
end
Players.PlayerAdded:connect(function(player)
TeleportService:TeleportToPrivateServer(game.PlaceId, reservedServerCode, { player })
end)
while (#Players:GetPlayers() > 0) do
wait(1)
end
end)
end
|
--[[[Default Controls]] |
--Peripheral Deadzones
Tune.Peripherals = {
MSteerWidth = 67 , -- Mouse steering control width (0 - 100% of screen width)
MSteerDZone = 10 , -- Mouse steering deadzone (0 - 100%)
ControlLDZone = 5 , -- Controller steering L-deadzone (0 - 100%)
ControlRDZone = 5 , -- Controller steering R-deadzone (0 - 100%)
}
--Control Mapping
Tune.Controls = {
--Keyboard Controls
--Mode Toggles
ToggleTCS = Enum.KeyCode.T ,
ToggleABS = Enum.KeyCode.Y ,
ToggleTransMode = Enum.KeyCode.M ,
ToggleMouseDrive = Enum.KeyCode.R ,
--Primary Controls
Throttle = Enum.KeyCode.Up ,
Brake = Enum.KeyCode.Down ,
SteerLeft = Enum.KeyCode.Left ,
SteerRight = Enum.KeyCode.Right ,
--Secondary Controls
Throttle2 = Enum.KeyCode.W ,
Brake2 = Enum.KeyCode.S ,
SteerLeft2 = Enum.KeyCode.A ,
SteerRight2 = Enum.KeyCode.D ,
--Manual Transmission
ShiftUp = Enum.KeyCode.E ,
ShiftDown = Enum.KeyCode.Q ,
Clutch = Enum.KeyCode.LeftShift ,
--Handbrake
PBrake = Enum.KeyCode.LeftShift ,
--Mouse Controls
MouseThrottle = Enum.UserInputType.MouseButton1 ,
MouseBrake = Enum.UserInputType.MouseButton2 ,
MouseClutch = Enum.KeyCode.W ,
MouseShiftUp = Enum.KeyCode.E ,
MouseShiftDown = Enum.KeyCode.Q ,
MousePBrake = Enum.KeyCode.LeftShift ,
--Controller Mapping
ContlrThrottle = Enum.KeyCode.ButtonR2 ,
ContlrBrake = Enum.KeyCode.ButtonL2 ,
ContlrSteer = Enum.KeyCode.Thumbstick1 ,
ContlrShiftUp = Enum.KeyCode.ButtonY ,
ContlrShiftDown = Enum.KeyCode.ButtonX ,
ContlrClutch = Enum.KeyCode.ButtonR1 ,
ContlrPBrake = Enum.KeyCode.ButtonL1 ,
ContlrToggleTMode = Enum.KeyCode.ButtonB ,
ContlrToggleTCS = Enum.KeyCode.DPadDown ,
ContlrToggleABS = Enum.KeyCode.ButtonL3 ,
}
|
-- Postdeath gui |
local postDeathGui = PostDeathGui.new()
local postDeathGuiFrame = postDeathGui:createFrame(PostDeath)
|
--[[Susupension]] |
Tune.SusEnabled = true -- works only in with PGSPhysicsSolverEnabled, defaults to false when PGS is disabled
--Front Suspension
Tune.FSusDamping = 500 -- Spring Dampening
Tune.FSusStiffness = 9000 -- Spring Force
Tune.FSusLength = 2 -- Suspension length (in studs)
Tune.FSusMaxExt = .3 -- Max Extension Travel (in studs)
Tune.FSusMaxComp = .1 -- Max Compression Travel (in studs)
Tune.FSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.FWsBoneLen = 5 -- Wishbone Length
Tune.FWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.FAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Rear Suspension
Tune.RSusDamping = 500 -- Spring Dampening
Tune.RSusStiffness = 9000 -- Spring Force
Tune.RSusLength = 2 -- Suspension length (in studs)
Tune.RSusMaxExt = .3 -- Max Extension Travel (in studs)
Tune.RSusMaxComp = .1 -- Max Compression Travel (in studs)
Tune.RSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.RWsBoneLen = 5 -- Wishbone Length
Tune.RWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.RAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Aesthetics
Tune.SusVisible = true -- Spring Visible
Tune.WsBVisible = false -- Wishbone Visible
Tune.SusRadius = .2 -- Suspension Coil Radius
Tune.SusThickness = .1 -- Suspension Coil Thickness
Tune.SusColor = "Bright red" -- Suspension Color [BrickColor]
Tune.SusCoilCount = 6 -- Suspension Coil Count
Tune.WsColor = "Black" -- Wishbone Color [BrickColor]
Tune.WsThickness = .1 -- Wishbone Rod Thickness
|
--[=[
@within TableUtil
@function Copy
@param tbl table -- Table to copy
@param deep boolean? -- Whether or not to perform a deep copy
@return table
Creates a copy of the given table. By default, a shallow copy is
performed. For deep copies, a second boolean argument must be
passed to the function.
:::caution No cyclical references
Deep copies are _not_ protected against cyclical references. Passing
a table with cyclical references _and_ the `deep` parameter set to
`true` will result in a stack-overflow.
]=] |
local function Copy(t: Table, deep: boolean?): Table
if not deep then
return table.clone(t)
end
local function DeepCopy(tbl)
local tCopy = table.clone(tbl)
for k,v in pairs(tCopy) do
if type(v) == "table" then
tCopy[k] = DeepCopy(v)
end
end
return tCopy
end
return DeepCopy(t)
end
|
--> Variables |
local XPPerLevel = GameConfig.XPPerLevel
local PlayerLeveling = {}
|
--edit the function below to return true when you want this response/prompt to be valid
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data |
return function(player, dialogueFolder)
local plrData = require(game.ReplicatedStorage.Source.Modules.Util):GetPlayerData(player)
return plrData.Classes.Base.Paladin.JumpStrike1.Value ~= true or plrData.Classes.Base.Paladin.XP.Value < 150
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.