prompt
stringlengths
2
14.7k
completion
stringlengths
1
99.7k
-- print("===> " .. string.sub(msg, 1, 3) .. "(" .. emote .. ")")
end) if not script:FindFirstChild("pose") then local p = Instance.new("StringValue"); p.Name = 'pose'; p.Parent = script; end script.pose.Changed:connect(function() pose = script.pose.Value; playAnimation(pose, .1, Humanoid); end)
--------RIGHT DOOR --------
game.Workspace.doorright.l13.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value) game.Workspace.doorright.l23.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value) game.Workspace.doorright.l33.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value) game.Workspace.doorright.l43.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value) game.Workspace.doorright.l53.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value) game.Workspace.doorright.l63.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value) game.Workspace.doorright.l73.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
--------------------------- --Seat Offset (Make copies of this block for passenger seats)
car.DriveSeat.ChildAdded:connect(function(child) if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then child.C0=CFrame.new(-1.6,-.5,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0) end end)
-------------------------
mouse.KeyDown:connect(function (key) key = string.lower(key) if key == "k" then --Camera controls if cam == ("car") then Camera.CameraSubject = player.Character.Humanoid Camera.CameraType = ("Custom") cam = ("freeplr") Camera.FieldOfView = 70 player.Character.Humanoid.CameraOffset = Vector3.new(-0.17, 0.25, -0.2) limitButton.Text = "Free Camera" wait(3) limitButton.Text = "" elseif cam == ("freeplr") then Camera.CameraSubject = player.Character.Humanoid Camera.CameraType = ("Attach") cam = ("lockplr") Camera.FieldOfView = 70 player.Character.Humanoid.CameraOffset = Vector3.new(-0.17, 0.25, -0.2) limitButton.Text = "FPV Camera" wait(3) limitButton.Text = "" elseif cam == ("lockplr") then Camera.CameraSubject = carSeat Camera.CameraType = ("Custom") cam = ("car") Camera.FieldOfView = 70 player.Character.Humanoid.CameraOffset = Vector3.new(0, 0, 0) limitButton.Text = "Standard Camera" wait(3) limitButton.Text = "" end end end)
----------------- --| Variables |-- -----------------
local DebrisService = Game:GetService('Debris') local PlayersService = Game:GetService('Players') local Rocket = script.Parent local CreatorTag = Rocket:WaitForChild('creator') local Tank = Rocket:WaitForChild('Tank').Value
-- Require this module on the client. Use it to control the focus of the camera onto screens.
-- Slider sizes (Max)
local maxSize = UDim2.new(0.99, 0, 1, 0)
--[[ Public API ]]
-- function MasterControl:Init() local renderStepFunc = function() if LocalPlayer and LocalPlayer.Character then local humanoid = getHumanoid() if not humanoid then return end if humanoid and not humanoid.PlatformStand and isJumping and _G.CanJump then humanoid.Jump = isJumping end _G.pMoveValue = moveValue; moveFunc(LocalPlayer, moveValue, true) end end local success = pcall(function() RunService:BindToRenderStep("MasterControlStep", Enum.RenderPriority.Input.Value, renderStepFunc) end) if not success then if RenderSteppedCon then return end RenderSteppedCon = RunService.RenderStepped:connect(renderStepFunc) end end function MasterControl:Disable() local success = pcall(function() RunService:UnbindFromRenderStep("MasterControlStep") end) if not success then if RenderSteppedCon then RenderSteppedCon:disconnect() RenderSteppedCon = nil end end moveValue = Vector3.new(0,0,0) isJumping = false end function MasterControl:AddToPlayerMovement(playerMoveVector) moveValue = Vector3.new(moveValue.X + playerMoveVector.X, moveValue.Y + playerMoveVector.Y, moveValue.Z + playerMoveVector.Z) end function MasterControl:GetMoveVector() return moveValue end function MasterControl:SetIsJumping(jumping) isJumping = jumping end function MasterControl:DoJump() local humanoid = getHumanoid() if humanoid and _G.CanJump then print(_G.CanJump); humanoid.Jump = true end end return MasterControl
--[[Susupension]]
Tune.SusEnabled = true -- works only in with PGSPhysicsSolverEnabled, defaults to false when PGS is disabled --Front Suspension Tune.FSusDamping = 500 -- Spring Dampening Tune.FSusStiffness = 9000 -- Spring Force Tune.FSusLength = 2 -- Suspension length (in studs) Tune.FSusMaxExt = .2 -- Max Extension Travel (in studs) Tune.FSusMaxComp = .2 -- Max Compression Travel (in studs) Tune.FSusAngle = 80 -- Suspension Angle (degrees from horizontal) Tune.FWsBoneLen = 5 -- Wishbone Length Tune.FWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal) Tune.FAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel) --[[Lateral]] -.4 , -- positive = outward --[[Vertical]] -.5 , -- positive = upward --[[Forward]] 0 } -- positive = forward --Rear Suspension Tune.RSusDamping = 500 -- Spring Dampening Tune.RSusStiffness = 9000 -- Spring Force Tune.RSusLength = 2 -- Suspension length (in studs) Tune.RSusMaxExt = .3 -- Max Extension Travel (in studs) Tune.RSusMaxComp = .1 -- Max Compression Travel (in studs) Tune.RSusAngle = 80 -- Suspension Angle (degrees from horizontal) Tune.RWsBoneLen = 5 -- Wishbone Length Tune.RWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal) Tune.RAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel) --[[Lateral]] -.4 , -- positive = outward --[[Vertical]] -.5 , -- positive = upward --[[Forward]] 0 } -- positive = forward --Aesthetics Tune.SusVisible = true -- Spring Visible Tune.WsBVisible = false -- Wishbone Visible Tune.SusRadius = .2 -- Suspension Coil Radius Tune.SusThickness = .1 -- Suspension Coil Thickness Tune.SusColor = "Really black" -- Suspension Color [BrickColor] Tune.SusCoilCount = 6 -- Suspension Coil Count Tune.WsColor = "Black" -- Wishbone Color [BrickColor] Tune.WsThickness = .1 -- Wishbone Rod Thickness
-- Decompiled with the Synapse X Luau decompiler.
local l__Players__1 = game:GetService("Players"); local v2 = l__Players__1.LocalPlayer; if not v2 then l__Players__1:GetPropertyChangedSignal("LocalPlayer"):Wait(); v2 = l__Players__1.LocalPlayer; end; local u1 = false; local u2 = nil; local u3 = UDim2.new(0, 80, 0, 58); local u4 = Color3.fromRGB(32, 32, 32); local u5 = Color3.fromRGB(200, 200, 200); local u6 = (function(p1, p2) local v3 = p1:FindFirstChildOfClass(p2); while not v3 or v3.ClassName ~= p2 do v3 = p1.ChildAdded:Wait(); end; return v3; end)(v2, "PlayerGui"); local u7 = nil; local u8 = nil; local u9 = nil; local u10 = nil; local v4 = {}; local function u11() assert(not u1, "initializeUI called when already initialized"); local u12 = "ScreenGui"; u12 = { Name = "RbxCameraUI", AutoLocalize = false, Enabled = true, DisplayOrder = -1, IgnoreGuiInset = false, ResetOnSpawn = false, ZIndexBehavior = Enum.ZIndexBehavior.Sibling }; local u13 = "ImageLabel"; u13 = { Name = "Toast", Visible = false, AnchorPoint = Vector2.new(0.5, 0), BackgroundTransparency = 1, BorderSizePixel = 0, Position = UDim2.new(0.5, 0, 0, 8), Size = u3, Image = "rbxasset://textures/ui/Camera/CameraToast9Slice.png", ImageColor3 = u4, ImageRectSize = Vector2.new(6, 6), ImageTransparency = 1, ScaleType = Enum.ScaleType.Slice, SliceCenter = Rect.new(3, 3, 3, 3), ClipsDescendants = true }; local u14 = "Frame"; u14 = { Name = "IconBuffer", BackgroundTransparency = 1, BorderSizePixel = 0, Position = UDim2.new(0, 0, 0, 0), Size = UDim2.new(0, 80, 1, 0) }; local u15 = "ImageLabel"; u15 = { Name = "Icon", AnchorPoint = Vector2.new(0.5, 0.5), BackgroundTransparency = 1, Position = UDim2.new(0.5, 0, 0.5, 0), Size = UDim2.new(0, 48, 0, 48), ZIndex = 2, Image = "rbxasset://textures/ui/Camera/CameraToastIcon.png", ImageColor3 = u5, ImageTransparency = 1 }; u14[1] = (function(p3) local v5 = Instance.new(u15); p3.Parent = nil; local v6, v7, v8 = pairs(p3); while true do local v9 = nil; local v10 = nil; v10, v9 = v6(v7, v8); if not v10 then break; end; v8 = v10; if type(v10) == "string" then v5[v10] = v9; else v9.Parent = v5; end; end; v5.Parent = p3.Parent; return v5; end)(u15); local u16 = "Frame"; u14 = function(p4) local v11 = Instance.new(u16); p4.Parent = nil; local v12, v13, v14 = pairs(p4); while true do local v15 = nil; local v16 = nil; v16, v15 = v12(v13, v14); if not v16 then break; end; v14 = v16; if type(v16) == "string" then v11[v16] = v15; else v15.Parent = v11; end; end; v11.Parent = p4.Parent; return v11; end; u16 = { Name = "TextBuffer", BackgroundTransparency = 1, BorderSizePixel = 0, Position = UDim2.new(0, 80, 0, 0), Size = UDim2.new(1, -80, 1, 0), ClipsDescendants = true }; local u17 = "TextLabel"; u15 = function(p5) local v17 = Instance.new(u17); p5.Parent = nil; local v18, v19, v20 = pairs(p5); while true do local v21 = nil; local v22 = nil; v22, v21 = v18(v19, v20); if not v22 then break; end; v20 = v22; if type(v22) == "string" then v17[v22] = v21; else v21.Parent = v17; end; end; v17.Parent = p5.Parent; return v17; end; u17 = { Name = "Upper", AnchorPoint = Vector2.new(0, 1), BackgroundTransparency = 1, Position = UDim2.new(0, 0, 0.5, 0), Size = UDim2.new(1, 0, 0, 19), Font = Enum.Font.GothamMedium, Text = "Camera control enabled", TextColor3 = u5, TextTransparency = 1, TextSize = 19, TextXAlignment = Enum.TextXAlignment.Left, TextYAlignment = Enum.TextYAlignment.Center }; u15 = u15(u17); local u18 = "TextLabel"; u17 = function(p6) local v23 = Instance.new(u18); p6.Parent = nil; local v24, v25, v26 = pairs(p6); while true do local v27 = nil; local v28 = nil; v28, v27 = v24(v25, v26); if not v28 then break; end; v26 = v28; if type(v28) == "string" then v23[v28] = v27; else v27.Parent = v23; end; end; v23.Parent = p6.Parent; return v23; end; u18 = { Name = "Lower", AnchorPoint = Vector2.new(0, 0), BackgroundTransparency = 1, Position = UDim2.new(0, 0, 0.5, 3), Size = UDim2.new(1, 0, 0, 15), Font = Enum.Font.Gotham, Text = "Right mouse button to toggle", TextColor3 = u5, TextTransparency = 1, TextSize = 15, TextXAlignment = Enum.TextXAlignment.Left, TextYAlignment = Enum.TextYAlignment.Center }; u16[1] = u15; u16[2] = u17(u18); u13[1] = (function(p7) local v29 = Instance.new(u14); p7.Parent = nil; local v30, v31, v32 = pairs(p7); while true do local v33 = nil; local v34 = nil; v34, v33 = v30(v31, v32); if not v34 then break; end; v32 = v34; if type(v34) == "string" then v29[v34] = v33; else v33.Parent = v29; end; end; v29.Parent = p7.Parent; return v29; end)(u14); u13[2] = u14(u16); u12[1] = (function(p8) local v35 = Instance.new(u13); p8.Parent = nil; local v36, v37, v38 = pairs(p8); while true do local v39 = nil; local v40 = nil; v40, v39 = v36(v37, v38); if not v40 then break; end; v38 = v40; if type(v40) == "string" then v35[v40] = v39; else v39.Parent = v35; end; end; v35.Parent = p8.Parent; return v35; end)(u13); u13 = u6; u12.Parent = u13; u2 = (function(p9) local v41 = Instance.new(u12); p9.Parent = nil; local v42, v43, v44 = pairs(p9); while true do local v45 = nil; local v46 = nil; v46, v45 = v42(v43, v44); if not v46 then break; end; v44 = v46; if type(v46) == "string" then v41[v46] = v45; else v45.Parent = v41; end; end; v41.Parent = p9.Parent; return v41; end)(u12); u12 = u2; u7 = u12.Toast; u12 = u7.IconBuffer; u8 = u12.Icon; u12 = u7.TextBuffer; u9 = u12.Upper; u12 = u7.TextBuffer; u10 = u12.Lower; u1 = true; end; function v4.setCameraModeToastEnabled(p10) if not p10 and not u1 then return; end; if not u1 then u11(); end; u7.Visible = p10; if not p10 then v4.setCameraModeToastOpen(false); end; end; local l__TweenService__19 = game:GetService("TweenService"); local u20 = TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out); local u21 = UDim2.new(0, 326, 0, 58); function v4.setCameraModeToastOpen(p11) assert(u1); local v47 = { Size = p11 and u21 or u3 }; if p11 then local v48 = 0.4; else v48 = 1; end; v47.ImageTransparency = v48; l__TweenService__19:Create(u7, u20, v47):Play(); local v49 = {}; if p11 then local v50 = 0; else v50 = 1; end; v49.ImageTransparency = v50; l__TweenService__19:Create(u8, u20, v49):Play(); local v51 = {}; if p11 then local v52 = 0; else v52 = 1; end; v51.TextTransparency = v52; l__TweenService__19:Create(u9, u20, v51):Play(); local v53 = {}; if p11 then local v54 = 0; else v54 = 1; end; v53.TextTransparency = v54; l__TweenService__19:Create(u10, u20, v53):Play(); end; return v4;
--[[ Remove elements from a dictionary ]]
function Immutable.RemoveFromDictionary(dictionary, ...) local result = {} for key, value in next, dictionary do local found = false for listKey = 1, select("#", ...) do if key == select(listKey, ...) then found = true break end end if not found then result[key] = value end end return result end
--[[ ]]
local ReplicatedStorage = game:GetService("ReplicatedStorage") local AvatarEditor = ReplicatedStorage.AvatarEditor local QueryMap = require(AvatarEditor.Shared.QueryMap) local Signal = require(AvatarEditor.Shared.Util.Signal) local Maid = require(AvatarEditor.Shared.Util.Maid) local Settings = require(AvatarEditor.Shared.Settings) local Cache = require(AvatarEditor.Shared.Cache) local Theme = require(AvatarEditor.Client.Theme) local buttonTemplate = require(AvatarEditor.Gui.ButtonTemplateToLua)() local cache = Cache.new(Settings.CACHE_SIZE) local Class = {} Class.__index = Class local function copy(array) local new = {} table.move(array, 1, #array, 1, new) return new end local function getCacheKey(pattern, assetType, wearing, uid) local key = string.format("%s, %s, %s, %s", QueryMap.GetOptionName("AssetType", assetType), tostring(wearing), uid, pattern) return key end local function getFromCache(pattern, assetType, wearing, uid) local key = getCacheKey(pattern, assetType, wearing, uid) return cache:Get(key) end local function createCache(pattern, assetType, wearing, uid, list) local key = getCacheKey(pattern, assetType, wearing, uid) list = copy(list) cache:Set(key, list) end local function sort(list) table.sort(list, function(a, b) return a._name < b._name end) end function stringMatch(str, pattern) local patternIndex = 1 local patternLength = #pattern local strIndex = 1 local strLength = #str while patternIndex <= patternLength and strIndex <= strLength do local patternChar = pattern:sub(patternIndex, patternIndex):lower() local strChar = str:sub(strIndex, strIndex):lower() if patternChar == strChar then patternIndex = patternIndex + 1 end strIndex = strIndex + 1 end return patternLength > 0 and strLength > 0 and (patternIndex - 1) == patternLength end local function createButton() local button = buttonTemplate:Clone() return button end local function isWearing(assets, id) return assets[id] end function Class.new(scrollingFrame, catalogData, wearingAssets, searchState) local self = setmetatable({}, Class) self.ScrollingFrame = scrollingFrame self.All = catalogData self.List = catalogData self.Wearing = wearingAssets self.PageSize = Settings.PAGE_SIZE self.MaxPageSize = Settings.PAGE_SIZE self.GridLayout = scrollingFrame.UIGridLayout self.Maid = Maid.new() self.Listeners = Maid.new() self.Children = {} self.Pool = {} self.State = searchState self.ItemSelected = Signal.new() self.ViewDetails = Signal.new() for i = 1, 50 do self.Pool[i] = createButton() end self.Maid:GiveTask(Theme.Changed:Connect(function() self:Render() end)) self.Maid:GiveTask(Theme:Bind(scrollingFrame, "ScrollBarImageColor3", "Scrollbar")) self.Maid:GiveTask(self.ScrollingFrame:GetPropertyChangedSignal("CanvasPosition"):Connect(function() local currentPageSize = self.PageSize local uiGridLayout = self.GridLayout -- i think indexing AbsoluteContentSize is really intensive especially on larger AbsoluteContentSize local scrollEnough = scrollingFrame.CanvasPosition.Y >= uiGridLayout.AbsoluteContentSize.Y - scrollingFrame.AbsoluteSize.Y - 10 if scrollEnough then local newPageSize = math.min(currentPageSize + Settings.PAGE_SIZE, self.MaxPageSize) if newPageSize ~= currentPageSize then self.PageSize = newPageSize self:Update() end end end)) for i, v in ipairs(self.All) do v._name = v.name:lower() v._wearing = isWearing(self.Wearing, v.id) end return self end function Class:GetItem() local pool = self.Pool local button = table.remove(pool, #pool) if not button then button = createButton() end return button end function Class:Render() local maid = self.Listeners local catalogList = self.List local children = self.Children local scrollingFrame = self.ScrollingFrame local uiGridLayout = self.GridLayout local pool = self.Pool local newChildren = table.create(1000) maid:DoCleaning() for i, v in ipairs(catalogList) do local button = children[i] or self:GetItem() button.LayoutOrder = i button.ItemLabel.Text = v.name button.Icon.Image = "rbxthumb://type=Asset&id=" .. v.id .. "&w=150&h=150" button.ItemLabel.Visible = false button.Wearing.Visible = v._wearing button.More.Visible = false newChildren[i] = button maid:GiveTask(Theme:Bind(button, "BackgroundColor3", "Button")) maid:GiveTask(Theme:Bind(button.ItemLabel, "TextColor3", "Text")) maid:GiveTask(Theme:Bind(button.ItemLabel, "TextStrokeColor3", "TextStroke")) maid:GiveTask(Theme:Bind(button.More, "BackgroundColor3", "Details")) maid:GiveTask(Theme:Bind(button.More, "TextColor3", "Text")) maid:GiveTask(Theme:Bind(button.Wearing, "BackgroundColor3", "Wearing")) maid:GiveTask(button.More.Activated:Connect(function(inputObject) self.ViewDetails:Fire(v) end)) maid:GiveTask(button.TouchLongPress:Connect(function(touchPositions, inputState) button.ItemLabel.Visible = false button.More.Visible = false self.ViewDetails:Fire(v) end)) maid:GiveTask(button.Activated:Connect(function(inputObject) self.ItemSelected:Fire(v, v._wearing) end)) maid:GiveTask(button.InputBegan:Connect(function(inputObject) if not Settings.HOVER_INPUTS[inputObject.UserInputType] then return end button.ItemLabel.Visible = true if inputObject.UserInputType == Enum.UserInputType.MouseMovement then button.More.Visible = true end end)) maid:GiveTask(button.InputEnded:Connect(function(inputObject) if not Settings.HOVER_INPUTS[inputObject.UserInputType] then return end button.ItemLabel.Visible = false button.More.Visible = false end)) button.Parent = scrollingFrame end for i = #catalogList + 1, #children do local button = children[i] button.Parent = nil table.insert(pool, button) end self.Children = newChildren scrollingFrame.CanvasSize = UDim2.new(0, 0, 0, uiGridLayout.AbsoluteContentSize.Y) end function Class:Search(list, pattern, assetType, wearing, uid) local results = table.create(10000) -- umm yeaaa if pattern == "" then if wearing then for i, v in ipairs(list) do if v._wearing then table.insert(results, v) end end else for i, v in ipairs(list) do if v.assetType == assetType then table.insert(results, v) end end end else if wearing then for i, v in ipairs(list) do if stringMatch(v._name, pattern) and v._wearing then table.insert(results, v) end end else for i, v in ipairs(list) do if stringMatch(v._name, pattern) and v.assetType == assetType then table.insert(results, v) end end end end return results end function Class:Update(reset) local scrollingFrame = self.ScrollingFrame local state = self.State if reset then self.PageSize = Settings.PAGE_SIZE self.MaxPageSize = Settings.PAGE_SIZE scrollingFrame.CanvasPosition = Vector2.new(0, 0) end local filteredItems = {} local cacheResults = getFromCache(state.search, state.assetType, state.wearing, state.uid) if cacheResults then self.MaxPageSize = #cacheResults for i = 1, self.PageSize do table.insert(filteredItems, i, cacheResults[i]) end createCache(state.search, state.assetType, state.wearing, state.uid, cacheResults) else local searchResults = self:Search(self.All, state.search, state.assetType, state.wearing, state.uid) sort(searchResults) self.MaxPageSize = #searchResults for i = 1, self.PageSize do table.insert(filteredItems, i, searchResults[i]) end createCache(state.search, state.assetType, state.wearing, state.uid, searchResults) end self.List = filteredItems self:Render() end function Class:UpdateWearing(wearingAssets) self.Wearing = wearingAssets for i, v in ipairs(self.All) do v._wearing = isWearing(self.Wearing, v.id) end self:Render() end function Class:Destroy() self.ScrollingFrame.CanvasPosition = Vector2.new(0, 0) self.ScrollingFrame = nil self.All = nil self.List = nil self.Wearing = nil self.PageSize = nil self.MaxPageSize = nil self.GridLayout = nil self.Maid:DoCleaning() self.Maid = nil self.Listeners:DoCleaning() self.Listeners = nil for i, v in ipairs(self.Children) do v:Destroy() end table.clear(self.Children) for i, v in ipairs(self.Pool) do v:Destroy() end table.clear(self.Pool) self.State = nil self.ItemSelected:Destroy() self.ItemSelected = nil self.ViewDetails:Destroy() self.ViewDetails = nil end return Class
--[[ NOTES - CenterWeld CFrame : CFrame.new(0,1.5,-5) - CFrame.new(-7,2,-2) SOL math.rad(45) - CFrame.new(7,2,-2) SAG math.rad(-45) --]] --// Variables \\-- ---(
local center = Instance.new("Part") local left = Instance.new("Part") local right = Instance.new("Part")
--[[ Functions of BaseCamera that are overridden by OrbitalCamera ]]
-- function OrbitalCamera:GetCameraToSubjectDistance() return self.curDistance end function OrbitalCamera:SetCameraToSubjectDistance(desiredSubjectDistance) local player = PlayersService.LocalPlayer if player then self.currentSubjectDistance = math.clamp(desiredSubjectDistance, self.minDistance, self.maxDistance) -- OrbitalCamera is not allowed to go into the first-person range self.currentSubjectDistance = math.max(self.currentSubjectDistance, self.FIRST_PERSON_DISTANCE_THRESHOLD) end self.inFirstPerson = false self:UpdateMouseBehavior() return self.currentSubjectDistance end function OrbitalCamera:CalculateNewLookVector(suppliedLookVector: Vector3, xyRotateVector: Vector2): Vector3 local currLookVector: Vector3 = suppliedLookVector or self:GetCameraLookVector() local currPitchAngle: number = math.asin(currLookVector.y) local yTheta: number = math.clamp(xyRotateVector.y, currPitchAngle - math.rad(MAX_ALLOWED_ELEVATION_DEG), currPitchAngle - math.rad(MIN_ALLOWED_ELEVATION_DEG)) local constrainedRotateInput: Vector2 = Vector2.new(xyRotateVector.x, yTheta) local startCFrame: CFrame = CFrame.new(ZERO_VECTOR3, currLookVector) local newLookVector: Vector3 = (CFrame.Angles(0, -constrainedRotateInput.x, 0) * startCFrame * CFrame.Angles(-constrainedRotateInput.y,0,0)).lookVector return newLookVector end
--//Main Function
ProximityPrompt.Triggered:Connect(function(Player) local Character = Player.Character local Torso = Character:WaitForChild("Head") ProximityPrompt.ActionText = "Wear" if Character:FindFirstChild(script.Parent.Parent.Name) then Character[script.Parent.Parent.Name]:Destroy() else local NewArmor = Armor:Clone() NewArmor:SetPrimaryPartCFrame(Torso.CFrame) NewArmor.PrimaryPart:Destroy() ProximityPrompt.ActionText = "Take off" for _, part in pairs (NewArmor:GetChildren()) do if part:IsA("BasePart") then WeldParts(Torso, part) part.CanCollide = false part.Anchored = false end end NewArmor.Parent = Character end end)
--[[** ensures value is NaN @param value The value to check against @returns True iff the condition is satisfied, false otherwise **--]]
function t.nan(value) if value ~= value then return true else return false end end
--SETUP -- EASY ---- Simply place the StarMapScripts folder in ---- any part and run the game. The Initializer ---- script will start the star map generation ---- automagically. You can change configuration ---- values in the script to get the desired ---- effect [see CONFIGURATION]. -- INTERMEDIATE ---- Place the StarMapScripts inside a part. If ---- you would like the scripts to start on their ---- own, leave the Initializer script alone. ---- Otherwise, you can delete/disable the ---- Initializer script. ---- To regenerate the starmap and pass in a new ---- configuration [see CONFIGURATION], you need ---- to require() the StarMapScript module. The ---- module itself simply returns a function, so ---- if you load the module into a variable like so ----- local starmap = require([StarMapScript]) ---- then you only need to call it as a function ---- to regenerate the map: ----- starmap() ---- Alternatively, you can simply do this: ----- require([StarMapScript])() ---- to generate the starmap without a variable. ---- Of course you can pass in a configuration table ---- to generate different types of maps. ---- [see CONFIGURATION] -- ADVANCED ---- Effectively the same as INTERMEDIATE but you can ---- disable the Initializer script, put the scripts ---- folder anywhere you like, and load any star maps ---- you would like one after the other using a custom ---- configuration table. ----- e.g. { ----- Part = workspace.MyPart, ----- Object_Parent = workspace.MyPart ----- { ---- WARNING: ---- If you choose to use this method, you MUST ---- specify a new Object_Parent in the configuration ---- table each time you generate a new map. If ---- you don't any stars you generate will be ---- removed when the function is called again. ---- The StarMap function supports a callback when ---- it is finished generating a map. Simply pass ---- in a table containing a "Callback" key that has ---- a function value, and that function will be ---- called when the generation routine has finished. ---- The callback is called using spawn() so you don't ---- have to worry about holding the script up. ---- The function itself will hold any functions ---- calling it however, unless you use spawn() to ---- call it.
--// Return values: bool filterSuccess, bool resultIsFilterObject, variant result
function methods:InternalApplyRobloxFilterNewAPI(speakerName, message) --// USES FFLAG local alwaysRunFilter = false local runFilter = RunService:IsServer() and not RunService:IsStudio() if (alwaysRunFilter or runFilter) then local fromSpeaker = self:GetSpeaker(speakerName) if fromSpeaker == nil then return false, nil, nil end local fromPlayerObj = fromSpeaker:GetPlayer() if fromPlayerObj == nil then return true, false, message end local success, filterResult = pcall(function() local ts = game:GetService("TextService") local result = ts:FilterStringAsync(message, fromPlayerObj.UserId) return result end) if (success) then return true, true, filterResult else warn("Error filtering message:", message) self:InternalNotifyFilterIssue() return false, nil, nil end else --// Simulate filtering latency. wait(0.2) return true, false, message end return nil end function methods:InternalDoMessageFilter(speakerName, messageObj, channel) local filtersIterator = self.FilterMessageFunctions:GetIterator() for funcId, func, priority in filtersIterator do local success, errorMessage = pcall(function() func(speakerName, messageObj, channel) end) if not success then warn(string.format("DoMessageFilter Function '%s' failed for reason: %s", funcId, errorMessage)) end end end function methods:InternalDoProcessCommands(speakerName, message, channel) local commandsIterator = self.ProcessCommandsFunctions:GetIterator() for funcId, func, priority in commandsIterator do local success, returnValue = pcall(function() local ret = func(speakerName, message, channel) if type(ret) ~= "boolean" then error("Process command functions must return a bool") end return ret end) if not success then warn(string.format("DoProcessCommands Function '%s' failed for reason: %s", funcId, returnValue)) elseif returnValue then return true end end return false end function methods:InternalGetUniqueMessageId() local id = self.MessageIdCounter self.MessageIdCounter = id + 1 return id end function methods:InternalAddSpeakerWithPlayerObject(speakerName, playerObj, fireSpeakerAdded) if (self.Speakers[speakerName:lower()]) then error("Speaker \"" .. speakerName .. "\" already exists!") end local speaker = Speaker.new(self, speakerName) speaker:InternalAssignPlayerObject(playerObj) self.Speakers[speakerName:lower()] = speaker if fireSpeakerAdded then local success, err = pcall(function() self.eSpeakerAdded:Fire(speakerName) end) if not success and err then print("Error adding speaker: " ..err) end end return speaker end function methods:InternalFireSpeakerAdded(speakerName) local success, err = pcall(function() self.eSpeakerAdded:Fire(speakerName) end) if not success and err then print("Error firing speaker added: " ..err) end end
--[[ Construct the value that is assigned to Roact's context storage. ]]
local function createContextEntry(currentValue) return { value = currentValue, onUpdate = createSignal(), } end local function createProvider(context) local Provider = Component:extend("Provider") function Provider:init(props) self.contextEntry = createContextEntry(props.value) self:__addContext(context.key, self.contextEntry) end function Provider:willUpdate(nextProps) -- If the provided value changed, immediately update the context entry. -- -- During this update, any components that are reachable will receive -- this updated value at the same time as any props and state updates -- that are being applied. if nextProps.value ~= self.props.value then self.contextEntry.value = nextProps.value end end function Provider:didUpdate(prevProps) -- If the provided value changed, after we've updated every reachable -- component, fire a signal to update the rest. -- -- This signal will notify all context consumers. It's expected that -- they will compare the last context value they updated with and only -- trigger an update on themselves if this value is different. -- -- This codepath will generally only update consumer components that has -- a component implementing shouldUpdate between them and the provider. if prevProps.value ~= self.props.value then self.contextEntry.onUpdate:fire(self.props.value) end end function Provider:render() return createFragment(self.props[Children]) end return Provider end local function createConsumer(context) local Consumer = Component:extend("Consumer") function Consumer.validateProps(props) if type(props.render) ~= "function" then return false, "Consumer expects a `render` function" else return true end end function Consumer:init(_props) -- This value may be nil, which indicates that our consumer is not a -- descendant of a provider for this context item. self.contextEntry = self:__getContext(context.key) end function Consumer:render() -- Render using the latest available for this context item. -- -- We don't store this value in state in order to have more fine-grained -- control over our update behavior. local value if self.contextEntry ~= nil then value = self.contextEntry.value else value = context.defaultValue end return self.props.render(value) end function Consumer:didUpdate() -- Store the value that we most recently updated with. -- -- This value is compared in the contextEntry onUpdate hook below. if self.contextEntry ~= nil then self.lastValue = self.contextEntry.value end end function Consumer:didMount() if self.contextEntry ~= nil then -- When onUpdate is fired, a new value has been made available in -- this context entry, but we may have already updated in the same -- update cycle. -- -- To avoid sending a redundant update, we compare the new value -- with the last value that we updated with (set in didUpdate) and -- only update if they differ. This may happen when an update from a -- provider was blocked by an intermediate component that returned -- false from shouldUpdate. self.disconnect = self.contextEntry.onUpdate:subscribe(function(newValue) if newValue ~= self.lastValue then -- Trigger a dummy state update. self:setState({}) end end) end end function Consumer:willUnmount() if self.disconnect ~= nil then self.disconnect() self.disconnect = nil end end return Consumer end local Context = {} Context.__index = Context function Context.new(defaultValue) return setmetatable({ defaultValue = defaultValue, key = Symbol.named("ContextKey"), }, Context) end function Context:__tostring() return "RoactContext" end local function createContext(defaultValue) local context = Context.new(defaultValue) return { Provider = createProvider(context), Consumer = createConsumer(context), } end return createContext
--[[ Module functions ]]
-- function Invisicam:LimbBehavior(castPoints) for limb, _ in pairs(self.trackedLimbs) do castPoints[#castPoints + 1] = limb.Position end end function Invisicam:MoveBehavior(castPoints) for i = 1, MOVE_CASTS do local position, velocity = self.humanoidRootPart.Position, self.humanoidRootPart.Velocity local horizontalSpeed = Vector3.new(velocity.X, 0, velocity.Z).Magnitude / 2 local offsetVector = (i - 1) * self.humanoidRootPart.CFrame.lookVector * horizontalSpeed castPoints[#castPoints + 1] = position + offsetVector end end function Invisicam:CornerBehavior(castPoints) local cframe = self.humanoidRootPart.CFrame local centerPoint = cframe.p local rotation = cframe - centerPoint local halfSize = self.char:GetExtentsSize() / 2 --NOTE: Doesn't update w/ limb animations castPoints[#castPoints + 1] = centerPoint for i = 1, #CORNER_FACTORS do castPoints[#castPoints + 1] = centerPoint + (rotation * (halfSize * CORNER_FACTORS[i])) end end function Invisicam:CircleBehavior(castPoints) local cframe if self.mode == MODE.CIRCLE1 then cframe = self.humanoidRootPart.CFrame else local camCFrame = self.camera.CoordinateFrame cframe = camCFrame - camCFrame.p + self.humanoidRootPart.Position end castPoints[#castPoints + 1] = cframe.p for i = 0, CIRCLE_CASTS - 1 do local angle = (2 * math.pi / CIRCLE_CASTS) * i local offset = 3 * Vector3.new(math.cos(angle), math.sin(angle), 0) castPoints[#castPoints + 1] = cframe * offset end end function Invisicam:LimbMoveBehavior(castPoints) self:LimbBehavior(castPoints) self:MoveBehavior(castPoints) end function Invisicam:CharacterOutlineBehavior(castPoints) local torsoUp = self.torsoPart.CFrame.upVector.unit local torsoRight = self.torsoPart.CFrame.rightVector.unit -- Torso cross of points for interior coverage castPoints[#castPoints + 1] = self.torsoPart.CFrame.p castPoints[#castPoints + 1] = self.torsoPart.CFrame.p + torsoUp castPoints[#castPoints + 1] = self.torsoPart.CFrame.p - torsoUp castPoints[#castPoints + 1] = self.torsoPart.CFrame.p + torsoRight castPoints[#castPoints + 1] = self.torsoPart.CFrame.p - torsoRight if self.headPart then castPoints[#castPoints + 1] = self.headPart.CFrame.p end local cframe = CFrame.new(ZERO_VECTOR3,Vector3.new(self.camera.CoordinateFrame.lookVector.X,0,self.camera.CoordinateFrame.lookVector.Z)) local centerPoint = (self.torsoPart and self.torsoPart.Position or self.humanoidRootPart.Position) local partsWhitelist = {self.torsoPart} if self.headPart then partsWhitelist[#partsWhitelist + 1] = self.headPart end for i = 1, CHAR_OUTLINE_CASTS do local angle = (2 * math.pi * i / CHAR_OUTLINE_CASTS) local offset = cframe * (3 * Vector3.new(math.cos(angle), math.sin(angle), 0)) offset = Vector3.new(offset.X, math.max(offset.Y, -2.25), offset.Z) local ray = Ray.new(centerPoint + offset, -3 * offset) local hit, hitPoint = game.Workspace:FindPartOnRayWithWhitelist(ray, partsWhitelist, false, false) if hit then -- Use hit point as the cast point, but nudge it slightly inside the character so that bumping up against -- walls is less likely to cause a transparency glitch castPoints[#castPoints + 1] = hitPoint + 0.2 * (centerPoint - hitPoint).unit end end end function Invisicam:SmartCircleBehavior(castPoints) local torsoUp = self.torsoPart.CFrame.upVector.unit local torsoRight = self.torsoPart.CFrame.rightVector.unit -- SMART_CIRCLE mode includes rays to head and 5 to the torso. -- Hands, arms, legs and feet are not included since they -- are not canCollide and can therefore go inside of parts castPoints[#castPoints + 1] = self.torsoPart.CFrame.p castPoints[#castPoints + 1] = self.torsoPart.CFrame.p + torsoUp castPoints[#castPoints + 1] = self.torsoPart.CFrame.p - torsoUp castPoints[#castPoints + 1] = self.torsoPart.CFrame.p + torsoRight castPoints[#castPoints + 1] = self.torsoPart.CFrame.p - torsoRight if self.headPart then castPoints[#castPoints + 1] = self.headPart.CFrame.p end local cameraOrientation = self.camera.CFrame - self.camera.CFrame.p local torsoPoint = Vector3.new(0,0.5,0) + (self.torsoPart and self.torsoPart.Position or self.humanoidRootPart.Position) local radius = 2.5 -- This loop first calculates points in a circle of radius 2.5 around the torso of the character, in the -- plane orthogonal to the camera's lookVector. Each point is then raycast to, to determine if it is within -- the free space surrounding the player (not inside anything). Two iterations are done to adjust points that -- are inside parts, to try to move them to valid locations that are still on their camera ray, so that the -- circle remains circular from the camera's perspective, but does not cast rays into walls or parts that are -- behind, below or beside the character and not really obstructing view of the character. This minimizes -- the undesirable situation where the character walks up to an exterior wall and it is made invisible even -- though it is behind the character. for i = 1, SMART_CIRCLE_CASTS do local angle = SMART_CIRCLE_INCREMENT * i - 0.5 * math.pi local offset = radius * Vector3.new(math.cos(angle), math.sin(angle), 0) local circlePoint = torsoPoint + cameraOrientation * offset -- Vector from camera to point on the circle being tested local vp = circlePoint - self.camera.CFrame.p local ray = Ray.new(torsoPoint, circlePoint - torsoPoint) local hit, hp, hitNormal = game.Workspace:FindPartOnRayWithIgnoreList(ray, {self.char}, false, false ) local castPoint = circlePoint if hit then local hprime = hp + 0.1 * hitNormal.unit -- Slightly offset hit point from the hit surface local v0 = hprime - torsoPoint -- Vector from torso to offset hit point local perp = (v0:Cross(vp)).unit -- Vector from the offset hit point, along the hit surface local v1 = (perp:Cross(hitNormal)).unit -- Vector from camera to offset hit local vprime = (hprime - self.camera.CFrame.p).unit -- This dot product checks to see if the vector along the hit surface would hit the correct -- side of the invisicam cone, or if it would cross the camera look vector and hit the wrong side if ( v0.unit:Dot(-v1) < v0.unit:Dot(vprime)) then castPoint = RayIntersection(hprime, v1, circlePoint, vp) if castPoint.Magnitude > 0 then local ray = Ray.new(hprime, castPoint - hprime) local hit, hitPoint, hitNormal = game.Workspace:FindPartOnRayWithIgnoreList(ray, {self.char}, false, false ) if hit then local hprime2 = hitPoint + 0.1 * hitNormal.unit castPoint = hprime2 end else castPoint = hprime end else castPoint = hprime end local ray = Ray.new(torsoPoint, (castPoint - torsoPoint)) local hit, hitPoint, hitNormal = game.Workspace:FindPartOnRayWithIgnoreList(ray, {self.char}, false, false ) if hit then local castPoint2 = hitPoint - 0.1 * (castPoint - torsoPoint).unit castPoint = castPoint2 end end castPoints[#castPoints + 1] = castPoint end end function Invisicam:CheckTorsoReference() if self.char then self.torsoPart = self.char:FindFirstChild("Torso") if not self.torsoPart then self.torsoPart = self.char:FindFirstChild("UpperTorso") if not self.torsoPart then self.torsoPart = self.char:FindFirstChild("HumanoidRootPart") end end self.headPart = self.char:FindFirstChild("Head") end end function Invisicam:CharacterAdded(char, player) -- We only want the LocalPlayer's character if player~=PlayersService.LocalPlayer then return end if self.childAddedConn then self.childAddedConn:Disconnect() self.childAddedConn = nil end if self.childRemovedConn then self.childRemovedConn:Disconnect() self.childRemovedConn = nil end self.char = char self.trackedLimbs = {} local function childAdded(child) if child:IsA("BasePart") then if LIMB_TRACKING_SET[child.Name] then self.trackedLimbs[child] = true end if child.Name == "Torso" or child.Name == "UpperTorso" then self.torsoPart = child end if child.Name == "Head" then self.headPart = child end end end local function childRemoved(child) self.trackedLimbs[child] = nil -- If removed/replaced part is 'Torso' or 'UpperTorso' double check that we still have a TorsoPart to use self:CheckTorsoReference() end self.childAddedConn = char.ChildAdded:Connect(childAdded) self.childRemovedConn = char.ChildRemoved:Connect(childRemoved) for _, child in pairs(self.char:GetChildren()) do childAdded(child) end end function Invisicam:SetMode(newMode) AssertTypes(newMode, 'number') for _, modeNum in pairs(MODE) do if modeNum == newMode then self.mode = newMode self.behaviorFunction = self.behaviors[self.mode] return end end error("Invalid mode number") end function Invisicam:GetObscuredParts() return self.savedHits end
-- @outline // RUNNER
function Module.ClientInit() Module.CreateModel() end function Module.ClientUpdate(dt) local Cam = game.Workspace.CurrentCamera Module.Model:SetPrimaryPartCFrame(Cam.CFrame * CFrame.new(1.5, -1, -1.5)) end return Module
--[[ ___ _______ _ / _ |____/ ___/ / ___ ____ ___ (_)__ / __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-< /_/ |_| \___/_//_/\_,_/___/___/_/___/ 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 = 220 , spInc = 20 , -- Increment between labelled notches }, { units = "KM/H" , scaling = (10/12) * 1.09728 , -- 1 stud : 10 inches | ft/s to KP/H maxSpeed = 360 , spInc = 30 , -- Increment between labelled notches }, { units = "SPS" , scaling = 1 , -- Roblox standard maxSpeed = 320 , spInc = 40 , -- Increment between labelled notches } }
--[[Controls]]
local _CTRL = _Tune.Controls local Controls = Instance.new("Folder") Controls.Name = "Controls" Controls.Parent = script.Parent for i,v in pairs(_CTRL) do local a=Instance.new("StringValue") a.Name=i a.Value=v.Name a.Parent = Controls a.Changed:Connect(function() if i=="MouseThrottle" or i=="MouseBrake" then if a.Value == "MouseButton1" or a.Value == "MouseButton2" then _CTRL[i]=Enum.UserInputType[a.Value] else _CTRL[i]=Enum.KeyCode[a.Value] end else _CTRL[i]=Enum.KeyCode[a.Value] end end) end --Deadzone Adjust local _PPH = _Tune.Peripherals for i,v in pairs(_PPH) do local a = Instance.new("IntValue") a.Name = i a.Value = v a.Parent = Controls a.Changed:Connect(function() a.Value=math.min(100,math.max(0,a.Value)) _PPH[i] = a.Value end) end --Input Handler function DealWithInput(input,IsRobloxFunction) if (UserInputService:GetFocusedTextBox()==nil) and not _InControls then --Ignore when UI Focus --Shift Down [Manual Transmission] if _IsOn and (input.KeyCode ==_CTRL["ContlrShiftDown"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftDown"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftDown"])) and (_TMode=="Semi" or (_TMode=="Manual" and (not _ClutchOn))) and input.UserInputState == Enum.UserInputState.Begin then if _CGear == 0 and (_TMode=="Auto" or not _ClPressing) then _ClutchOn = true end _CGear = math.max(_CGear-1,-1) --Shift Up [Manual Transmission] elseif _IsOn and (input.KeyCode ==_CTRL["ContlrShiftUp"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftUp"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftUp"])) and (_TMode=="Semi" or (_TMode=="Manual" and (not _ClutchOn))) and input.UserInputState == Enum.UserInputState.Begin then if _CGear == 0 and (_TMode=="Auto" or not _ClPressing) then _ClutchOn = true end _CGear = math.min(_CGear+1,#_Tune.Ratios-2) --Toggle Clutch elseif _IsOn and (input.KeyCode ==_CTRL["ContlrClutch"] or (_MSteer and input.KeyCode==_CTRL["MouseClutch"]) or ((not _MSteer) and input.KeyCode==_CTRL["Clutch"])) and _TMode=="Manual" then if input.UserInputState == Enum.UserInputState.Begin then _ClutchOn = false _ClPressing = true elseif input.UserInputState == Enum.UserInputState.End then _ClutchOn = true _ClPressing = false end --Toggle PBrake elseif _IsOn and input.KeyCode ==_CTRL["ContlrPBrake"] or (_MSteer and input.KeyCode==_CTRL["MousePBrake"]) or ((not _MSteer) and input.KeyCode==_CTRL["PBrake"]) then if input.UserInputState == Enum.UserInputState.Begin then _PBrake = not _PBrake elseif input.UserInputState == Enum.UserInputState.End then if car.DriveSeat.Velocity.Magnitude>5 then _PBrake = false end end --Toggle Transmission Mode elseif (input.KeyCode == _CTRL["ContlrToggleTMode"] or input.KeyCode==_CTRL["ToggleTransMode"]) and input.UserInputState == Enum.UserInputState.Begin then local n=1 for i,v in pairs(_Tune.TransModes) do if v==_TMode then n=i break end end n=n+1 if n>#_Tune.TransModes then n=1 end _TMode = _Tune.TransModes[n] --Throttle elseif _IsOn and ((not _MSteer) and (input.KeyCode==_CTRL["Throttle"] or input.KeyCode == _CTRL["Throttle2"])) or ((((_CTRL["MouseThrottle"]==Enum.UserInputType.MouseButton1 or _CTRL["MouseThrottle"]==Enum.UserInputType.MouseButton2) and input.UserInputType == _CTRL["MouseThrottle"]) or input.KeyCode == _CTRL["MouseThrottle"])and _MSteer) then if input.UserInputState == Enum.UserInputState.Begin then _GThrot = 1 else _GThrot = _Tune.IdleThrottle/100 end --Brake elseif ((not _MSteer) and (input.KeyCode==_CTRL["Brake"] or input.KeyCode == _CTRL["Brake2"])) or ((((_CTRL["MouseBrake"]==Enum.UserInputType.MouseButton1 or _CTRL["MouseBrake"]==Enum.UserInputType.MouseButton2) and input.UserInputType == _CTRL["MouseBrake"]) or input.KeyCode == _CTRL["MouseBrake"])and _MSteer) then if input.UserInputState == Enum.UserInputState.Begin then _GBrake = 1 else _GBrake = 0 end --Steer Left elseif (not _MSteer) and (input.KeyCode==_CTRL["SteerLeft"] or input.KeyCode == _CTRL["SteerLeft2"]) then if input.UserInputState == Enum.UserInputState.Begin then _GSteerT = -1 _SteerL = true else if _SteerR then _GSteerT = 1 else _GSteerT = 0 end _SteerL = false end --Steer Right elseif (not _MSteer) and (input.KeyCode==_CTRL["SteerRight"] or input.KeyCode == _CTRL["SteerRight2"]) then if input.UserInputState == Enum.UserInputState.Begin then _GSteerT = 1 _SteerR = true else if _SteerL then _GSteerT = -1 else _GSteerT = 0 end _SteerR = false end --Toggle Mouse Controls elseif input.KeyCode ==_CTRL["ToggleMouseDrive"] then if input.UserInputState == Enum.UserInputState.End then _MSteer = not _MSteer _GThrot = _Tune.IdleThrottle/100 _GBrake = 0 _GSteerT = 0 _ClutchOn = true end --Toggle TCS elseif _Tune.TCSEnabled and _IsOn and input.KeyCode == _CTRL["ToggleTCS"] or input.KeyCode == _CTRL["ContlrToggleTCS"] then if input.UserInputState == Enum.UserInputState.End then _TCS = not _TCS end --Toggle ABS elseif _Tune. ABSEnabled and _IsOn and input.KeyCode == _CTRL["ToggleABS"] or input.KeyCode == _CTRL["ContlrToggleABS"] then if input.UserInputState == Enum.UserInputState.End then _ABS = not _ABS end end --Variable Controls if input.UserInputType.Name:find("Gamepad") then --Gamepad Steering if input.KeyCode == _CTRL["ContlrSteer"] then if input.Position.X>= 0 then local cDZone = math.min(.99,_Tune.Peripherals.ControlRDZone/100) if math.abs(input.Position.X)>cDZone then _GSteerT = (input.Position.X-cDZone)/(1-cDZone) else _GSteerT = 0 end else local cDZone = math.min(.99,_Tune.Peripherals.ControlLDZone/100) if math.abs(input.Position.X)>cDZone then _GSteerT = (input.Position.X+cDZone)/(1-cDZone) else _GSteerT = 0 end end --Gamepad Throttle elseif _IsOn and input.KeyCode == _CTRL["ContlrThrottle"] then _GThrot = math.max(_Tune.IdleThrottle/100,input.Position.Z) --Gamepad Brake elseif input.KeyCode == _CTRL["ContlrBrake"] then _GBrake = input.Position.Z end end else _GThrot = _Tune.IdleThrottle/100 _GSteerT = 0 _GBrake = 0 if _CGear~=0 then _ClutchOn = true end end end UserInputService.InputBegan:connect(DealWithInput) UserInputService.InputChanged:connect(DealWithInput) UserInputService.InputEnded:connect(DealWithInput)
--[[** Yields the current thread until the specified amount of seconds have elapsed. This uses Heartbeat to avoid using the legacy scheduler. @param [t:optional<t:numberMin<0>>] Seconds The amount of seconds the thread will be yielded for. Defaults to 0.03. @returns [t:number] The actual time yielded (in seconds). **--]]
function Scheduler.Wait(Seconds) assert(OptionalNonNegativeNumber(Seconds)) Seconds = math.max(Seconds or 0.03, 0) local TimeRemaining = Seconds while TimeRemaining > 0 do TimeRemaining = TimeRemaining - Heartbeat:Wait() end return Seconds - TimeRemaining end
-- Decompiled with the Synapse X Luau decompiler.
function PlaySound() script.Sound:Play(); end; script.Parent.MouseButton1Click:Connect(PlaySound);
--[[ A signal value indicating that a child should use its parent's key, because it has no key of its own. This occurs when you return only one element from a function component or stateful render function. ]]
ElementUtils.UseParentKey = Symbol.named("UseParentKey") type Iterator<K, V> = ({ [K]: V }, K?) -> (K?, V?) type Element = { [any]: any }
--Made by Luckymaxer
Figure = script.Parent RunService = game:GetService("RunService") Creator = Figure:FindFirstChild("Creator") Humanoid = Figure:WaitForChild("Humanoid") Head = Figure:WaitForChild("Head") Torso = Figure:WaitForChild("Torso") Neck = Torso:WaitForChild("Neck") LeftShoulder = Torso:WaitForChild("Left Shoulder") RightShoulder = Torso:WaitForChild("Right Shoulder") LeftHip = Torso:WaitForChild("Left Hip") RightHip = Torso:WaitForChild("Right Hip") for i, v in pairs({--[[Neck, ]]LeftShoulder, RightShoulder, LeftHip, RightHip}) do if v and v.Parent then v.DesiredAngle = 0 v.CurrentAngle = 0 end end Pose = "None" LastPose = Pose PoseTime = tick() ToolAnimTime = 0 function SetPose(pose) LastPose = Pose Pose = pose PoseTime = tick() end function OnRunning(Speed) if Speed > 0 then SetPose("Running") else SetPose("Standing") end end function OnDied() SetPose("Dead") end function OnJumping() SetPose("Jumping") end function OnClimbing() SetPose("Climbing") end function OnGettingUp() SetPose("GettingUp") end function OnFreeFall() SetPose("FreeFall") end function OnFallingDown() SetPose("FallingDown") end function OnSeated() SetPose("Seated") end function OnPlatformStanding() SetPose("PlatformStanding") end function OnSwimming(Speed) return OnRunning(Speed) end function MoveJump() RightShoulder.MaxVelocity = 0.15 LeftShoulder.MaxVelocity = 0.15 RightShoulder.DesiredAngle = 0.5 LeftShoulder.DesiredAngle = -0.5 RightHip.DesiredAngle = -0.5 LeftHip.DesiredAngle = 0.5 end function MoveFreeFall() RightShoulder.MaxVelocity = 0.15 LeftShoulder.MaxVelocity = 0.15 RightShoulder.DesiredAngle = 0.5 LeftShoulder.DesiredAngle = -0.5 RightHip.DesiredAngle = -0.5 LeftHip.DesiredAngle = 0.5 end function MoveSit() RightShoulder.MaxVelocity = 0.15 LeftShoulder.MaxVelocity = 0.15 RightShoulder.DesiredAngle = (math.pi / 2) LeftShoulder.DesiredAngle = -(math.pi / 2) RightHip.DesiredAngle = 1 LeftHip.DesiredAngle = -1 end function GetTool() for i, v in pairs(Figure:GetChildren()) do if v:IsA("Tool") then return v end end end function GetToolAnim(Tool) for i, v in pairs(Tool:GetChildren()) do if v:IsA("StringValue") and v.Name == "ToolAnim" then return v end end return nil end function AnimateTool() if (ToolAnim == "None") then return end if (ToolAnim == "Slash") then RightShoulder.MaxVelocity = 0.5 RightShoulder.DesiredAngle = 0 return end if (ToolAnim == "Lunge") then RightShoulder.MaxVelocity = 0.5 LeftShoulder.MaxVelocity = 0.5 RightHip.MaxVelocity = 0.5 LeftHip.MaxVelocity = 0.5 RightShoulder.DesiredAngle = (math.pi / 2) LeftShoulder.DesiredAngle = 0 RightHip.DesiredAngle = (math.pi / 2) LeftHip.DesiredAngle = 1 return end end function Move(Time) local LimbAmplitude local LimbFrequency local NeckAmplitude local NeckFrequency local NeckDesiredAngle if (Pose == "Jumping") then MoveJump() return elseif (Pose == "FreeFall") then MoveFreeFall() return elseif (Pose == "Seated") then MoveSit() return end local ClimbFudge = 0 if (Pose == "Running") then RightShoulder.MaxVelocity = 0.15 LeftShoulder.MaxVelocity = 0.15 LimbAmplitude = 1 LimbFrequency = 9 NeckAmplitude = 0 NeckFrequency = 0 NeckDesiredAngle = 0 --[[if Creator and Creator.Value and Creator.Value:IsA("Player") and Creator.Value.Character then local CreatorCharacter = Creator.Value.Character local CreatorHead = CreatorCharacter:FindFirstChild("Head") if CreatorHead then local TargetPosition = CreatorHead.Position local Direction = Torso.CFrame.lookVector local HeadPosition = Head.Position NeckDesiredAngle = ((((HeadPosition - TargetPosition).Unit):Cross(Direction)).Y / 4) end end]] elseif (Pose == "Climbing") then RightShoulder.MaxVelocity = 0.5 LeftShoulder.MaxVelocity = 0.5 LimbAmplitude = 1 LimbFrequency = 9 NeckAmplitude = 0 NeckFrequency = 0 NeckDesiredAngle = 0 ClimbFudge = math.pi else LimbAmplitude = 0.1 LimbFrequency = 1 NeckAmplitude = 0.25 NeckFrequency = 1.25 end NeckDesiredAngle = ((not NeckDesiredAngle and (NeckAmplitude * math.sin(Time * NeckFrequency))) or NeckDesiredAngle) LimbDesiredAngle = (LimbAmplitude * math.sin(Time * LimbFrequency)) --Neck.DesiredAngle = NeckDesiredAngle RightShoulder.DesiredAngle = (LimbDesiredAngle + ClimbFudge) LeftShoulder.DesiredAngle = (LimbDesiredAngle - ClimbFudge) RightHip.DesiredAngle = -LimbDesiredAngle LeftHip.DesiredAngle = -LimbDesiredAngle local Tool = GetTool() if Tool then AnimStringValueObject = GetToolAnim(Tool) if AnimStringValueObject then ToolAnim = AnimStringValueObject.Value if AnimStringValueObject and AnimStringValueObject.Parent then AnimStringValueObject:Destroy() end ToolAnimTime = (Time + 0.3) end if Time > ToolAnimTime then ToolAnimTime = 0 ToolAnim = "None" end AnimateTool() else ToolAnim = "None" ToolAnimTime = 0 end end Humanoid.Died:connect(OnDied) Humanoid.Running:connect(OnRunning) Humanoid.Jumping:connect(OnJumping) Humanoid.Climbing:connect(OnClimbing) Humanoid.GettingUp:connect(OnGettingUp) Humanoid.FreeFalling:connect(OnFreeFall) Humanoid.FallingDown:connect(OnFallingDown) Humanoid.Seated:connect(OnSeated) Humanoid.PlatformStanding:connect(OnPlatformStanding) Humanoid.Swimming:connect(OnSwimming) Humanoid:ChangeState(Enum.HumanoidStateType.None) RunService.Stepped:connect(function() local _, Time = wait(0.1) Move(Time) end)
-- May return NaN or inf or -inf -- This is a way of finding the angle between the two vectors:
local function findAngleBetweenXZVectors(vec2, vec1) return math.atan2(vec1.X*vec2.Z-vec1.Z*vec2.X, vec1.X*vec2.X + vec1.Z*vec2.Z) end local function GetOrientationZY(backVector, upVector) local rightVector = upVector:Cross(backVector).unit; local upVector = backVector:Cross(rightVector).unit; backVector = backVector.unit; return CFrame.new(0, 0, 0, rightVector.x, upVector.x, backVector.x, rightVector.y, upVector.y, backVector.y, rightVector.z, upVector.z, backVector.z); end local function CreateClassicCamera() local module = RootCameraCreator() local tweenAcceleration = math.rad(220) local tweenSpeed = math.rad(0) local tweenMaxSpeed = math.rad(250) local timeBeforeAutoRotate = 2 local lastThumbstickRotate = nil local numOfSeconds = 0.7 local currentSpeed = 0 local maxSpeed = 0.1 local thumbstickSensitivity = 1 local lastThumbstickPos = Vector2.new(0,0) local ySensitivity = 0.8 local lastVelocity = nil local lastUpdate = tick() module.LastUserPanCamera = tick() function module:Update() local now = tick() local userPanningTheCamera = (self.UserPanningTheCamera == true) local camera = workspace.CurrentCamera local player = PlayersService.LocalPlayer local humanoid = self:GetHumanoid() local cameraSubject = camera and camera.CameraSubject local isInVehicle = cameraSubject and cameraSubject:IsA('VehicleSeat') local isOnASkateboard = cameraSubject and cameraSubject:IsA('SkateboardPlatform') if lastUpdate == nil or now - lastUpdate > 1 then module:ResetCameraLook() self.LastCameraTransform = nil end if lastUpdate then -- Cap out the delta to 0.5 so we don't get some crazy things when we re-resume from local delta = math.min(0.5, now - lastUpdate) local angle = 0 if not (isInVehicle or isOnASkateboard) then angle = angle + (self.TurningLeft and -120 or 0) angle = angle + (self.TurningRight and 120 or 0) end local gamepadRotation = self:UpdateGamepad() if gamepadRotation ~= Vector2.new(0,0) then userPanningTheCamera = true self.RotateInput = self.RotateInput + gamepadRotation end if angle ~= 0 then userPanningTheCamera = true self.RotateInput = self.RotateInput + Vector2.new(math.rad(angle * delta), 0) end end -- Reset tween speed if user is panning if userPanningTheCamera then tweenSpeed = 0 module.LastUserPanCamera = tick() end local userRecentlyPannedCamera = now - module.LastUserPanCamera < timeBeforeAutoRotate local subjectPosition = self:GetSubjectPosition() if subjectPosition and player and camera then local zoom = self:GetCameraZoom() if zoom < 0.5 then zoom = 0.5 end if self:GetShiftLock() and not self:IsInFirstPerson() then -- We need to use the right vector of the camera after rotation, not before local newLookVector = self:RotateCamera(self:GetCameraLook(), self.RotateInput) local offset = ((newLookVector * XZ_VECTOR):Cross(UP_VECTOR).unit * 1.75) if IsFiniteVector3(offset) then subjectPosition = subjectPosition + offset end else if self.LastCameraTransform and not userPanningTheCamera then local isInFirstPerson = self:IsInFirstPerson() if (isInVehicle or isOnASkateboard) and lastUpdate and humanoid and humanoid.Torso then if isInFirstPerson then if self.LastSubjectCFrame and (isInVehicle or isOnASkateboard) and cameraSubject:IsA('BasePart') then local y = -findAngleBetweenXZVectors(self.LastSubjectCFrame.lookVector, cameraSubject.CFrame.lookVector) if IsFinite(y) then self.RotateInput = self.RotateInput + Vector2.new(y, 0) end tweenSpeed = 0 end elseif not userRecentlyPannedCamera then local forwardVector = humanoid.Torso.CFrame.lookVector if isOnASkateboard then forwardVector = cameraSubject.CFrame.lookVector end local timeDelta = (now - lastUpdate) tweenSpeed = clamp(0, tweenMaxSpeed, tweenSpeed + tweenAcceleration * timeDelta) local percent = clamp(0, 1, tweenSpeed * timeDelta) if self:IsInFirstPerson() then percent = 1 end local y = findAngleBetweenXZVectors(forwardVector, self:GetCameraLook()) if IsFinite(y) and math.abs(y) > 0.0001 then self.RotateInput = self.RotateInput + Vector2.new(y * percent, 0) end end end end end local newLookVector = self:RotateCamera(self:GetCameraLook(), self.RotateInput) self.RotateInput = Vector2.new() camera.Focus = CFrame.new(subjectPosition) local downVector = (self.DownVector or {Value=Vector3.new(0, -1, 0)}).Value; local camOrientation = GetOrientationZY(-newLookVector, -downVector); camera.CoordinateFrame = CFrame.new(camera.Focus.p) * camOrientation * CFrame.new(0, 0, zoom); self.LastCameraTransform = camera.CoordinateFrame if isInVehicle or isOnASkateboard and cameraSubject:IsA('BasePart') then self.LastSubjectCFrame = cameraSubject.CFrame else self.LastSubjectCFrame = nil end end lastUpdate = now end return module end return CreateClassicCamera
--[[ ___ _______ _ / _ |____/ ___/ / ___ ____ ___ (_)__ / __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-< /_/ |_| \___/_//_/\_,_/___/___/_/___/ SecondLogic @ Inspare ]]
local FE = workspace.FilteringEnabled local car = script.Parent.Car.Value local handler = car:WaitForChild("AC6_FE_SoundsMisc") local _Tune = require(car["A-Chassis Tune"]) local on = 0 local mult=0 local det=.6 script:WaitForChild("Rel") script:WaitForChild("Start") script.Parent.Values.Gear.Changed:connect(function() mult=1 end) for i,v in pairs(car.DriveSeat:GetChildren()) do for _,a in pairs(script:GetChildren()) do if v.Name==a.Name then v:Stop() wait() v:Destroy() end end end handler:FireServer("newSound","Rel",car.DriveSeat,script.Rel.SoundId,0,script.Rel.Volume,true) handler:FireServer("newSound","Start",car.DriveSeat,script.Start.SoundId,1,script.Start.Volume,false) handler:FireServer("playSound","Rel") car.DriveSeat:WaitForChild("Rel") car.DriveSeat:WaitForChild("Start") while wait() do mult=math.max(0,mult-.1) local _RPM = script.Parent.Values.RPM.Value if script.Parent.Values.PreOn.Value then handler:FireServer("playSound","Start") wait(1.2) else if not script.Parent.IsOn.Value then on=math.max(on-.015,0) else on=1 end RelVolume = 10*(1 - math.min(((script.Parent.Values.RPM.Value*3)/_Tune.Redline),1)) RelPitch = (math.max((((script.Rel.SetPitch.Value + script.Rel.SetRev.Value*_RPM/_Tune.Redline))*on^2)+(det*mult*math.sin(80*tick())),script.Rel.SetPitch.Value)) * on end if FE then handler:FireServer("updateSound","Rel",script.Rel.SoundId,RelPitch,RelVolume) else car.DriveSeat.Rel.Volume = RelVolume car.DriveSeat.Rel.Pitch = RelPitch end end
--!strict
local Array = script.Parent local isArray = require(Array.isArray) type Array<T> = { [number]: T } local RECEIVED_OBJECT_ERROR = "Array.concat(...) only works with array-like tables but " .. "it received an object-like table.\nYou can avoid this error by wrapping the " .. "object-like table into an array. Example: `concat({1, 2}, {a = true})` should " .. "be `concat({1, 2}, { {a = true} }`"
--[[Transmission]]
Tune.Clutch = true -- Implements a realistic clutch, change to "false" for the chassis to act like AC6.81T. Tune.TransModes = {"Manual"} --[[ [Modes] "Auto" : Automatic shifting "Semi" : Clutchless manual shifting, dual clutch transmission "Manual" : Manual shifting with clutch >Include within brackets eg: {"Semi"} or {"Auto", "Manual"} >First mode is default mode ]] Tune.ClutchMode = "New" --[[ [Modes] "New" : Speed controls clutch engagement (AC6C V1.2) "Old" : Speed and RPM control clutch engagement (AC6C V1.1) ]] --Transmission Settings Tune.Stall = true -- Stalling, enables the car to stall. An ignition plugin would be necessary. Disables if Tune.Clutch is false. Tune.ClutchRel = false -- If true, the driver must let off the gas before shifting to a higher gear. Recommended false for beginners. Tune.ClutchEngage = 25 -- How fast engagement is (0 = instant, 99 = super slow) Tune.SpeedEngage = 15 -- Speed the clutch fully engages at (Based on SPS) --Clutch: "Old" mode Tune.ClutchRPMMult = 1.0 -- Clutch RPM multiplier, recommended to leave at 1.0 --Automatic Settings Tune.AutoShiftMode = "RPM" --[[ [Modes] "Speed" : Shifts based on wheel speed "RPM" : Shifts based on RPM ]] Tune.AutoShiftType = "DCT" --[[ [Types] "Rev" : Clutch engages fully once RPM reached (AC6C V1) "DCT" : Clutch engages after a set time has passed (AC6.81T) ]] Tune.AutoShiftVers = "New" --[[ [Versions] "New" : Shift from Reverse, Neutral, and Drive (AC6.81T) "Old" : Auto shifts into R or D when stopped. (AC6.52S2) ]] Tune.AutoUpThresh = -200 -- Automatic upshift point (relative to peak RPM, positive = Over-rev) Tune.AutoDownThresh = 1400 -- Automatic downshift point (relative to peak RPM, positive = Under-rev) --Automatic: Revmatching Tune.ShiftThrot = 100 -- Throttle level when shifting down to revmatch, 0 - 100% --Automatic: DCT Tune.ShiftUpTime = 0.25 -- Time required to shift into next gear, from a lower gear to a higher one. Tune.ShiftDnTime = 0.125 -- Time required to shift into next gear, from a higher gear to a lower one. --Gear Ratios Tune.FinalDrive = 4 Tune.Ratios = { --[[Reverse]] 5 , --[[Neutral]] 0 , --[[ 1 ]] 3.9 , --[[ 2 ]] 2.52 , --[[ 3 ]] 1.85 , --[[ 4 ]] 1.38 , --[[ 5 ]] 1.05 , --[[ 6 ]] .87 , } Tune.FDMult = 1 -- Ratio multiplier (keep this at 1 if car is not struggling with torque)
-------------------------
function DoorClose() if Shaft00.MetalDoor.CanCollide == false then Shaft00.MetalDoor.CanCollide = true while Shaft00.MetalDoor.Transparency > 0.0 do Shaft00.MetalDoor.Transparency = Shaft00.MetalDoor.Transparency - .1 wait(0.000001) end Car.BodyVelocity.velocity = Vector3.new(0, 20, 0) --Change 10 to change the speed. end if Shaft01.MetalDoor.CanCollide == false then Shaft01.MetalDoor.CanCollide = true while Shaft01.MetalDoor.Transparency > 0.0 do Shaft01.MetalDoor.Transparency = Shaft01.MetalDoor.Transparency - .1 wait(0.000001) end Car.BodyVelocity.velocity = Vector3.new(0, 20, 0) end if Shaft02.MetalDoor.CanCollide == false then Shaft02.MetalDoor.CanCollide = true while Shaft02.MetalDoor.Transparency > 0.0 do Shaft02.MetalDoor.Transparency = Shaft02.MetalDoor.Transparency - .1 wait(0.000001) end Car.BodyVelocity.velocity = Vector3.new(0, 20, 0) end if Shaft03.MetalDoor.CanCollide == false then Shaft03.MetalDoor.CanCollide = true while Shaft03.MetalDoor.Transparency > 0.0 do Shaft03.MetalDoor.Transparency = Shaft03.MetalDoor.Transparency - .1 wait(0.000001) end Car.BodyVelocity.velocity = Vector3.new(0, 20, 0) end if Shaft04.MetalDoor.CanCollide == false then Shaft04.MetalDoor.CanCollide = true while Shaft04.MetalDoor.Transparency > 0.0 do Shaft04.MetalDoor.Transparency = Shaft04.MetalDoor.Transparency - .1 wait(0.000001) end Car.BodyVelocity.velocity = Vector3.new(0, 20, 0) end if Shaft05.MetalDoor.CanCollide == false then Shaft05.MetalDoor.CanCollide = true while Shaft05.MetalDoor.Transparency > 0.0 do Shaft05.MetalDoor.Transparency = Shaft05.MetalDoor.Transparency - .1 wait(0.000001) end Car.BodyVelocity.velocity = Vector3.new(0, 20, 0) end if Shaft06.MetalDoor.CanCollide == false then Shaft06.MetalDoor.CanCollide = true while Shaft06.MetalDoor.Transparency > 0.0 do Shaft06.MetalDoor.Transparency = Shaft06.MetalDoor.Transparency - .1 wait(0.000001) end Car.BodyVelocity.velocity = Vector3.new(0, 20, 0) end if Shaft07.MetalDoor.CanCollide == false then Shaft07.MetalDoor.CanCollide = true while Shaft07.MetalDoor.Transparency > 0.0 do Shaft07.MetalDoor.Transparency = Shaft07.MetalDoor.Transparency - .1 wait(0.000001) end end if Shaft08.MetalDoor.CanCollide == false then Shaft08.MetalDoor.CanCollide = true while Shaft08.MetalDoor.Transparency > 0.0 do Shaft08.MetalDoor.Transparency = Shaft08.MetalDoor.Transparency - .1 wait(0.000001) end Car.BodyVelocity.velocity = Vector3.new(0, -20, 0) end if Shaft09.MetalDoor.CanCollide == false then Shaft09.MetalDoor.CanCollide = true while Shaft09.MetalDoor.Transparency > 0.0 do Shaft09.MetalDoor.Transparency = Shaft09.MetalDoor.Transparency - .1 wait(0.000001) end Car.BodyVelocity.velocity = Vector3.new(0, -20, 0) end if Shaft10.MetalDoor.CanCollide == false then Shaft10.MetalDoor.CanCollide = true while Shaft10.MetalDoor.Transparency > 0.0 do Shaft10.MetalDoor.Transparency = Shaft10.MetalDoor.Transparency - .1 wait(0.000001) end Car.BodyVelocity.velocity = Vector3.new(0, -20, 0) end if Shaft11.MetalDoor.CanCollide == false then Shaft11.MetalDoor.CanCollide = true while Shaft11.MetalDoor.Transparency > 0.0 do Shaft11.MetalDoor.Transparency = Shaft11.MetalDoor.Transparency - .1 wait(0.000001) end Car.BodyVelocity.velocity = Vector3.new(0, -20, 0) end if Shaft12.MetalDoor.CanCollide == false then Shaft12.MetalDoor.CanCollide = true while Shaft12.MetalDoor.Transparency > 0.0 do Shaft12.MetalDoor.Transparency = Shaft12.MetalDoor.Transparency - .1 wait(0.000001) end Car.BodyVelocity.velocity = Vector3.new(0, -20, 0) end if Shaft13.MetalDoor.CanCollide == false then Shaft13.MetalDoor.CanCollide = true while Shaft13.MetalDoor.Transparency > 0.0 do Shaft13.MetalDoor.Transparency = Shaft13.MetalDoor.Transparency - .1 wait(0.000001) end Car.BodyVelocity.velocity = Vector3.new(0, -20, 0) end end function onClicked() DoorClose() end script.Parent.MouseButton1Click:connect(onClicked) script.Parent.MouseButton1Click:connect(function() if clicker == true then clicker = false else return end end) script.Parent.MouseButton1Click:connect(function() Car.Touched:connect(function(otherPart) if otherPart == Elevator.Floors:FindFirstChild(script.Parent.Name) then StopE() DoorOpen() end end)end) function StopE() Car.BodyVelocity.velocity = Vector3.new(0, 0, 0) Car.BodyPosition.position = Elevator.Floors:FindFirstChild(script.Parent.Name).Position clicker = true end function DoorOpen() while Shaft07.MetalDoor.Transparency < 1.0 do Shaft07.MetalDoor.Transparency = Shaft07.MetalDoor.Transparency + .1 wait(0.000001) end Shaft07.MetalDoor.CanCollide = false end
--lighting.Technology = default
button.MouseButton1Down:connect(function() toggle = not toggle if toggle == true then button.Text = "low" lighting.GlobalShadows = false --lighting.Technology = "ShadowMap" else button.Text = "high" lighting.GlobalShadows = true --lighting.Technology = "Future" end end)
--[[ Package link auto-generated by Rotriever ]]
local PackageIndex = script.Parent.Parent.Parent._Index local Package = require(PackageIndex["JestMessageUtil"]["JestMessageUtil"]) export type StackTraceConfig = Package.StackTraceConfig export type StackTraceOptions = Package.StackTraceOptions return Package
--[[ This component acts as a stand-in for the ScreenshotHud camera button. In the event that ScreenshotHud is not available (from the flag being off or when testing in stories) we render our own camera button so we can see how everything will look before hitting production. When ScreenshotHud is available, this component acts as a "phantom" by setting CameraButtonPosition to the position of this component/ This creates a Frame that the ScreenshotHud's camera button will follow to make it look like it's part of the actual Roact tree. ]]
local SelfieMode = script:FindFirstAncestor("SelfieMode") local ExperienceComponents = require(SelfieMode.Packages.ExperienceComponents) local Roact = require(SelfieMode.Packages.Roact) local assets = require(SelfieMode.assets) local BACKGROUND_COLOR = Color3.fromHex("#00b46d") local CONTENT_COLOR = Color3.fromHex("#fff") local function shift(color: Color3, percent: number) local h, s, v = color:ToHSV() return Color3.fromHSV(h, s, v * percent) end local PhotoButton = Roact.Component:extend("PhotoButton") export type Props = { layoutOrder: number?, size: UDim2?, screenshotHud: ScreenshotHud?, keyCode: Enum.KeyCode?, onActivated: (() -> ())?, transparency: any?, } function PhotoButton:init() self.setGuiPosition = function(rbx: Frame) local props: Props = self.props if props.screenshotHud then local offset = rbx.AbsoluteSize / 2 local position = rbx.AbsolutePosition + offset props.screenshotHud.CameraButtonPosition = UDim2.fromOffset(position.X, position.Y) end end end function PhotoButton:render() local props: Props = self.props if props.screenshotHud then return Roact.createElement("Frame", { LayoutOrder = props.layoutOrder, Size = props.size, BackgroundTransparency = 1, [Roact.Change.AbsolutePosition] = self.setGuiPosition, }) else return Roact.createElement(ExperienceComponents.PillButton, { layoutOrder = props.layoutOrder, backgroundColor = BACKGROUND_COLOR, borderColor = shift(BACKGROUND_COLOR, 0.8), borderSize = if props.keyCode then 0 else 6, contentColor = CONTENT_COLOR, text = if props.keyCode then "Take Photo" else nil, icon = assets.CameraFilled, size = props.size, keyCode = props.keyCode, onActivated = props.onActivated, transparency = props.transparency, }) end end return PhotoButton
--[[Weight and CG]]
Tune.Weight = 2500 -- Total weight (in pounds) Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable) --[[Width]] 6 , --[[Height]] 3.5 , --[[Length]] 9 } Tune.WeightDist = 50 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100) Tune.CGHeight = .8 -- Center of gravity height (studs relative to median of all wheels) Tune.WBVisible = false -- Makes the weight brick visible --Unsprung Weight Tune.FWheelDensity = 1.0 -- Front Wheel Density Tune.RWheelDensity = 1.0 -- Rear Wheel Density Tune.FWLgcyDensity = 1 -- Front Wheel Density [PGS OFF] Tune.RWLgcyDensity = 1 -- Rear Wheel Density [PGS OFF] Tune.AxleSize = 2 -- Size of structural members (larger = more stable/carry more weight) Tune.AxleDensity = .1 -- Density of structural members
-- yaw-axis rotational velocity of a part with a given CFrame and total RotVelocity
local function yawVelocity(rotVel, cf) return math.abs(cf.YVector:Dot(rotVel)) end local worldDt = 1/60 local VRVehicleCamera = setmetatable({}, VRBaseCamera) VRVehicleCamera.__index = VRVehicleCamera function VRVehicleCamera.new() local self = setmetatable(VRBaseCamera.new(), VRVehicleCamera) self:Reset() -- track physics solver time delta separately from the render loop to correctly synchronize time delta RunService.Stepped:Connect(function(_, _worldDt) worldDt = _worldDt end) return self end function VRVehicleCamera:Reset() self.vehicleCameraCore = VehicleCameraCore.new(self:GetSubjectCFrame()) self.pitchSpring = Spring.new(0, -math.rad(VehicleCameraConfig.pitchBaseAngle)) self.yawSpring = Spring.new(0, YAW_DEFAULT) local camera = workspace.CurrentCamera local cameraSubject = camera and camera.CameraSubject assert(camera, "VRVehicleCamera initialization error") assert(cameraSubject) assert(cameraSubject:IsA("VehicleSeat")) local assemblyParts = cameraSubject:GetConnectedParts(true) -- passing true to recursively get all assembly parts local assemblyPosition, assemblyRadius = CameraUtils.getLooseBoundingSphere(assemblyParts) assemblyRadius = math.max(assemblyRadius, EPSILON) self.assemblyRadius = assemblyRadius self.assemblyOffset = cameraSubject.CFrame:Inverse()*assemblyPosition -- seat-space offset of the assembly bounding sphere center self.lastCameraFocus = nil self:_StepInitialZoom() end function VRVehicleCamera:_StepInitialZoom() self:SetCameraToSubjectDistance(math.max( ZoomController.GetZoomRadius(), self.assemblyRadius*VehicleCameraConfig.initialZoomRadiusMul )) end function VRVehicleCamera:_GetThirdPersonLocalOffset() return self.assemblyOffset + Vector3.new(0, self.assemblyRadius*VehicleCameraConfig.verticalCenterOffset, 0) end function VRVehicleCamera:_GetFirstPersonLocalOffset(subjectCFrame: CFrame) local character = localPlayer.Character if character and character.Parent then local head = character:FindFirstChild("Head") if head and head:IsA("BasePart") then return subjectCFrame:Inverse() * head.Position end end return self:_GetThirdPersonLocalOffset() end function VRVehicleCamera:Update() local camera = workspace.CurrentCamera local cameraSubject = camera and camera.CameraSubject local vehicleCameraCore = self.vehicleCameraCore assert(camera) assert(cameraSubject) assert(cameraSubject:IsA("VehicleSeat")) -- consume the physics solver time delta to account for mismatched physics/render cycles local dt = worldDt worldDt = 0 -- get subject info local subjectCFrame: CFrame = self:GetSubjectCFrame() local subjectVel: Vector3 = self:GetSubjectVelocity() local subjectRotVel = self:GetSubjectRotVelocity() -- measure the local-to-world-space forward velocity of the vehicle local vDotZ = math.abs(subjectVel:Dot(subjectCFrame.ZVector)) local yawVel = yawVelocity(subjectRotVel, subjectCFrame) local pitchVel = pitchVelocity(subjectRotVel, subjectCFrame) -- step camera components forward local zoom = self:StepZoom() -- mix third and first person offsets in local space local firstPerson = mapClamp(zoom, ZOOM_MINIMUM, self.assemblyRadius, 1, 0) local tpOffset = self:_GetThirdPersonLocalOffset() local fpOffset = self:_GetFirstPersonLocalOffset(subjectCFrame) local localOffset = tpOffset:Lerp(fpOffset, firstPerson) -- step core forward vehicleCameraCore:setTransform(subjectCFrame) local processedRotation = vehicleCameraCore:step(dt, pitchVel, yawVel, firstPerson) -- end product of this function local focus = nil local cf = nil -- update fade from black self:UpdateFadeFromBlack(dt) if not self:IsInFirstPerson() then -- third person comfort camera focus = CFrame.new(subjectCFrame*localOffset)*processedRotation cf = focus*CFrame.new(0, 0, zoom) if not self.lastCameraFocus then self.lastCameraFocus = focus self.needsReset = true end local curCameraDir = focus.Position - camera.CFrame.Position local curCameraDist = curCameraDir.magnitude curCameraDir = curCameraDir.Unit local cameraDot = curCameraDir:Dot(camera.CFrame.LookVector) if cameraDot > TP_FOLLOW_ANGLE_DOT and curCameraDist < TP_FOLLOW_DIST and not self.needsReset then -- vehicle in view -- keep old focus focus = self.lastCameraFocus -- new cf result local cameraFocusP = focus.p local cameraLookVector = self:GetCameraLookVector() cameraLookVector = Vector3.new(cameraLookVector.X, 0, cameraLookVector.Z).Unit local newLookVector = self:CalculateNewLookVectorFromArg(cameraLookVector, Vector2.new(0, 0)) cf = CFrame.new(cameraFocusP - (zoom * newLookVector), cameraFocusP) else -- new focus / teleport self.currentSubjectDistance = DEFAULT_CAMERA_DIST self.lastCameraFocus = self:GetVRFocus(subjectCFrame.Position, dt) self.needsReset = false self:StartFadeFromBlack() self:ResetZoom() end self:UpdateEdgeBlur(localPlayer, dt) else -- first person in vehicle : lock orientation for stable camera local dir = Vector3.new(processedRotation.LookVector.X, 0, processedRotation.LookVector.Z).Unit local planarRotation = CFrame.new(processedRotation.Position, dir) -- this removes the pitch to reduce motion sickness focus = CFrame.new(subjectCFrame * localOffset) * planarRotation cf = focus * CFrame.new(0, 0, zoom) self:StartVREdgeBlur(localPlayer) end return cf, focus end function VRVehicleCamera:EnterFirstPerson() self.inFirstPerson = true self:UpdateMouseBehavior() end function VRVehicleCamera:LeaveFirstPerson() self.inFirstPerson = false self:UpdateMouseBehavior() end return VRVehicleCamera
-- https://script.google.com/macros/s/AKfycbyDKi7Kn66kpJutyY1WXnBO04Rb1rF7P0hBXmJfCtXIJjbLpned/exec
local scriptId = ""
-- Gradually regenerates the Humanoid's Health over time.
local REGEN_RATE = 2 / 100 -- Regenerate this fraction of MaxHealth per second. local REGEN_STEP = 1 -- Wait this long between each regeneration step.
--
wait() oldpos = CFrame.new(game.Players.LocalPlayer.Character.Head.CFrame.p + Vector3.new(0,5,0)) game.Players.LocalPlayer.CameraMaxZoomDistance = 20 game.Players.LocalPlayer.CameraMinZoomDistance = 20 workspace.CurrentCamera.CameraSubject = nil wait() for i = 1,25 do wait() workspace.CurrentCamera.CameraSubject = workspace:WaitForChild(game.Players.LocalPlayer.Name).Humanoid workspace.CurrentCamera.CFrame = workspace:WaitForChild(game.Players.LocalPlayer.Name).Head.CFrame end game.Lighting.ColorCorrection.Saturation = -0.4
--[[** <description> Run this once to combine all keys provided into one "main key". Internally, this means that data will be stored in a table with the key mainKey. This is used to get around the 2-DataStore2 reliability caveat. </description> <parameter name = "mainKey"> The key that will be used to house the table. </parameter> <parameter name = "..."> All the keys to combine under one table. </parameter> **--]]
function DataStore2.Combine(mainKey, ...) for _, name in ipairs({...}) do combinedDataStoreInfo[name] = mainKey end end function DataStore2.ClearCache() DataStoreCache = {} end function DataStore2.SaveAll(player) if DataStoreCache[player] then for _, dataStore in pairs(DataStoreCache[player]) do if dataStore.combinedStore == nil then dataStore:Save() end end end end DataStore2.SaveAllAsync = Promise.promisify(DataStore2.SaveAll) function DataStore2.PatchGlobalSettings(patch) for key, value in pairs(patch) do assert(Settings[key] ~= nil, "No such key exists: " .. key) -- TODO: Implement type checking with this when osyris' t is in Settings[key] = value end end function DataStore2.__call(_, dataStoreName, player) assert( typeof(dataStoreName) == "string" and IsPlayer.Check(player), ("DataStore2() API call expected {string dataStoreName, Player player}, got {%s, %s}") :format( typeof(dataStoreName), typeof(player) ) ) if DataStoreCache[player] and DataStoreCache[player][dataStoreName] then return DataStoreCache[player][dataStoreName] elseif combinedDataStoreInfo[dataStoreName] then local dataStore = DataStore2(combinedDataStoreInfo[dataStoreName], player) dataStore:BeforeSave(function(combinedData) for key in pairs(combinedData) do if combinedDataStoreInfo[key] then local combinedStore = DataStore2(key, player) local value = combinedStore:Get(nil, true) if value ~= nil then if combinedStore.combinedBeforeSave then value = combinedStore.combinedBeforeSave(clone(value)) end combinedData[key] = value end end end return combinedData end) local combinedStore = setmetatable({ combinedName = dataStoreName, combinedStore = dataStore, }, { __index = function(_, key) return CombinedDataStore[key] or dataStore[key] end, }) if not DataStoreCache[player] then DataStoreCache[player] = {} end DataStoreCache[player][dataStoreName] = combinedStore return combinedStore end local dataStore = { Name = dataStoreName, UserId = player.UserId, callbacks = {}, beforeInitialGet = {}, afterSave = {}, bindToClose = {}, } dataStore.savingMethod = SavingMethods[Settings.SavingMethod].new(dataStore) setmetatable(dataStore, DataStoreMetatable) local saveFinishedEvent, isSaveFinished = Instance.new("BindableEvent"), false local bindToCloseEvent = Instance.new("BindableEvent") local bindToCloseCallback = function() if not isSaveFinished then -- Defer to avoid a race between connecting and firing "saveFinishedEvent" Promise.defer(function() bindToCloseEvent:Fire() -- Resolves the Promise.race to save the data end) saveFinishedEvent.Event:Wait() end local value = dataStore:Get(nil, true) for _, bindToClose in ipairs(dataStore.bindToClose) do bindToClose(player, value) end end local success, errorMessage = pcall(function() game:BindToClose(function() if bindToCloseCallback == nil then return end bindToCloseCallback() end) end) if not success then warn("DataStore2 could not BindToClose", errorMessage) end Promise.race({ Promise.fromEvent(bindToCloseEvent.Event), Promise.fromEvent(player.AncestryChanged, function() return not player:IsDescendantOf(game) end), }):andThen(function() dataStore:SaveAsync():andThen(function() print("player left, saved", dataStoreName) end):catch(function(error) -- TODO: Something more elegant warn("error when player left!", error) end):finally(function() isSaveFinished = true saveFinishedEvent:Fire() end) --Give a long delay for people who haven't figured out the cache :^( return Promise.delay(40):andThen(function() DataStoreCache[player] = nil bindToCloseCallback = nil end) end) if not DataStoreCache[player] then DataStoreCache[player] = {} end DataStoreCache[player][dataStoreName] = dataStore return dataStore end DataStore2.Constants = Constants return setmetatable(DataStore2, DataStore2)
-- Decompiled with the Synapse X Luau decompiler.
local l__UserInputService__1 = game:GetService("UserInputService"); if l__UserInputService__1.KeyboardEnabled == true then script.Parent.Launcher.TextLabel.Text = "4"; script.Parent.Ragdoll.TextLabel.Text = "1"; script.Parent.Gravity.TextLabel.Text = "3"; script.Parent.Launch.TextLabel.Text = "2"; script.Parent.Weight.TextLabel.Text = "5"; script.Parent.Balloon.TextLabel.Text = "0"; end; if l__UserInputService__1.TouchEnabled == true then for v2, v3 in ipairs(script.Parent:GetChildren()) do if v3:IsA("ImageButton") then v3.TextLabel.Text = ""; end; end; end; if l__UserInputService__1.GamepadEnabled == true then script.Parent.Launcher.TextLabel.Text = "X"; script.Parent.Ragdoll.TextLabel.Text = "B"; script.Parent.Gravity.TextLabel.Text = "Y"; script.Parent.Launch.TextLabel.Text = "L1"; script.Parent.Weight.TextLabel.Text = "R1"; script.Parent.Balloon.Visible = false; end;
--[=[ Deep equivalent comparison of a table assuming keys are indexable in the same way. @param target table -- Table to check @param source table -- Other table to check @return boolean ]=]
function Table.deepEquivalent(target, source) if target == source then return true end if type(target) ~= type(source) then return false end if type(target) == "table" then for key, value in pairs(target) do if not Table.deepEquivalent(value, source[key]) then return false end end for key, value in pairs(source) do if not Table.deepEquivalent(value, target[key]) then return false end end return true else -- target == source should do it. return false end end
-- Clamp a vector to a max given magnitude:
local function ClampMagnitude(vector, mag) return (vector.Magnitude > mag and (vector.Unit * mag) or vector) end
-------------------------
function onClicked() R.Function1.Disabled = true FX.ROLL.BrickColor = BrickColor.new("CGA brown") FX.ROLL.loop.Disabled = true FX.REVERB.BrickColor = BrickColor.new("CGA brown") FX.REVERB.loop.Disabled = true FX.GATE.BrickColor = BrickColor.new("CGA brown") FX.GATE.loop.Disabled = true FX.PHASER.BrickColor = BrickColor.new("CGA brown") FX.PHASER.loop.Disabled = true FX.SLIPROLL.BrickColor = BrickColor.new("CGA brown") FX.SLIPROLL.loop.Disabled = true FX.ECHO.BrickColor = BrickColor.new("CGA brown") FX.ECHO.loop.Disabled = true FX.SENDRETURN.BrickColor = BrickColor.new("Really red") FX.SENDRETURN.loop.Disabled = true FX.TRANS.BrickColor = BrickColor.new("CGA brown") FX.TRANS.loop.Disabled = true FX.MultiTapDelay.BrickColor = BrickColor.new("CGA brown") FX.MultiTapDelay.loop.Disabled = true FX.DELAY.BrickColor = BrickColor.new("CGA brown") FX.DELAY.loop.Disabled = true FX.REVROLL.BrickColor = BrickColor.new("CGA brown") FX.REVROLL.loop.Disabled = true R.loop.Disabled = false R.Function2.Disabled = false end script.Parent.ClickDetector.MouseClick:connect(onClicked)
---------------------------------------------FLASHER RELAY--------------------------------------------------------------------
Controller = script.Parent.Parent.ControllerTimings Flash1 = Controller.FlashTime1.Value Flash2 = Controller.FlashTime2.Value while true do wait() if script.Parent.Parent.SignalValues.CrossingFlash.Value == true then script.Parent.Parent.SignalValues.LightController.Value = 1 wait(Flash1) script.Parent.Parent.SignalValues.LightController.Value = 2 wait(Flash2) else script.Parent.Parent.SignalValues.LightController.Value = 0 end end
--This is the server sided module for handling this vehicles seating requests
local Players = game:GetService("Players") local Workspace = game:GetService("Workspace") local HttpService = game:GetService("HttpService") local DOOR_OPEN_SPEED = 2.15 local DOOR_OPEN_ANGLE = 55 local DOOR_OPEN_TIME = 0.5 --How long the door stays open for when entering/leaving local MAX_SEATING_DISTANCE = 15 local MIN_FLIP_ANGLE = 10 --degrees from vertical local PackagedScripts = script.Parent local PackagedVehicle = PackagedScripts.Parent local RemotesFolder = nil --Set later in the code by the SetRemotesFolder function
--//N//--
if script.Parent.Gear.Value == 0 then if carSeat.Throttle == 1 then carSeat.Parent.Parent.RFW.VS.Throttle = 0 carSeat.Parent.Parent.LFW.VS.Throttle = 0 carSeat.Parent.Parent.RRW.VS.Throttle = 0 carSeat.Parent.Parent.LRW.VS.Throttle = 0 carSeat.Parent.Parent.RRW.VS.Torque = cst.Value carSeat.Parent.Parent.RFW.VS.Torque = cst.Value carSeat.Parent.Parent.LRW.VS.Torque = cst.Value carSeat.Parent.Parent.LFW.VS.Torque = cst.Value carSeat.Parent.Parent.RFW.VS.MaxSpeed = maxsp carSeat.Parent.Parent.LFW.VS.MaxSpeed = maxsp carSeat.Parent.Parent.RRW.VS.MaxSpeed = maxsp carSeat.Parent.Parent.LRW.VS.MaxSpeed = maxsp else carSeat.Parent.Parent.RFW.VS.Throttle = 0 carSeat.Parent.Parent.LFW.VS.Throttle = 0 carSeat.Parent.Parent.RRW.VS.Throttle = 0 carSeat.Parent.Parent.LRW.VS.Throttle = 0 carSeat.Parent.Parent.RRW.VS.Torque = cst.Value carSeat.Parent.Parent.RFW.VS.Torque = cst.Value carSeat.Parent.Parent.LRW.VS.Torque = cst.Value carSeat.Parent.Parent.LFW.VS.Torque = cst.Value carSeat.Parent.Parent.RFW.VS.MaxSpeed = maxsp carSeat.Parent.Parent.LFW.VS.MaxSpeed = maxsp carSeat.Parent.Parent.RRW.VS.MaxSpeed = maxsp carSeat.Parent.Parent.LRW.VS.MaxSpeed = maxsp end if script.Parent.Deployed.Value == false then if carSeat.Steer == 1 and carSeat.Throttle == 1 then carSeat.Parent.Parent.RRW.VS.Torque = cst.Value carSeat.Parent.Parent.RFW.VS.Torque = cst.Value carSeat.Parent.Parent.LRW.VS.Torque = cst.Value carSeat.Parent.Parent.LFW.VS.Torque = cst.Value elseif carSeat.Steer == -1 and carSeat.Throttle == 1 then carSeat.Parent.Parent.LRW.VS.Torque = cst.Value carSeat.Parent.Parent.LFW.VS.Torque = cst.Value carSeat.Parent.Parent.RRW.VS.Torque = cst.Value carSeat.Parent.Parent.LFW.VS.Torque = cst.Value elseif carSeat.Throttle == 1 and carSeat.Steer == 0 then carSeat.Parent.Parent.RRW.VS.Torque = cst.Value carSeat.Parent.Parent.RFW.VS.Torque = cst.Value carSeat.Parent.Parent.LRW.VS.Torque = cst.Value carSeat.Parent.Parent.LFW.VS.Torque = cst.Value elseif carSeat.Throttle == 0 and carSeat.Steer == 0 then carSeat.Parent.Parent.RRW.VS.Torque = cst.Value carSeat.Parent.Parent.RFW.VS.Torque = cst.Value carSeat.Parent.Parent.LRW.VS.Torque = cst.Value carSeat.Parent.Parent.LFW.VS.Torque = cst.Value end end if script.Parent.Deployed.Value == true then if carSeat.Steer == 1 and carSeat.Throttle == 1 then carSeat.Parent.Parent.RRW.VS.Torque = cst.Value carSeat.Parent.Parent.RFW.VS.Torque = cst.Value carSeat.Parent.Parent.LRW.VS.Torque = cst.Value carSeat.Parent.Parent.LFW.VS.Torque = cst.Value elseif carSeat.Steer == -1 and carSeat.Throttle == 1 then carSeat.Parent.Parent.LRW.VS.Torque = cst.Value carSeat.Parent.Parent.LFW.VS.Torque = cst.Value carSeat.Parent.Parent.RRW.VS.Torque = cst.Value carSeat.Parent.Parent.RFW.VS.Torque = cst.Value elseif carSeat.Throttle == 1 and carSeat.Steer == 0 then carSeat.Parent.Parent.RRW.VS.Torque = cst.Value carSeat.Parent.Parent.RFW.VS.Torque = cst.Value carSeat.Parent.Parent.LRW.VS.Torque = cst.Value carSeat.Parent.Parent.LFW.VS.Torque = cst.Value elseif carSeat.Throttle == 0 and carSeat.Steer == 0 then carSeat.Parent.Parent.RRW.VS.Torque = cst.Value carSeat.Parent.Parent.RFW.VS.Torque = cst.Value carSeat.Parent.Parent.LRW.VS.Torque = cst.Value carSeat.Parent.Parent.LFW.VS.Torque = cst.Value end end end
-- Update humanoid's WalkSpeed based on sprint state and health
local function updateWalkSpeed() local sprintKeyDown = checkSprintKeyDown() local baseSpeed = humanoid.Health / 100 * 16 local sprintSpeed = baseSpeed * SPRINT_MULTIPLIER if humanoid.Health <= SPRINT_DISABLED_THRESHOLD then humanoid.WalkSpeed = baseSpeed * 0.5 elseif sprintKeyDown then humanoid.WalkSpeed = sprintSpeed else humanoid.WalkSpeed = baseSpeed end end
-- the Tool, reffered to here as "Block." Do not change it!
Block = script.Parent.Parent.Fuse2Pick -- You CAN change the name in the quotes "Example Tool"
--//For some reason, the audios won't play by themselves, so I've made this script to force play them. ~Wild
script.Parent.ambience1:Play() script.Parent.ambience2:Play() script.Parent.ambience3:Play()
--PUT THIS SCRIPT IN LIGHTING FOR THIS TO WORK --ALSO CHECK TO MAKE SURE THAT THE CAMERA IS NAMED Camera
--black waz here
while wait() do if script.Parent.Parent.Parent.DriveSeat.Throttle == 1 then script.Parent.Fire.Enabled = true script.Parent.Fire.Heat = script.Parent.Parent.Parent.DriveSeat.Velocity.Magnitude/20 elseif script.Parent.Parent.Parent.DriveSeat.Throttle == 0 or script.Parent.Parent.Parent.DriveSeat.Throttle == -1 then script.Parent.Fire.Enabled = false script.Parent.Fire.Heat = 0 end end
--- Sets the text in the command bar text box, and captures focus
function Window:SetEntryText(text) Entry.TextBox.Text = text if self:IsVisible() then Entry.TextBox:CaptureFocus() end end
-- Create component
local ToolList = Roact.PureComponent:extend(script.Name) function ToolList:init() self.Maid = Maid.new() self.CanvasSize, self.SetCanvasSize = Roact.createBinding(UDim2.new()) -- Track current tool self:setState({ CurrentTool = self.props.Core.CurrentTool; }) self.Maid.CurrentTool = self.props.Core.ToolChanged:Connect(function (Tool) self:setState({ CurrentTool = Tool; }) end) end function ToolList:render() local Children = { Layout = new('UIGridLayout', { CellPadding = UDim2.new(0, 0, 0, 0); CellSize = UDim2.new(0, 35, 0, 35); FillDirection = Enum.FillDirection.Horizontal; FillDirectionMaxCells = 2; HorizontalAlignment = Enum.HorizontalAlignment.Left; VerticalAlignment = Enum.VerticalAlignment.Top; SortOrder = Enum.SortOrder.LayoutOrder; StartCorner = Enum.StartCorner.TopLeft; [Roact.Ref] = function (rbx) if rbx then self.SetCanvasSize(UDim2.fromOffset(rbx.AbsoluteContentSize.X, rbx.AbsoluteContentSize.Y)) end end; [Roact.Change.AbsoluteContentSize] = function (rbx) self.SetCanvasSize(UDim2.fromOffset(rbx.AbsoluteContentSize.X, rbx.AbsoluteContentSize.Y)) end; }); } -- Build buttons for each tool for ToolIndex, ToolInfo in ipairs(self.props.Tools) do Children[tostring(ToolIndex)] = new(ToolButton, { CurrentTool = self.state.CurrentTool; IconAssetId = ToolInfo.IconAssetId; HotkeyLabel = ToolInfo.HotkeyLabel; Tool = ToolInfo.Tool; Core = self.props.Core; }) end return new('Frame', { BackgroundTransparency = 0.8; BackgroundColor3 = Color3.fromRGB(0, 0, 0); BorderSizePixel = 0; LayoutOrder = self.props.LayoutOrder; Size = self.CanvasSize:map(function (CanvasSize) return UDim2.fromOffset(CanvasSize.X.Offset, (35) * 7) end); }, { Corners = new('UICorner', { CornerRadius = UDim.new(0, 3); }); SizeConstraint = new('UISizeConstraint', { MinSize = Vector2.new(70, 0); }); List = new('ScrollingFrame', { BackgroundTransparency = 1; BorderSizePixel = 0; Size = UDim2.new(1, 0, 1, 0); CanvasSize = self.CanvasSize; ScrollBarThickness = 1; ScrollingDirection = Enum.ScrollingDirection.Y; ScrollBarImageColor3 = Color3.fromRGB(0, 0, 0); [Roact.Children] = Children; }); }) end return ToolList
--[[ Runs all test and reports the results using the given test reporter. If no reporter is specified, a reasonable default is provided. This function demonstrates the expected workflow with this testing system: 1. Locate test modules 2. Generate test plan 3. Run test plan 4. Report test results This means we could hypothetically present a GUI to the developer that shows the test plan before we execute it, allowing them to toggle specific tests before they're run, but after they've been identified! ]]
function TestBootstrap:run(roots, reporter, otherOptions) reporter = reporter or TextReporter otherOptions = otherOptions or {} local showTimingInfo = otherOptions["showTimingInfo"] or false local testNamePattern = otherOptions["testNamePattern"] local extraEnvironment = otherOptions["extraEnvironment"] or {} if type(roots) ~= "table" then error(("Bad argument #1 to TestBootstrap:run. Expected table, got %s"):format(typeof(roots)), 2) end local startTime = tick() local modules = {} for _, subRoot in ipairs(roots) do local newModules = self:getModules(subRoot) for _, newModule in ipairs(newModules) do table.insert(modules, newModule) end end local afterModules = tick() local plan = TestPlanner.createPlan(modules, testNamePattern, extraEnvironment) local afterPlan = tick() local results = TestRunner.runPlan(plan) local afterRun = tick() reporter.report(results) local afterReport = tick() if showTimingInfo then local timing = { ("Took %f seconds to locate test modules"):format(afterModules - startTime), ("Took %f seconds to create test plan"):format(afterPlan - afterModules), ("Took %f seconds to run tests"):format(afterRun - afterPlan), ("Took %f seconds to report tests"):format(afterReport - afterRun), } print(table.concat(timing, "\n")) end return results end return TestBootstrap
-- << VARIABLES >>
local commandDebounce = main.settings.CommandDebounce main.functionsInLoop = {} main.commandsExecuted = {} main.commandsExecutedDivider = 10
-- Add a callback property to suspense to notify which promises are currently -- in the update queue. This allows reporting and tracing of what is causing -- the user to see a loading state. -- Also allows hydration callbacks to fire when a dehydrated boundary gets -- hydrated or deleted.
exports.enableSuspenseCallback = false
---go ahead and change this if you'd like---
while true do
--RedEgg--
EggEvent.Hitbox.Touched:Connect(function(hit) if hit.Parent:IsA("Tool") and hit.Parent.Name == ToolRequired1 then if game.ReplicatedStorage.ItemSwitching.Value == true then hit.Parent:Destroy() end EggEvent.SoundPart.Insert:Play() EggEvent.RedEgg.Transparency = 0 EggEvent.LocksLeft.Value = EggEvent.LocksLeft.Value - 1 script.Disabled = true EggEvent.Hitbox.RedEggHint:Destroy() end end) EggEvent.Hitbox.ClickDetector.MouseClick:Connect(function(plr) if plr.Backpack:FindFirstChild(ToolRequired1) then if game.ReplicatedStorage.ItemSwitching.Value == true then plr.Backpack:FindFirstChild(ToolRequired1):Destroy() end EggEvent.SoundPart.Insert:Play() EggEvent.RedEgg.Transparency = 0 EggEvent.LocksLeft.Value = EggEvent.LocksLeft.Value - 1 script.Disabled = true EggEvent.Hitbox.RedEggHint:Destroy() end end)
-- / Functions / --
EventModule.ActivateEvent = function() local RandomPlayer1 = PlayingTeam:GetPlayers()[math.random(1, #PlayingTeam:GetPlayers())] local Character1 = RandomPlayer1.Character or RandomPlayer1.CharacterAdded:Wait() local Humanoid1 = Character1:WaitForChild("Humanoid") local HumanoidDescription1 = game.Players:GetHumanoidDescriptionFromUserId(RandomPlayer1.UserId) local RandomPlayer2 if #PlayingTeam:GetPlayers() > GameConfiguration.MinPlayerAmount.Value then repeat task.wait() RandomPlayer2 = PlayingTeam:GetPlayers()[math.random(1, #PlayingTeam:GetPlayers())] until RandomPlayer2.Name ~= RandomPlayer1.Name local Character2 = RandomPlayer2.Character or RandomPlayer2.CharacterAdded:Wait() local Humanoid2 = Character2:WaitForChild("Humanoid") local HumanoidDescription2 = game.Players:GetHumanoidDescriptionFromUserId(RandomPlayer2.UserId) for _, Accessory in pairs(Character1:GetChildren()) do if Accessory:IsA("Accessory") then Accessory:Destroy() end end for _, Accessory in pairs(Character2:GetChildren()) do if Accessory:IsA("Accessory") then Accessory:Destroy() end end Humanoid1:ApplyDescription(HumanoidDescription2) Humanoid2:ApplyDescription(HumanoidDescription1) RandomPlayer1.Team = PlayingTeam RandomPlayer2.Team = PlayingTeam end end
--while true do -- script.Parent.JumpPower.Text = game.Players.LocalPlayer.Character:FindFirstChild("Humanoid").JumpPower -- script.Parent.WalkSpeed.Text = game.Players.LocalPlayer.Character:FindFirstChild("Humanoid").WalkSpeed -- wait() --end
--!nonstrict
local StarterGui = game:GetService("StarterGui") local initialized = false local CameraUI: any = {} do -- Instantaneously disable the toast or enable for opening later on. Used when switching camera modes. function CameraUI.setCameraModeToastEnabled(enabled: boolean) if not enabled and not initialized then return end if not initialized then initialized = true end if not enabled then CameraUI.setCameraModeToastOpen(false) end end function CameraUI.setCameraModeToastOpen(open: boolean) assert(initialized) if open then StarterGui:SetCore("SendNotification", { Title = "Camera Control Enabled", Text = "Right click to toggle", Duration = 3, }) end end end return CameraUI
-- Create a function to update the timer label
local function updateTimerLabel() timerLabel.Text = tostring(tick()) -- make the label text visible in large font timerLabel.FontSize = "Size48" timerLabel.TextColor3 = Color3.new(1,1,1) end
-- fn cst_flt_rdr(string src, int len, fn func) -- @len - Length of type for reader -- @func - Reader callback
local function cst_flt_rdr(len, func) return function(S) local flt = func(S.source, S.index) S.index = S.index + len return flt end end local function stm_instructions(S) local size = S:s_int() local code = {} for i = 1, size do local ins = S:s_ins() local op = bit.band(ins, 0x3F) local args = opcode_t[op] local mode = opcode_m[op] local data = {value = ins, op = op, A = bit.band(bit.rshift(ins, 6), 0xFF)} if args == 'ABC' then data.B = bit.band(bit.rshift(ins, 23), 0x1FF) data.C = bit.band(bit.rshift(ins, 14), 0x1FF) data.is_KB = mode.b == 'OpArgK' and data.B > 0xFF -- post process optimization data.is_KC = mode.c == 'OpArgK' and data.C > 0xFF elseif args == 'ABx' then data.Bx = bit.band(bit.rshift(ins, 14), 0x3FFFF) data.is_K = mode.b == 'OpArgK' elseif args == 'AsBx' then data.sBx = bit.band(bit.rshift(ins, 14), 0x3FFFF) - 131071 end code[i] = data end return code end local function stm_constants(S) local size = S:s_int() local consts = {} for i = 1, size do local tt = stm_byte(S) local k if tt == 1 then k = stm_byte(S) ~= 0 elseif tt == 3 then k = S:s_num() elseif tt == 4 then k = stm_lstring(S) end consts[i] = k -- offset +1 during instruction decode end return consts end local function stm_subfuncs(S, src) local size = S:s_int() local sub = {} for i = 1, size do sub[i] = stm_lua_func(S, src) -- offset +1 in CLOSURE end return sub end local function stm_lineinfo(S) local size = S:s_int() local lines = {} for i = 1, size do lines[i] = S:s_int() end return lines end local function stm_locvars(S) local size = S:s_int() local locvars = {} for i = 1, size do locvars[i] = {varname = stm_lstring(S), startpc = S:s_int(), endpc = S:s_int()} end return locvars end local function stm_upvals(S) local size = S:s_int() local upvals = {} for i = 1, size do upvals[i] = stm_lstring(S) end return upvals end function stm_lua_func(S, psrc) local proto = {} local src = stm_lstring(S) or psrc -- source is propagated proto.source = src -- source name S:s_int() -- line defined S:s_int() -- last line defined proto.numupvals = stm_byte(S) -- num upvalues proto.numparams = stm_byte(S) -- num params stm_byte(S) -- vararg flag stm_byte(S) -- max stack size proto.code = stm_instructions(S) proto.const = stm_constants(S) proto.subs = stm_subfuncs(S, src) proto.lines = stm_lineinfo(S) stm_locvars(S) stm_upvals(S) -- post process optimization for _, v in ipairs(proto.code) do if v.is_K then v.const = proto.const[v.Bx + 1] -- offset for 1 based index else if v.is_KB then v.const_B = proto.const[v.B - 0xFF] end if v.is_KC then v.const_C = proto.const[v.C - 0xFF] end end end return proto end function stm_lua_bytecode(src) -- func reader local rdr_func -- header flags local little local size_int local size_szt local size_ins local size_num local flag_int -- stream object local stream = { -- data index = 1, source = src, } assert(stm_string(stream, 4) == '\27Lua', 'invalid Lua signature') assert(stm_byte(stream) == 0x51, 'invalid Lua version') assert(stm_byte(stream) == 0, 'invalid Lua format') little = stm_byte(stream) ~= 0 size_int = stm_byte(stream) size_szt = stm_byte(stream) size_ins = stm_byte(stream) size_num = stm_byte(stream) flag_int = stm_byte(stream) ~= 0 rdr_func = little and rd_int_le or rd_int_be stream.s_int = cst_int_rdr(size_int, rdr_func) stream.s_szt = cst_int_rdr(size_szt, rdr_func) stream.s_ins = cst_int_rdr(size_ins, rdr_func) if flag_int then stream.s_num = cst_int_rdr(size_num, rdr_func) elseif float_types[size_num] then stream.s_num = cst_flt_rdr(size_num, float_types[size_num][little and 'little' or 'big']) else error('unsupported float size') end return stm_lua_func(stream, '@virtual') end local function close_lua_upvalues(list, index) for i, uv in pairs(list) do if uv.index >= index then uv.value = uv.store[uv.index] -- store value uv.store = uv uv.index = 'value' -- self reference list[i] = nil end end end local function open_lua_upvalue(list, index, stack) local prev = list[index] if not prev then prev = {index = index, store = stack} list[index] = prev end return prev end local function wrap_lua_variadic(...) return select('#', ...), {...} end local function on_lua_error(exst, err) local src = exst.source local line = exst.lines[exst.pc - 1] local psrc, pline, pmsg = err:match('^(.-):(%d+):%s+(.+)') local fmt = '%s:%i: [%s:%i] %s' line = line or '0' psrc = psrc or '?' pline = pline or '0' pmsg = pmsg or err error(string.format(fmt, src, line, psrc, pline, pmsg), 0) end local function exec_lua_func(exst) -- localize for easy lookup local code = exst.code local subs = exst.subs local env = exst.env local upvs = exst.upvals local vargs = exst.varargs -- state variables local stktop = -1 local openupvs = {} local stack = exst.stack local pc = exst.pc while true do local inst = code[pc] local op = inst.op pc = pc + 1 if op < 19 then if op < 9 then if op < 4 then if op < 2 then if op < 1 then --[[0 MOVE]] stack[inst.A] = stack[inst.B] else --[[1 LOADK]] stack[inst.A] = inst.const end elseif op > 2 then --[[3 LOADNIL]] for i = inst.A, inst.B do stack[i] = nil end else --[[2 LOADBOOL]] stack[inst.A] = inst.B ~= 0 if inst.C ~= 0 then pc = pc + 1 end end elseif op > 4 then if op < 7 then if op < 6 then --[[5 GETGLOBAL]] stack[inst.A] = env[inst.const] else --[[6 GETTABLE]] local index if inst.is_KC then index = inst.const_C else index = stack[inst.C] end stack[inst.A] = stack[inst.B][index] end elseif op > 7 then --[[8 SETUPVAL]] local uv = upvs[inst.B] uv.store[uv.index] = stack[inst.A] else --[[7 SETGLOBAL]] env[inst.const] = stack[inst.A] end else --[[4 GETUPVAL]] local uv = upvs[inst.B] stack[inst.A] = uv.store[uv.index] end elseif op > 9 then if op < 14 then if op < 12 then if op < 11 then --[[10 NEWTABLE]] stack[inst.A] = {} else --[[11 SELF]] local A = inst.A local B = inst.B local index if inst.is_KC then index = inst.const_C else index = stack[inst.C] end stack[A + 1] = stack[B] stack[A] = stack[B][index] end elseif op > 12 then --[[13 SUB]] local lhs, rhs if inst.is_KB then lhs = inst.const_B else lhs = stack[inst.B] end if inst.is_KC then rhs = inst.const_C else rhs = stack[inst.C] end stack[inst.A] = lhs - rhs else --[[12 ADD]] local lhs, rhs if inst.is_KB then lhs = inst.const_B else lhs = stack[inst.B] end if inst.is_KC then rhs = inst.const_C else rhs = stack[inst.C] end stack[inst.A] = lhs + rhs end elseif op > 14 then if op < 17 then if op < 16 then --[[15 DIV]] local lhs, rhs if inst.is_KB then lhs = inst.const_B else lhs = stack[inst.B] end if inst.is_KC then rhs = inst.const_C else rhs = stack[inst.C] end stack[inst.A] = lhs / rhs else --[[16 MOD]] local lhs, rhs if inst.is_KB then lhs = inst.const_B else lhs = stack[inst.B] end if inst.is_KC then rhs = inst.const_C else rhs = stack[inst.C] end stack[inst.A] = lhs % rhs end elseif op > 17 then --[[18 UNM]] stack[inst.A] = -stack[inst.B] else --[[17 POW]] local lhs, rhs if inst.is_KB then lhs = inst.const_B else lhs = stack[inst.B] end if inst.is_KC then rhs = inst.const_C else rhs = stack[inst.C] end stack[inst.A] = lhs ^ rhs end else --[[14 MUL]] local lhs, rhs if inst.is_KB then lhs = inst.const_B else lhs = stack[inst.B] end if inst.is_KC then rhs = inst.const_C else rhs = stack[inst.C] end stack[inst.A] = lhs * rhs end else --[[9 SETTABLE]] local index, value if inst.is_KB then index = inst.const_B else index = stack[inst.B] end if inst.is_KC then value = inst.const_C else value = stack[inst.C] end stack[inst.A][index] = value end elseif op > 19 then if op < 29 then if op < 24 then if op < 22 then if op < 21 then --[[20 LEN]] stack[inst.A] = #stack[inst.B] else --[[21 CONCAT]] local str = stack[inst.B] for i = inst.B + 1, inst.C do str = str .. stack[i] end stack[inst.A] = str end elseif op > 22 then --[[23 EQ]] local lhs, rhs if inst.is_KB then lhs = inst.const_B else lhs = stack[inst.B] end if inst.is_KC then rhs = inst.const_C else rhs = stack[inst.C] end if (lhs == rhs) ~= (inst.A ~= 0) then pc = pc + 1 end else --[[22 JMP]] pc = pc + inst.sBx end elseif op > 24 then if op < 27 then if op < 26 then --[[25 LE]] local lhs, rhs if inst.is_KB then lhs = inst.const_B else lhs = stack[inst.B] end if inst.is_KC then rhs = inst.const_C else rhs = stack[inst.C] end if (lhs <= rhs) ~= (inst.A ~= 0) then pc = pc + 1 end else --[[26 TEST]] if (not stack[inst.A]) == (inst.C ~= 0) then pc = pc + 1 end end elseif op > 27 then --[[28 CALL]] local A = inst.A local B = inst.B local C = inst.C local params local sz_vals, l_vals if B == 0 then params = stktop - A else params = B - 1 end sz_vals, l_vals = wrap_lua_variadic(stack[A](unpack(stack, A + 1, A + params))) if C == 0 then stktop = A + sz_vals - 1 else sz_vals = C - 1 end for i = 1, sz_vals do stack[A + i - 1] = l_vals[i] end else --[[27 TESTSET]] local A = inst.A local B = inst.B if (not stack[B]) == (inst.C ~= 0) then pc = pc + 1 else stack[A] = stack[B] end end else --[[24 LT]] local lhs, rhs if inst.is_KB then lhs = inst.const_B else lhs = stack[inst.B] end if inst.is_KC then rhs = inst.const_C else rhs = stack[inst.C] end if (lhs < rhs) ~= (inst.A ~= 0) then pc = pc + 1 end end elseif op > 29 then if op < 34 then if op < 32 then if op < 31 then --[[30 RETURN]] local A = inst.A local B = inst.B local vals = {} local size if B == 0 then size = stktop - A + 1 else size = B - 1 end for i = 1, size do vals[i] = stack[A + i - 1] end close_lua_upvalues(openupvs, math.huge) return size, vals else --[[31 FORLOOP]] local A = inst.A local step = stack[A + 2] local index = stack[A] + step local limit = stack[A + 1] local loops if step == math.abs(step) then loops = index <= limit else loops = index >= limit end if loops then stack[inst.A] = index stack[inst.A + 3] = index pc = pc + inst.sBx end end elseif op > 32 then --[[33 TFORLOOP]] local A = inst.A local func = stack[A] local state = stack[A + 1] local index = stack[A + 2] local base = A + 3 local vals stack[base + 2] = index stack[base + 1] = state stack[base] = func vals = {func(state, index)} for i = 1, inst.C do stack[base + i - 1] = vals[i] end if stack[base] ~= nil then stack[A + 2] = stack[base] else pc = pc + 1 end else --[[32 FORPREP]] local A = inst.A local init, limit, step init = assert(tonumber(stack[A]), '`for` initial value must be a number') limit = assert(tonumber(stack[A + 1]), '`for` limit must be a number') step = assert(tonumber(stack[A + 2]), '`for` step must be a number') stack[A] = init - step stack[A + 1] = limit stack[A + 2] = step pc = pc + inst.sBx end elseif op > 34 then if op < 36 then --[[35 CLOSE]] close_lua_upvalues(openupvs, inst.A) elseif op > 36 then --[[37 VARARG]] local A = inst.A local size = inst.B if size == 0 then size = vargs.size stktop = A + size - 1 end for i = 1, size do stack[A + i - 1] = vargs.list[i] end else --[[36 CLOSURE]] local sub = subs[inst.Bx + 1] -- offset for 1 based index local nups = sub.numupvals local uvlist if nups ~= 0 then uvlist = {} for i = 1, nups do local pseudo = code[pc + i - 1] if pseudo.op == 0 then -- @MOVE uvlist[i - 1] = open_lua_upvalue(openupvs, pseudo.B, stack) elseif pseudo.op == 4 then -- @GETUPVAL uvlist[i - 1] = upvs[pseudo.B] end end pc = pc + nups end stack[inst.A] = wrap_lua_func(sub, env, uvlist) end else --[[34 SETLIST]] local A = inst.A local C = inst.C local size = inst.B local tab = stack[A] local offset if size == 0 then size = stktop - A end if C == 0 then C = inst[pc].value pc = pc + 1 end offset = (C - 1) * FIELDS_PER_FLUSH for i = 1, size do tab[i + offset] = stack[A + i] end end else --[[29 TAILCALL]] local A = inst.A local B = inst.B local params if B == 0 then params = stktop - A else params = B - 1 end close_lua_upvalues(openupvs, math.huge) return wrap_lua_variadic(stack[A](unpack(stack, A + 1, A + params))) end else --[[19 NOT]] stack[inst.A] = not stack[inst.B] end exst.pc = pc end end function wrap_lua_func(state, env, upvals) local st_code = state.code local st_subs = state.subs local st_lines = state.lines local st_source = state.source local st_numparams = state.numparams local function exec_wrap(...) local stack = {} local varargs = {} local sizevarg = 0 local sz_args, l_args = wrap_lua_variadic(...) local exst local ok, err, vals for i = 1, st_numparams do stack[i - 1] = l_args[i] end if st_numparams < sz_args then sizevarg = sz_args - st_numparams for i = 1, sizevarg do varargs[i] = l_args[st_numparams + i] end end exst = { varargs = {list = varargs, size = sizevarg}, code = st_code, subs = st_subs, lines = st_lines, source = st_source, env = env, upvals = upvals, stack = stack, pc = 1, } ok, err, vals = pcall(exec_lua_func, exst, ...) if ok then return unpack(vals, 1, err) else on_lua_error(exst, err) end return -- explicit "return nothing" end return exec_wrap end return function(BCode, Env) return wrap_lua_func(stm_lua_bytecode(BCode), Env or getfenv(0)) end
--[[Controls]]
local _CTRL = _Tune.Controls local Controls = Instance.new("Folder",script.Parent) Controls.Name = "Controls" for i,v in pairs(_CTRL) do local a=Instance.new("StringValue",Controls) a.Name=i a.Value=v.Name a.Changed:connect(function() if i=="MouseThrottle" or i=="MouseBrake" then if a.Value == "MouseButton1" or a.Value == "MouseButton2" then _CTRL[i]=Enum.UserInputType[a.Value] else _CTRL[i]=Enum.KeyCode[a.Value] end else _CTRL[i]=Enum.KeyCode[a.Value] end end) end --Deadzone Adjust local _PPH = _Tune.Peripherals for i,v in pairs(_PPH) do local a = Instance.new("IntValue",Controls) a.Name = i a.Value = v a.Changed:connect(function() a.Value=math.min(100,math.max(0,a.Value)) _PPH[i] = a.Value end) end --Input Handler function DealWithInput(input,IsRobloxFunction) if (UserInputService:GetFocusedTextBox()==nil) and not _InControls then --Ignore when UI Focus --Shift Down [Manual Transmission] if _IsOn and (input.KeyCode ==_CTRL["ContlrShiftDown"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftDown"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftDown"])) and (_TMode=="Semi" or (_TMode=="Manual" and (not _ClutchOn))) and input.UserInputState == Enum.UserInputState.Begin then if _CGear == 0 and (_TMode=="Auto" or not _ClPressing) then _ClutchOn = true end _CGear = math.max(_CGear-1,-1) --Shift Up [Manual Transmission] elseif _IsOn and (input.KeyCode ==_CTRL["ContlrShiftUp"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftUp"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftUp"])) and (_TMode=="Semi" or (_TMode=="Manual" and (not _ClutchOn))) and input.UserInputState == Enum.UserInputState.Begin then if _CGear == 0 and (_TMode=="Auto" or not _ClPressing) then _ClutchOn = true end _CGear = math.min(_CGear+1,#_Tune.Ratios-2) --Toggle Clutch elseif _IsOn and (input.KeyCode ==_CTRL["ContlrClutch"] or (_MSteer and input.KeyCode==_CTRL["MouseClutch"]) or ((not _MSteer) and input.KeyCode==_CTRL["Clutch"])) and _TMode=="Manual" then if input.UserInputState == Enum.UserInputState.Begin then _ClutchOn = false _ClPressing = true elseif input.UserInputState == Enum.UserInputState.End then _ClutchOn = true _ClPressing = false end --Toggle PBrake elseif _IsOn and input.KeyCode ==_CTRL["ContlrPBrake"] or (_MSteer and input.KeyCode==_CTRL["MousePBrake"]) or ((not _MSteer) and input.KeyCode==_CTRL["PBrake"]) then if input.UserInputState == Enum.UserInputState.Begin then _PBrake = not _PBrake elseif input.UserInputState == Enum.UserInputState.End then if car.Body.CarName.Value.VehicleSeat.Velocity.Magnitude>5 then _PBrake = false end end --Toggle Transmission Mode elseif (input.KeyCode == _CTRL["ContlrToggleTMode"] or input.KeyCode==_CTRL["ToggleTransMode"]) and input.UserInputState == Enum.UserInputState.Begin then local n=1 for i,v in pairs(_Tune.TransModes) do if v==_TMode then n=i break end end n=n+1 if n>#_Tune.TransModes then n=1 end _TMode = _Tune.TransModes[n] --Throttle elseif _IsOn and ((not _MSteer) and (input.KeyCode==_CTRL["Throttle"] or input.KeyCode == _CTRL["Throttle2"])) or ((((_CTRL["MouseThrottle"]==Enum.UserInputType.MouseButton1 or _CTRL["MouseThrottle"]==Enum.UserInputType.MouseButton2) and input.UserInputType == _CTRL["MouseThrottle"]) or input.KeyCode == _CTRL["MouseThrottle"])and _MSteer) then if input.UserInputState == Enum.UserInputState.Begin then _GThrot = 1 else _GThrot = _Tune.IdleThrottle/100 end --Brake elseif ((not _MSteer) and (input.KeyCode==_CTRL["Brake"] or input.KeyCode == _CTRL["Brake2"])) or ((((_CTRL["MouseBrake"]==Enum.UserInputType.MouseButton1 or _CTRL["MouseBrake"]==Enum.UserInputType.MouseButton2) and input.UserInputType == _CTRL["MouseBrake"]) or input.KeyCode == _CTRL["MouseBrake"])and _MSteer) then if input.UserInputState == Enum.UserInputState.Begin then _GBrake = 1 else _GBrake = 0 end --Steer Left elseif (not _MSteer) and (input.KeyCode==_CTRL["SteerLeft"] or input.KeyCode == _CTRL["SteerLeft2"]) then if input.UserInputState == Enum.UserInputState.Begin then _GSteerT = -1 _SteerL = true else if _SteerR then _GSteerT = 1 else _GSteerT = 0 end _SteerL = false end --Steer Right elseif (not _MSteer) and (input.KeyCode==_CTRL["SteerRight"] or input.KeyCode == _CTRL["SteerRight2"]) then if input.UserInputState == Enum.UserInputState.Begin then _GSteerT = 1 _SteerR = true else if _SteerL then _GSteerT = -1 else _GSteerT = 0 end _SteerR = false end --Toggle Mouse Controls elseif input.KeyCode ==_CTRL["ToggleMouseDrive"] then if input.UserInputState == Enum.UserInputState.End then _MSteer = not _MSteer _GThrot = _Tune.IdleThrottle/100 _GBrake = 0 _GSteerT = 0 _ClutchOn = true end --Toggle TCS elseif _Tune.TCSEnabled and _IsOn and input.KeyCode == _CTRL["ToggleTCS"] or input.KeyCode == _CTRL["ContlrToggleTCS"] then if input.UserInputState == Enum.UserInputState.End then _TCS = not _TCS end --Toggle ABS elseif _Tune. ABSEnabled and _IsOn and input.KeyCode == _CTRL["ToggleABS"] or input.KeyCode == _CTRL["ContlrToggleABS"] then if input.UserInputState == Enum.UserInputState.End then _ABS = not _ABS end end --Variable Controls if input.UserInputType.Name:find("Gamepad") then --Gamepad Steering if input.KeyCode == _CTRL["ContlrSteer"] then if input.Position.X>= 0 then local cDZone = math.min(.99,_Tune.Peripherals.ControlRDZone/100) if math.abs(input.Position.X)>cDZone then _GSteerT = (input.Position.X-cDZone)/(1-cDZone) else _GSteerT = 0 end else local cDZone = math.min(.99,_Tune.Peripherals.ControlLDZone/100) if math.abs(input.Position.X)>cDZone then _GSteerT = (input.Position.X+cDZone)/(1-cDZone) else _GSteerT = 0 end end --Gamepad Throttle elseif _IsOn and input.KeyCode == _CTRL["ContlrThrottle"] then _GThrot = math.max(_Tune.IdleThrottle/100,input.Position.Z) --Gamepad Brake elseif input.KeyCode == _CTRL["ContlrBrake"] then _GBrake = input.Position.Z end end else _GThrot = _Tune.IdleThrottle/100 _GSteerT = 0 _GBrake = 0 if _CGear~=0 then _ClutchOn = true end end end UserInputService.InputBegan:connect(DealWithInput) UserInputService.InputChanged:connect(DealWithInput) UserInputService.InputEnded:connect(DealWithInput)
--------| Reference |--------
local isServer = game:GetService("RunService"):IsServer()
-- Decompiled with the Synapse X Luau decompiler.
client = nil; service = nil; cPcall = nil; Pcall = nil; Routine = nil; GetEnv = nil; origEnv = nil; logError = nil; return function() local u1 = nil; local l__client__2 = client; local u3 = nil; local u4 = nil; local u5 = nil; local u6 = nil; local u7 = nil; local u8 = nil; getfenv().client = nil; getfenv().service = nil; getfenv().script = nil; local v1 = { Init = function() u1 = l__client__2.UI; u3 = l__client__2.Anti; u4 = l__client__2.Core; u5 = l__client__2.Variables; u6 = l__client__2.Functions; u7 = l__client__2.Process; u8 = l__client__2.Remote; end, Returns = {}, PendingReturns = {}, EncodeCache = {}, DecodeCache = {}, Received = 0, Sent = 0 }; local v2 = {}; local l__unpack__9 = unpack; function v2.Test(p1) return "HELLO FROM THE CLIENT SIDE :)! ", l__unpack__9(p1); end; function v2.Ping(p2) return u8.Ping(); end; function v2.ClientHooked(p3) return u4.Special; end; local l__next__10 = next; local l__service__11 = service; local l__os__12 = os; local l__tostring__13 = tostring; local l__table__14 = table; function v2.TaskManager(p4) if p4[1] ~= "GetTasks" then return; end; local v3 = {}; local v4, v5 = l__service__11.GetTasks(); while true do local v6, v7 = l__next__10(v4, v5); if not v6 then break; end; v5 = v6; l__table__14.insert(v3, { Status = v7.Status, Name = v7.Name, Index = v7.Index, Created = v7.Created, CurrentTime = l__os__12.time(), Function = l__tostring__13(v7.Function) }); end; return v3; end; function v2.LoadCode(p5) local v8 = u4.LoadCode(p5[1], GetEnv()); if not v8 then return; end; return v8(); end; local l__type__15 = type; function v2.Function(p6) local v9 = l__client__2.Functions[p6[1]]; if not v9 or l__type__15(v9) ~= "function" then return; end; return v9(l__unpack__9(p6, 2)); end; function v2.Handler(p7) local v10 = l__client__2.Handlers[p7[1]]; if not v10 or l__type__15(v10) ~= "function" then return; end; return v10(l__unpack__9(p7, 2)); end; function v2.UIKeepAlive(p8) if u5.UIKeepAlive then for v11, v12 in l__next__10, l__client__2.GUIs do if v12.KeepAlive then if v12.Class == "ScreenGui" or v12.Class == "GuiMain" then v12.Object.Parent = l__service__11.Player.PlayerGui; elseif v12.Class == "TextLabel" then v12.Object.Parent = u1.GetHolder(); end; v12.KeepAlive = false; end; end; end; return true; end; function v2.UI(p9) return u1.Make(p9[1], p9[3], p9[2]); end; function v2.InstanceList(p10) local v13 = {}; for v14, v15 in l__next__10, l__service__11.GetAdonisObjects() do l__table__14.insert(v13, { Text = v15:GetFullName(), Desc = v15.ClassName }); end; return v13; end; local l__Enum__16 = Enum; local l__Color3__17 = Color3; function v2.ClientLog(p11) local u18 = {}; local function v16(p12, p13, p14) local v17, v18 = l__service__11.ExtractLines(p12); while true do local v19, v20 = l__next__10(v17, v18); if not v19 then break; end; v18 = v19; l__table__14.insert(u18, { Text = v20, Desc = p13 .. v20, Color = p14 }); end; end; local v21, v22 = l__service__11.LogService:GetLogHistory(); while true do local v23, v24 = l__next__10(v21, v22); if not v23 then break; end; v22 = v23; if v24.messageType == l__Enum__16.MessageType.MessageOutput then v16(v24.message, "Output: "); elseif v24.messageType == l__Enum__16.MessageType.MessageWarning then v16(v24.message, "Warning: ", l__Color3__17.new(1, 1, 0)); elseif v24.messageType == l__Enum__16.MessageType.MessageInfo then v16(v24.message, "Info: ", l__Color3__17.new(0, 0, 1)); elseif v24.messageType == l__Enum__16.MessageType.MessageError then v16(v24.message, "Error: ", l__Color3__17.new(1, 0, 0)); end; end; return u18; end; v1.Returnables = v2; local v25 = {}; local l__print__19 = print; local l__wait__20 = wait; function v25.LightingChange(p15, p16) l__print__19(p15, "TICKLE ME!?"); u5.LightingChanged = true; l__service__11.Lighting[p15] = p16; u3.LastChanges.Lighting = p15; l__wait__20(0.1); u5.LightingChanged = false; l__print__19("TICKLED :)", u5.LightingChanged); if u3.LastChanges.Lighting == p15 then u3.LastChanges.Lighting = nil; end; end; v1.UnEncrypted = v25; local v26 = {}; local l__pcall__21 = pcall; function v26.GetReturn(p17) l__print__19("THE SERVER IS ASKING US FOR A RETURN"); local v27 = p17[2]; local v28 = { l__unpack__9(p17, 3) }; local v29 = u8.Returnables[p17[1]]; if v29 then local v30 = { l__pcall__21(v29, v28) } or {}; else v30 = {}; end; if v30[1] == true then l__print__19("SENT RETURN"); u8.Send("GiveReturn", v27, l__unpack__9(v30, 2)); return; end; logError(v30[2]); u8.Send("GiveReturn", v27, "__ADONIS_RETURN_ERROR", v30[2]); end; function v26.GiveReturn(p18) l__print__19("SERVER GAVE US A RETURN"); if u8.PendingReturns[p18[1]] then l__print__19("VALID PENDING RETURN"); u8.PendingReturns[p18[1]] = nil; l__service__11.Events[p18[1]]:fire(l__unpack__9(p18, 2)); end; end; function v26.SetVariables(p19) for v31, v32 in l__next__10, p19[1] do u5[v31] = v32; end; end; function v26.Print(p20) l__print__19(l__unpack__9(p20)); end; function v26.FireEvent(p21) l__service__11.FireEvent(l__unpack__9(p21)); end; function v26.Test(p22) l__print__19("OK WE GOT COMMUNICATION! ORGL: " .. l__tostring__13(p22[1])); end; local l__error__22 = error; function v26.TestError(p23) l__error__22("THIS IS A TEST ERROR"); end; function v26.TestEvent(p24) u8.PlayerEvent(p24[1], l__unpack__9(p24, 2)); end; function v26.LoadCode(p25) local v33 = u4.LoadCode(p25[1], GetEnv()); if not v33 then return; end; return v33(); end; function v26.LaunchAnti(p26) u3.Launch(p26[1], p26[2]); end; function v26.UI(p27) u1.Make(p27[1], p27[3], p27[2]); end; function v26.RemoveUI(p28) u1.Remove(p28[1], p28[2]); end; function v26.StartLoop(p29) local v34 = p29[1]; local v35 = p29[2]; local v36 = p29[3]; local v37 = u4.LoadCode(v36, GetEnv()); if v34 and v35 and v36 and v37 then l__service__11.StartLoop(v34, v35, v37); end; end; function v26.StopLoop(p30) l__service__11.StopLoop(p30[1]); end; function v26.Function(p31) local v38 = l__client__2.Functions[p31[1]]; if v38 and l__type__15(v38) == "function" then Pcall(v38, l__unpack__9(p31, 2)); end; end; function v26.Handler(p32) local v39 = l__client__2.Handlers[p32[1]]; if v39 and l__type__15(v39) == "function" then Pcall(v39, l__unpack__9(p32, 2)); end; end; v1.Commands = v26; function v1.Fire(...) local l__RateLimits__40 = u7.RateLimits; local l__RemoteEvent__41 = u4.RemoteEvent; if l__RemoteEvent__41 and l__RemoteEvent__41.Object then local u23 = { ... }; local u24 = l__RateLimits__40 and l__RateLimits__40.Remote or 0.01; l__service__11.Queue("REMOTE_SEND", function() u8.Sent = u8.Sent + 1; l__RemoteEvent__41.Object:FireServer({ Mode = "Fire", Module = l__client__2.Module, Loader = l__client__2.Loader, Sent = u8.Sent, Received = u8.Received }, l__unpack__9(u23)); l__wait__20(u24); end); end; end; local l__tick__25 = tick; function v1.Send(p33, ...) u4.LastUpdate = l__tick__25(); u8.Fire(u8.Encrypt(p33, u4.Key), ...); end; function v1.GetFire(...) local l__RemoteEvent__42 = u4.RemoteEvent; local l__RateLimits__43 = u7.RateLimits; if l__RemoteEvent__42 and l__RemoteEvent__42.Function then local u26 = nil; local u27 = { ... }; local u28 = l__service__11.New("BindableEvent"); local u29 = l__RateLimits__43 and l__RateLimits__43.Remote or 0.02; l__service__11.Queue("REMOTE_SEND", function() u8.Sent = u8.Sent + 1; spawn(function() u26 = { l__RemoteEvent__42.Function:InvokeServer({ Mode = "Get", Module = l__client__2.Module, Loader = l__client__2.Loader, Sent = u8.Sent, Received = u8.Received }, l__unpack__9(u27)) }; u28:Fire(); end); l__wait__20(u29); end); if not u26 then u28.Event:Wait(); u28:Destroy(); end; if u26 then return l__unpack__9(u26); end; end; end; function v1.Get(p34, ...) u4.LastUpdate = l__tick__25(); local v44 = u8.GetFire(u8.Encrypt(p34, u4.Key), ...); if l__type__15(v44) ~= "table" then return v44; end; return l__unpack__9(v44); end; local l__string__30 = string; function v1.OldGet(p35, ...) local v45 = u6:GetRandom(); local u31 = nil; local u32 = l__service__11.New("BindableEvent"); local v46 = l__service__11.Events[v45]:Connect(function(...) l__print__19("WE ARE GETTING A RETURN!"); u31 = { ... }; u32:Fire(); l__wait__20(); u32:Fire(); u32:Destroy(); end); u8.PendingReturns[v45] = true; u8.Send("GetReturn", p35, v45, ...); l__print__19(l__string__30.format("GETTING RETURNS? %s", l__tostring__13(u31))); u32.Event:Wait(); l__print__19(l__string__30.format("WE GOT IT! %s", l__tostring__13(u31))); v46:Disconnect(); if not u31 then return nil; end; if u31[1] ~= "__ADONIS_RETURN_ERROR" then return l__unpack__9(u31); end; l__error__22(u31[2]); end; local l__math__33 = math; function v1.Ping() if not u8.Get("Ping") then return false; end; return l__math__33.floor((l__tick__25() - l__tick__25()) * 1000 + 0.5) / 1000 * 100; end; function v1.PlayerEvent(p36, ...) u8.Send("PlayerEvent", p36, ...); end; function v1.Encrypt(p37, p38, p39) local v47 = p39 or (u8.EncodeCache or {}); if not p38 or not p37 then return p37; end; if v47[p38] and v47[p38][p37] then return v47[p38][p37]; end; local v48 = v47[p38] or {}; local l__byte__49 = l__string__30.byte; local l__abs__50 = l__math__33.abs; local l__sub__51 = l__string__30.sub; local l__len__52 = l__string__30.len; local l__char__53 = l__string__30.char; local v54 = {}; for v55 = 1, l__len__52(p37) do local v56 = v55 % l__len__52(p38) + 1; v54[v55] = l__string__30.char((l__byte__49(l__sub__51(p37, v55, v55)) + l__byte__49(l__sub__51(p38, v56, v56))) % 126 + 1); end; local v57 = l__table__14.concat(v54); v47[p38] = v48; v48[p37] = v57; return v57; end; function v1.Decrypt(p40, p41, p42) local v58 = p42 or (u8.DecodeCache or {}); if not p41 or not p40 then return p40; end; if v58[p41] and v58[p41][p40] then return v58[p41][p40]; end; local v59 = v58[p41] or {}; local l__byte__60 = l__string__30.byte; local l__abs__61 = l__math__33.abs; local l__sub__62 = l__string__30.sub; local l__len__63 = l__string__30.len; local l__char__64 = l__string__30.char; local v65 = {}; for v66 = 1, l__len__63(p40) do local v67 = v66 % l__len__63(p41) + 1; v65[v66] = l__string__30.char((l__byte__60(l__sub__62(p40, v66, v66)) - l__byte__60(l__sub__62(p41, v67, v67))) % 126 - 1); end; local v68 = l__table__14.concat(v65); v58[p41] = v59; v59[p40] = v68; return v68; end; l__client__2.Remote = v1; end;
--[[ Local Functions ]]
-- function MouseLockController:OnMouseLockToggled() self.isMouseLocked = not self.isMouseLocked if self.isMouseLocked then local cursorImageValueObj = script:FindFirstChild("CursorImage") if cursorImageValueObj and cursorImageValueObj:IsA("StringValue") and cursorImageValueObj.Value then self.savedMouseCursor = Mouse.Icon Mouse.Icon = cursorImageValueObj.Value else if cursorImageValueObj then cursorImageValueObj:Destroy() end cursorImageValueObj = Instance.new("StringValue") cursorImageValueObj.Name = "CursorImage" cursorImageValueObj.Value = DEFAULT_MOUSE_LOCK_CURSOR cursorImageValueObj.Parent = script self.savedMouseCursor = Mouse.Icon Mouse.Icon = DEFAULT_MOUSE_LOCK_CURSOR end else if self.savedMouseCursor then Mouse.Icon = self.savedMouseCursor self.savedMouseCursor = nil end end self.mouseLockToggledEvent:Fire() end function MouseLockController:DoMouseLockSwitch(name, state, input) if state == Enum.UserInputState.Begin then self:OnMouseLockToggled() return Enum.ContextActionResult.Sink end return Enum.ContextActionResult.Pass end function MouseLockController:BindContextActions() ContextActionService:BindActionAtPriority(CONTEXT_ACTION_NAME, function(name, state, input) return self:DoMouseLockSwitch(name, state, input) end, false, MOUSELOCK_ACTION_PRIORITY, unpack(self.boundKeys)) end function MouseLockController:UnbindContextActions() ContextActionService:UnbindAction(CONTEXT_ACTION_NAME) end function MouseLockController:IsMouseLocked() return self.enabled and self.isMouseLocked end function MouseLockController:EnableMouseLock(enable) if enable~=self.enabled then self.enabled = enable if self.enabled then -- Enabling the mode self:BindContextActions() else -- Disabling -- Restore mouse cursor if Mouse.Icon~="" then Mouse.Icon = "" end self:UnbindContextActions() -- If the mode is disabled while being used, fire the event to toggle it off if self.isMouseLocked then self.mouseLockToggledEvent:Fire() end self.isMouseLocked = false end end end return MouseLockController
-- Decompiled with the Synapse X Luau decompiler.
local u1 = nil; coroutine.wrap(function() u1 = require(game.ReplicatedStorage:WaitForChild("Resources")); end)(); return function(p1, p2, p3, p4) p1 = p1 or 1; p2 = p2 or 1; p3 = p3 or Color3.new(1, 1, 1); p4 = p4 or 0; task.defer(function() local v1 = Instance.new("Frame"); v1.BackgroundTransparency = 1; v1.BackgroundColor3 = p3; v1.Size = UDim2.new(2, 0, 2, 0); v1.AnchorPoint = Vector2.new(0.5, 0.5); v1.Position = UDim2.new(0.5, 0, 0.5, 0); v1.BorderSizePixel = 0; v1.Parent = u1.GFX.GetHolder(); if p1 > 0 then u1.Functions.Tween(v1, { p1, 8, 1 }, { BackgroundTransparency = p4 }); task.wait(p1); else v1.BackgroundTransparency = p4; end; if p2 > 0 then u1.Functions.Tween(v1, { p2, 1, 1 }, { BackgroundTransparency = 1 }); task.wait(p2); else v1.BackgroundTransparency = 1; end; v1:Destroy(); end); end;
--// Script
BUYB.MouseButton1Click:connect(function() if Player.Cash.Value >= Price.Value then Player.Cash.Value = Player.Cash.Value - Price.Value local weapon =game.ReplicatedStorage.Weapons[Frame.Name]:clone() weapon.Parent = Player.Backpack end end)
-- This decides what to do if detection is 'Automatic' -- This is placed in ZoneController instead of the Zone object due to the ZoneControllers all-knowing group-minded logic
function ZoneController.updateDetection(zone) local detectionTypes = { ["enterDetection"] = "_currentEnterDetection", ["exitDetection"] = "_currentExitDetection", } for detectionType, currentDetectionName in pairs(detectionTypes) do local detection = zone[detectionType] local combinedTotalVolume = Tracker.getCombinedTotalVolumes() if detection == enum.Detection.Automatic then if combinedTotalVolume > WHOLE_BODY_DETECTION_LIMIT then detection = enum.Detection.Centre else detection = enum.Detection.WholeBody end end zone[currentDetectionName] = detection end end function ZoneController._formHeartbeat(registeredTriggerType) local heartbeatConnection = heartbeatConnections[registeredTriggerType] if heartbeatConnection then return end -- This will only ever connect once per triggerType per server -- This means instead of initiating a loop per-zone we can handle everything within -- a singular connection. This is particularly beneficial for player/item-orinetated -- checking, where a check only needs to be cast once per interval, as apposed -- to every zone per interval -- I utilise heartbeat with os.clock() to provide precision (where needed) and flexibility local nextCheck = 0 heartbeatConnection = heartbeat:Connect(function() local clockTime = os.clock() if clockTime >= nextCheck then local lowestAccuracy local lowestDetection for zone, _ in pairs(activeZones) do if zone.activeTriggers[registeredTriggerType] then local zAccuracy = zone.accuracy if lowestAccuracy == nil or zAccuracy < lowestAccuracy then lowestAccuracy = zAccuracy end ZoneController.updateDetection(zone) local zDetection = zone._currentEnterDetection if lowestDetection == nil or zDetection < lowestDetection then lowestDetection = zDetection end end end local highestAccuracy = lowestAccuracy local zonesAndOccupants = heartbeatActions[registeredTriggerType](lowestDetection) -- If a zone belongs to a settingsGroup with 'onlyEnterOnceExitedAll = true' , and the occupant already exists in a member group, then -- ignore all incoming occupants for the other zones (preventing the enteredSignal from being fired until the occupant has left -- all other zones within the same settingGroup) local occupantsToBlock = {} local zonesToPotentiallyIgnore = {} for zone, newOccupants in pairs(zonesAndOccupants) do local settingsGroup = (zone.settingsGroupName and ZoneController.getGroup(zone.settingsGroupName)) if settingsGroup and settingsGroup.onlyEnterOnceExitedAll == true then --local currentOccupants = zone.occupants[registeredTriggerType] --if currentOccupants then for newOccupant, _ in pairs(newOccupants) do --if currentOccupants[newOccupant] then local groupDetail = occupantsToBlock[zone.settingsGroupName] if not groupDetail then groupDetail = {} occupantsToBlock[zone.settingsGroupName] = groupDetail end groupDetail[newOccupant] = zone --end end zonesToPotentiallyIgnore[zone] = newOccupants --end end end for zone, newOccupants in pairs(zonesToPotentiallyIgnore) do local groupDetail = occupantsToBlock[zone.settingsGroupName] if groupDetail then for newOccupant, _ in pairs(newOccupants) do local occupantToKeepZone = groupDetail[newOccupant] if occupantToKeepZone and occupantToKeepZone ~= zone then newOccupants[newOccupant] = nil end end end end -- This deduces what signals should be fired local collectiveSignalsToFire = {{}, {}} for zone, _ in pairs(activeZones) do if zone.activeTriggers[registeredTriggerType] then local zAccuracy = zone.accuracy local occupantsDict = zonesAndOccupants[zone] or {} local occupantsPresent = false for k,v in pairs(occupantsDict) do occupantsPresent = true break end if occupantsPresent and zAccuracy > highestAccuracy then highestAccuracy = zAccuracy end local signalsToFire = zone:_updateOccupants(registeredTriggerType, occupantsDict) collectiveSignalsToFire[1][zone] = signalsToFire.exited collectiveSignalsToFire[2][zone] = signalsToFire.entered end end -- This ensures all exited signals and called before entered signals local indexToSignalType = {"Exited", "Entered"} for index, zoneAndOccupants in pairs(collectiveSignalsToFire) do local signalType = indexToSignalType[index] local signalName = registeredTriggerType..signalType for zone, occupants in pairs(zoneAndOccupants) do local signal = zone[signalName] if signal then for _, occupant in pairs(occupants) do signal:Fire(occupant) end end end end local cooldown = enum.Accuracy.getProperty(highestAccuracy) nextCheck = clockTime + cooldown end end) heartbeatConnections[registeredTriggerType] = heartbeatConnection end function ZoneController._deregisterConnection(registeredZone, registeredTriggerType) activeConnections -= 1 if activeTriggers[registeredTriggerType] == 1 then activeTriggers[registeredTriggerType] = nil local heartbeatConnection = heartbeatConnections[registeredTriggerType] if heartbeatConnection then heartbeatConnections[registeredTriggerType] = nil heartbeatConnection:Disconnect() end else activeTriggers[registeredTriggerType] -= 1 end registeredZone.activeTriggers[registeredTriggerType] = nil if dictLength(registeredZone.activeTriggers) == 0 then activeZones[registeredZone] = nil ZoneController._updateZoneDetails() end if registeredZone.touchedConnectionActions[registeredTriggerType] then registeredZone:_disconnectTouchedConnection(registeredTriggerType) end end function ZoneController._updateZoneDetails() activeParts = {} activePartToZone = {} allParts = {} allPartToZone = {} activeZonesTotalVolume = 0 for zone, _ in pairs(registeredZones) do local isActive = activeZones[zone] if isActive then activeZonesTotalVolume += zone.volume end for _, zonePart in pairs(zone.zoneParts) do if isActive then table.insert(activeParts, zonePart) activePartToZone[zonePart] = zone end table.insert(allParts, zonePart) allPartToZone[zonePart] = zone end end end function ZoneController._getZonesAndItems(trackerName, zonesDictToCheck, zoneCustomVolume, onlyActiveZones, recommendedDetection) local totalZoneVolume = zoneCustomVolume if not totalZoneVolume then for zone, _ in pairs(zonesDictToCheck) do totalZoneVolume += zone.volume end end local zonesAndOccupants = {} local tracker = trackers[trackerName] if tracker.totalVolume < totalZoneVolume then -- If the volume of all *characters/items* within the server is *less than* the total -- volume of all active zones (i.e. zones which listen for .playerEntered) -- then it's more efficient cast checks within each character and -- then determine the zones they belong to for _, item in pairs(tracker.items) do local touchingZones = ZoneController.getTouchingZones(item, onlyActiveZones, recommendedDetection, tracker) for _, zone in pairs(touchingZones) do if not onlyActiveZones or zone.activeTriggers[trackerName] then local finalItem = item if trackerName == "player" then finalItem = players:GetPlayerFromCharacter(item) end if finalItem then fillOccupants(zonesAndOccupants, zone, finalItem) end end end end else -- If the volume of all *active zones* within the server is *less than* the total -- volume of all characters/items, then it's more efficient to perform the -- checks directly within each zone to determine players inside for zone, _ in pairs(zonesDictToCheck) do if not onlyActiveZones or zone.activeTriggers[trackerName] then local result = CollectiveWorldModel:GetPartBoundsInBox(zone.region.CFrame, zone.region.Size, tracker.whitelistParams) local finalItemsDict = {} for _, itemOrChild in pairs(result) do local correspondingItem = tracker.partToItem[itemOrChild] if not finalItemsDict[correspondingItem] then finalItemsDict[correspondingItem] = true end end for item, _ in pairs(finalItemsDict) do if trackerName == "player" then local player = players:GetPlayerFromCharacter(item) if zone:findPlayer(player) then fillOccupants(zonesAndOccupants, zone, player) end elseif zone:findItem(item) then fillOccupants(zonesAndOccupants, zone, item) end end end end end return zonesAndOccupants end
-- local CoverageWorkerModule = require(CurrentModule.CoverageWorker) -- type worker = CoverageWorkerModule.worker
type worker = any
--Made by Superluck, Uploaded by FederalSignal_QCB. --Made by Superluck, Uploaded by FederalSignal_QCB. --Made by Superluck, Uploaded by FederalSignal_QCB.
while true do script.Parent.Parent.Parent.Sound.Sound.EmitterSize = 0 script.Parent.Parent.Parent.Sound.Sound2.EmitterSize = 0 wait((math.random(600,672))/1000) script.Parent.Parent.Parent.Sound.Sound2.EmitterSize = script.Parent.Parent.SoundblockSize.Value/10 script.Parent.Parent.Parent.Sound.Sound.EmitterSize = script.Parent.Parent.SoundblockSize.Value/10 wait((math.random(600,672))/1000) end
--------------------[ STANCE FUNCTIONS ]----------------------------------------------
function Stand(OnDeselected) local LHip = Torso["Left Hip"] local RHip = Torso["Right Hip"] local Root = HRP.RootJoint Stance = 2 if (not OnDeselected) then spawn(function() local PreviousOffset = Humanoid.CameraOffset local PreviousRootP = Root.C0.p for X = 0, 90, 1.5 / 0.25 do local Alpha = Sine(X) Humanoid.CameraOffset = PreviousOffset:lerp(StanceOffset[1], Alpha) Root.C0 = CF(PreviousRootP:lerp(VEC3(), Alpha)) * CFANG(RAD(-90), 0, RAD(180)) RS:wait() end end) TweenJoint(ABWeld, CF(), CF(), Sine, 0.25) TweenJoint(LHip, CF(-1, -1, 0) * CFANG(0, RAD(-90), 0), CF(-0.5, 1, 0) * CFANG(0, RAD(-90), 0), Sine, 0.25) TweenJoint(RHip, CF(1, -1, 0) * CFANG(RAD(-180), RAD(90), 0), CF(0.5, 1, 0) * CFANG(RAD(-180), RAD(90), 0), Sine, 0.25) elseif OnDeselected then Humanoid.CameraOffset = StanceOffset[1] ABWeld.C0 = CF() ABWeld.C1 = CF() LHip.C0 = CF(-1, -1, 0) * CFANG(0, RAD(-90), 0) LHip.C1 = CF(-0.5, 1, 0) * CFANG(0, RAD(-90), 0) RHip.C0 = CF(1, -1, 0) * CFANG(RAD(-180), RAD(90), 0) RHip.C1 = CF(0.5, 1, 0) * CFANG(RAD(-180), RAD(90), 0) Root.C0 = CFANG(RAD(-90), 0, RAD(180)) end end function Crouch() local LHip = Torso["Left Hip"] local RHip = Torso["Right Hip"] local Root = HRP.RootJoint Stance = 1 spawn(function() local PreviousOffset = Humanoid.CameraOffset local PreviousRootP = Root.C0.p for X = 0, 90, 1.5 / 0.25 do if Stance ~= 1 then break end local Alpha = Sine(X) Humanoid.CameraOffset = PreviousOffset:lerp(StanceOffset[2], Alpha) Root.C0 = CF(PreviousRootP:lerp(VEC3(0, -1, 0), Alpha)) * CFANG(RAD(-90), 0, RAD(180)) RS:wait() end end) TweenJoint(ABWeld, CF(0, 0, -1 / 16), CF(), Sine, 0.25) 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, 0.25) 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, 0.25) end
--12 hours : 360 degs --1 hour : 30 degs --60 mins : 30 degs --1 min : 0.5 degs --60 s : 0.5 degs --1 s : 0.00833333333... degs
local chour, chmin, chsec = 0,0,0 local centerPoint = script.Parent.CenterPoint local function TryUpdateHour(h, m, s) if chour ~= h or chmin ~= m or chsec ~= s then chour = h chmin = m chsec = s return true end return false end local function PlayBell() centerPoint.Bell:Play() centerPoint.BillboardGui.Enabled = true delay(11.2*3, function () centerPoint.Bell:Stop() centerPoint.BillboardGui.Enabled = false end) end local function UpdatePointers() local hourhinge = centerPoint.HoursHinge local secshinge = centerPoint.SecsHinge local minshinge = centerPoint.MinsHinge secshinge.TargetAngle = chsec * 6 minshinge.TargetAngle = chmin * 6 hourhinge.TargetAngle = chour * 30 if (chour == 12 or chour == 0) and (chmin == 0 and chsec == 0) then PlayBell() end end while wait() do local now = os.time() local hours = os.date("*t",now)["hour"] local mins = os.date("*t",now)["min"] local secs = os.date("*t",now)["sec"] if TryUpdateHour(hours, mins, secs) then
-- (Hat Giver Script - Loaded.)
debounce = true function onTouched(hit) if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then debounce = false h = Instance.new("Hat") p = Instance.new("Part") h.Name = "GreenTopHat" p.Parent = h p.Position = hit.Parent:findFirstChild("Head").Position p.Name = "Handle" p.formFactor = 0 p.Size = Vector3.new(0,-0.25,0) p.BottomSurface = 0 p.TopSurface = 0 p.Locked = true script.Parent.Mesh:clone().Parent = p h.Parent = hit.Parent h.AttachmentPos = Vector3.new(0, 0.3, 0) wait(5) debounce = true end end script.Parent.Touched:connect(onTouched)
-- Play sounds
for _, effect in pairs(EffectsToPlay:GetChildren()) do effect.Parent = effectPart if effect:IsA("Sound") then effect:Play() end end DebrisService:AddItem(effectPart,4) RootModel:Destroy()
-- local script inside a TextLabel
local player = game.Players.LocalPlayer local goldValue = player.leaderstats.Gold local textLabel = script.Parent local function updateText() local gold = goldValue.Value if gold > 999 then if gold >= 1000000 then textLabel.Text = string.format("%.1fM", gold / 1000000) elseif gold >= 1000 then textLabel.Text = string.format("%.1fK", gold / 1000) end else textLabel.Text = tostring(gold) end end goldValue.Changed:Connect(updateText) updateText()
--[=[ Shows the pane @param doNotAnimate boolean? -- True if this visiblity should not animate ]=]
function BasicPane:Show(doNotAnimate) self:SetVisible(true, doNotAnimate) end
--///////////////-- --Helping Methods-- --///////////////--
local function InvokeVector(Vector, Function) return Vector3.new(Function(Vector.X), Function(Vector.Y), Function(Vector.Z)) end local function GetOffset(Region, Position) local Center = Region.Center local Rotation = Region.Rotation local Offset = (CFrame.new(Center) * CFrame.Angles(Rotation.X, Rotation.Y, Rotation.Z)):pointToObjectSpace(Position) Offset = InvokeVector(Offset, math.abs) return Offset end
--Listen to seat enter/exit
VehicleSeating.AddSeat(DriverSeat, onEnterSeat, onExitSeat) for _, seat in ipairs(AdditionalSeats) do VehicleSeating.AddSeat(seat, onEnterSeat, onExitSeat) end local function playerAdded(player) local playerGui = player:WaitForChild("PlayerGui") if not playerGui:FindFirstChild("VehiclePromptScreenGui") then local screenGui = Instance.new("ScreenGui") screenGui.ResetOnSpawn = false screenGui.Name = "VehiclePromptScreenGui" screenGui.Parent = playerGui local newLocalVehiclePromptGui = Scripts.LocalVehiclePromptGui:Clone() newLocalVehiclePromptGui.CarValue.Value = TopModel newLocalVehiclePromptGui.Parent = screenGui newLocalVehiclePromptGui.Enabled = true end end Players.PlayerAdded:Connect(playerAdded) for _, player in ipairs(Players:GetPlayers()) do playerAdded(player) end
-- A table to prevent users from equipping multiple clothing items that go in the same "slot".
GroupedAccessoryTypes = {} GroupedAccessoryTypes[1] = { Enum.AccessoryType.Pants, Enum.AccessoryType.Shorts, Enum.AccessoryType.DressSkirt, Enum.AccessoryType.Waist, } GroupedAccessoryTypes[2] = { Enum.AccessoryType.TShirt, Enum.AccessoryType.Shirt, Enum.AccessoryType.Sweater, } local function usesSameClothingSlot(accessoryTypeName1, accessoryTypeName2) local accessoryType1 = ACCESSORY_TYPE_BY_NAME[accessoryTypeName1] local accessoryType2 = ACCESSORY_TYPE_BY_NAME[accessoryTypeName2] if accessoryType1 == accessoryType2 then return true end local group1 = 0 local group2 = 0 for i, accessoryGroup in pairs(GroupedAccessoryTypes) do for _, accType in pairs(accessoryGroup) do if accessoryType1 == accType then group1 = i end if accessoryType2 == accType then group2 = i end end end if group1 == group2 and group1 ~= 0 then return true end return false end return usesSameClothingSlot
-- Inputs
local KEY_W = Enum.KeyCode.W local KEY_A = Enum.KeyCode.A local KEY_S = Enum.KeyCode.S local KEY_D = Enum.KeyCode.D local KEY_UP = Enum.KeyCode.Up local KEY_DOWN = Enum.KeyCode.Down local KEY_LEFT = Enum.KeyCode.Left local KEY_RIGHT = Enum.KeyCode.Right local KEY_RIGHTSHIFT = Enum.KeyCode.RightShift local KEY_LEFTSHIFT = Enum.KeyCode.LeftShift local THUMBSTICK_1 = Enum.KeyCode.Thumbstick1 local BUTTON_RT = Enum.KeyCode.ButtonR2 local player = game.Players.LocalPlayer local character = player.Character or player.CharacterAdded:wait() local humanoid = character:WaitForChild("Humanoid") local dead = false local ModuleScripts = ReplicatedStorage:FindFirstChild("ModuleScripts") local PlayerConverter = require(ModuleScripts:WaitForChild("PlayerConverter")) local Scripts = script:WaitForChild("Scripts") local PilotSeat = require(Scripts:WaitForChild("PilotSeat")) local speeder = PilotSeat.new(script.Parent) local engine = speeder.engine local Controls = require(Scripts:WaitForChild("Controls")) local Keyboard = Controls.Keyboard local Gamepad = Controls.Gamepad local Mobile = Controls.Mobile local physicsUpdateHandle local lastServerUpdate = 0 local lastInputUpdate = tick()
--[[ Creates a number of different collision groups, and sets their interaction ]]
function CollisionGroupsController.init() PhysicsService:CreateCollisionGroup(Constants.CollisionGroup.Door) PhysicsService:CreateCollisionGroup(Constants.CollisionGroup.Monster) PhysicsService:CreateCollisionGroup(Constants.CollisionGroup.Player) PhysicsService:CreateCollisionGroup(Constants.CollisionGroup.Elevator) PhysicsService:CollisionGroupSetCollidable(Constants.CollisionGroup.Monster, Constants.CollisionGroup.Door, false) PhysicsService:CollisionGroupSetCollidable(Constants.CollisionGroup.Monster, Constants.CollisionGroup.Player, false) PhysicsService:CollisionGroupSetCollidable(Constants.CollisionGroup.Elevator, "Default", false) end
------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------
function onSwimming(speed) if speed > 1.00 then local scale = 10.0 playAnimation("swim", 0.4, Humanoid) pose = "Swimming" else playAnimation("swimidle", 0.4, Humanoid) pose = "Standing" end end function animateTool() if (toolAnim == "None") then playToolAnimation("toolnone", toolTransitionTime, Humanoid, Enum.AnimationPriority.Idle) return end if (toolAnim == "Slash") then playToolAnimation("toolslash", 0, Humanoid, Enum.AnimationPriority.Action) return end if (toolAnim == "Lunge") then playToolAnimation("toollunge", 0, Humanoid, Enum.AnimationPriority.Action) return end end function getToolAnim(tool) for _, c in ipairs(tool:GetChildren()) do if c.Name == "toolanim" and c.className == "StringValue" then return c end end return nil end local lastTick = 0 function stepAnimate(currentTime) local deltaTime = currentTime - lastTick lastTick = currentTime local climbFudge = 0 local setAngles = false if (jumpAnimTime > 0) then jumpAnimTime = jumpAnimTime - deltaTime end if (pose == "FreeFall" and jumpAnimTime <= 0) then playAnimation("fall", fallTransitionTime, Humanoid) elseif (pose == "Seated") then playAnimation("sit", 0.5, Humanoid) return elseif (pose == "Running") then playAnimation("walk", 0.2, Humanoid) elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then stopAllAnimations() end -- Tool Animation handling end
--[[Weight and CG]]
Tune.Weight = 3600 -- Total weight (in pounds) Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable) --[[Width]] 6 , --[[Height]] 3 , --[[Length]] 10 } Tune.WeightDist = 50 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100) Tune.CGHeight = .6 -- Center of gravity height (studs relative to median of all wheels) Tune.WBVisible = false -- Makes the weight brick visible --Unsprung Weight Tune.FWheelDensity = .1 -- Front Wheel Density Tune.RWheelDensity = .1 -- Rear Wheel Density Tune.FWLgcyDensity = 1 -- Front Wheel Density [PGS OFF] Tune.RWLgcyDensity = 1 -- Rear Wheel Density [PGS OFF] Tune.AxleSize = 2 -- Size of structural members (larger = more stable/carry more weight) Tune.AxleDensity = .1 -- Density of structural members
---------------------------------- ------------FUNCTIONS------------- ----------------------------------
function Receive(player, action, ...) local args = {...} if player == User and action == "play" then Connector:FireAllClients("play", User, args[1], Settings.SoundSource.Position, Settings.PianoSoundRange, player, args[2], Settings.IsCustom,Settings.Length) HighlightPianoKey((args[1] > 61 and 61) or (args[1] < 1 and 1) or args[1],args[3]) elseif player == User and action == "abort" then Deactivate() if SeatWeld then SeatWeld:remove() end end end function Activate(player) Connector:FireClient(player, "activate", Settings.CameraCFrame, Settings.PianoSounds, true) User = player end function Deactivate() if User and User.Parent then Connector:FireClient(User, "deactivate") User.Character:SetPrimaryPartCFrame(Box.CFrame + Vector3.new(0, 5, 0)) end User = nil end
--[=[ Holds constants for resource retrieval. @class ResourceConstants @private ]=]
local require = require(script.Parent.loader).load(script) local Table = require("Table") return Table.readonly({ REMOTE_EVENT_STORAGE_NAME = "RemoteEvents"; REMOTE_FUNCTION_STORAGE_NAME = "RemoteFunctions"; })
-- Disconnect all handlers. Since we use a linked list it suffices to clear the -- reference to the head handler.
function Signal:DisconnectAll() self._handlerListHead = false if self.connectionsChanged then self.connectionsChanged:Fire(-self.totalConnections) self.connectionsChanged:Destroy() self.connectionsChanged = nil self.totalConnections = 0 end end Signal.Destroy = Signal.DisconnectAll Signal.destroy = Signal.DisconnectAll
-- * Fires when the local player begins input. Ignores all input except if -- the user presses `KEY`. If `KEY` is pressed opens the game GUI unless -- player already interacting with the game -- -- Arguments: -- actionName - Name of the ContextActionService action -- userInputState - State of input -- inputObject - Contains info about input -- Return: None -- *
local function toggleKeyboard(actionName, userInputState, inputObject) if not (userInputState == Enum.UserInputState.Begin) then return end toggleInteraction() end local function toggleMouse(playerWhoClicked) if playerWhoClicked then toggleInteraction() end end
-- FUNCTIONS --
return function(Action, ...) local Args = {...} if Action == "Splash" then local TargetPosition = Args[1] local oceanHeight = Args[2] local splashPos = Vector3.new(TargetPosition.X, oceanHeight + 1, TargetPosition.Z) local splashAttachment = Instance.new("Attachment") splashAttachment.Parent = workspace.Terrain splashAttachment.WorldPosition = splashPos game.Debris:AddItem(splashAttachment, 5) debrisModule.Shockwave(splashPos, 3, 13) coroutine.wrap(function() for i, v in pairs(script.Splash:GetChildren()) do if v:IsA("ParticleEmitter") then local fx = v:Clone() fx.Parent = splashAttachment fx:Emit(fx:GetAttribute("EmitCount")) end end end)() end end
-- map a value from one range to another
local function map(x: number, inMin: number, inMax: number, outMin: number, outMax: number): number return (x - inMin)*(outMax - outMin)/(inMax - inMin) + outMin end local function playSound(sound: Sound) sound.TimePosition = 0 sound.Playing = true end local function shallowCopy(t) local out = {} for k, v in pairs(t) do out[k] = v end return out end local function initializeSoundSystem(instances) local player = instances.player local humanoid = instances.humanoid local rootPart = instances.rootPart local sounds: {[string]: Sound} = {} -- initialize sounds for name: string, props: {[string]: any} in pairs(SOUND_DATA) do local sound: Sound = Instance.new("Sound") sound.Name = name -- set default values sound.Archivable = false sound.RollOffMinDistance = 5 sound.RollOffMaxDistance = 150 sound.Volume = 0.65 for propName, propValue: any in pairs(props) do (sound :: any)[propName] = propValue end sound.Parent = rootPart sounds[name] = sound end local playingLoopedSounds: {[Sound]: boolean?} = {} local function stopPlayingLoopedSounds(except: Sound?) for sound in pairs(shallowCopy(playingLoopedSounds)) do if sound ~= except then sound.Playing = false playingLoopedSounds[sound] = nil end end end -- state transition callbacks. local stateTransitions: {[Enum.HumanoidStateType]: () -> ()} = { [Enum.HumanoidStateType.FallingDown] = function() stopPlayingLoopedSounds() end, [Enum.HumanoidStateType.GettingUp] = function() stopPlayingLoopedSounds() playSound(sounds.GettingUp) end, [Enum.HumanoidStateType.Jumping] = function() stopPlayingLoopedSounds() playSound(sounds.Jumping) end, [Enum.HumanoidStateType.Swimming] = function() local verticalSpeed = math.abs(rootPart.AssemblyLinearVelocity.Y) if verticalSpeed > 0.1 then sounds.Splash.Volume = math.clamp(map(verticalSpeed, 100, 350, 0.28, 1), 0, 1) playSound(sounds.Splash) end stopPlayingLoopedSounds(sounds.Swimming) sounds.Swimming.Playing = true playingLoopedSounds[sounds.Swimming] = true end, [Enum.HumanoidStateType.Freefall] = function() sounds.FreeFalling.Volume = 0 stopPlayingLoopedSounds(sounds.FreeFalling) playingLoopedSounds[sounds.FreeFalling] = true end, [Enum.HumanoidStateType.Landed] = function() stopPlayingLoopedSounds() local verticalSpeed = math.abs(rootPart.AssemblyLinearVelocity.Y) if verticalSpeed > 75 then sounds.Landing.Volume = math.clamp(map(verticalSpeed, 50, 100, 0, 1), 0, 1) playSound(sounds.Landing) end end, [Enum.HumanoidStateType.Running] = function() stopPlayingLoopedSounds(sounds.Running) sounds.Running.Playing = true playingLoopedSounds[sounds.Running] = true end, [Enum.HumanoidStateType.Climbing] = function() local sound = sounds.Climbing if math.abs(rootPart.AssemblyLinearVelocity.Y) > 0.1 then sound.Playing = true stopPlayingLoopedSounds(sound) else stopPlayingLoopedSounds() end playingLoopedSounds[sound] = true end, [Enum.HumanoidStateType.Seated] = function() stopPlayingLoopedSounds() end, [Enum.HumanoidStateType.Dead] = function() stopPlayingLoopedSounds() playSound(sounds.Died) end, [Enum.HumanoidStateType.Physics] = function() stopPlayingLoopedSounds() end, } -- updaters for looped sounds local loopedSoundUpdaters: {[Sound]: (number, Sound, Vector3) -> ()} = { [sounds.Climbing] = function(dt: number, sound: Sound, vel: Vector3) sound.Playing = vel.Magnitude > 0.1 end, [sounds.FreeFalling] = function(dt: number, sound: Sound, vel: Vector3): () if vel.Magnitude > 75 then sound.Volume = math.clamp(sound.Volume + 0.9*dt, 0, 1) else sound.Volume = 0 end end, [sounds.Running] = function(dt: number, sound: Sound, vel: Vector3) sound.Playing = vel.Magnitude > 0.5 and humanoid.MoveDirection.Magnitude > 0.5 end, } -- state substitutions to avoid duplicating entries in the state table local stateRemap: {[Enum.HumanoidStateType]: Enum.HumanoidStateType} = { [Enum.HumanoidStateType.RunningNoPhysics] = Enum.HumanoidStateType.Running, } local activeState: Enum.HumanoidStateType = stateRemap[humanoid:GetState()] or humanoid:GetState() local stateChangedConn = humanoid.StateChanged:Connect(function(_, state) state = stateRemap[state] or state if state ~= activeState then local transitionFunc: () -> () = stateTransitions[state] if transitionFunc then transitionFunc() end activeState = state end end) local steppedConn = RunService.Stepped:Connect(function(_, worldDt: number) -- update looped sounds on stepped for sound in pairs(playingLoopedSounds) do local updater: (number, Sound, Vector3) -> () = loopedSoundUpdaters[sound] if updater then updater(worldDt, sound, rootPart.AssemblyLinearVelocity) end end end) local function terminate() stateChangedConn:Disconnect() steppedConn:Disconnect() if FFlagUserAtomicCharacterSoundsUnparent then -- Unparent all sounds and empty sounds table -- This is needed in order to support the case where initializeSoundSystem might be called more than once for the same player, -- which might happen in case player character is unparented and parented back on server and reset-children mechanism is active. for name: string, sound: Sound in pairs(sounds) do sound:Destroy() end table.clear(sounds) end end return terminate end local binding = AtomicBinding.new({ humanoid = "Humanoid", rootPart = "HumanoidRootPart", }, initializeSoundSystem) local playerConnections = {} local function characterAdded(character) binding:bindRoot(character) end local function characterRemoving(character) binding:unbindRoot(character) end local function playerAdded(player: Player) local connections = playerConnections[player] if not connections then connections = {} playerConnections[player] = connections end if player.Character then characterAdded(player.Character) end table.insert(connections, player.CharacterAdded:Connect(characterAdded)) table.insert(connections, player.CharacterRemoving:Connect(characterRemoving)) end local function playerRemoving(player: Player) local connections = playerConnections[player] if connections then for _, conn in ipairs(connections) do conn:Disconnect() end playerConnections[player] = nil end if player.Character then characterRemoving(player.Character) end end for _, player in ipairs(Players:GetPlayers()) do task.spawn(playerAdded, player) end Players.PlayerAdded:Connect(playerAdded) Players.PlayerRemoving:Connect(playerRemoving)
-- This is responsible for positioning the topbar icons
local requestedTopbarUpdate = false function IconController.updateTopbar() local function getIncrement(otherIcon, alignment) --local container = otherIcon.instances.iconContainer --local sizeX = container.Size.X.Offset local iconSize = otherIcon:get("iconSize", otherIcon:getIconState()) or UDim2.new(0, 32, 0, 32) local sizeX = iconSize.X.Offset local alignmentGap = IconController[alignment.."Gap"] local iconWidthAndGap = (sizeX + alignmentGap) local increment = iconWidthAndGap local preOffset = 0 if otherIcon._parentIcon == nil then local extendLeft, extendRight, additionalRight = IconController.getMenuOffset(otherIcon) preOffset += extendLeft increment += extendRight + additionalRight end return increment, preOffset end if topbarUpdating then -- This prevents the topbar updating and shifting icons more than it needs to requestedTopbarUpdate = true return false end coroutine.wrap(function() topbarUpdating = true runService.Heartbeat:Wait() topbarUpdating = false for alignment, alignmentInfo in pairs(alignmentDetails) do alignmentInfo.records = {} end for otherIcon, _ in pairs(topbarIcons) do if IconController.canShowIconOnTopbar(otherIcon) then local alignment = otherIcon:get("alignment") table.insert(alignmentDetails[alignment].records, otherIcon) end end local viewportSize = workspace.CurrentCamera.ViewportSize for alignment, alignmentInfo in pairs(alignmentDetails) do local records = alignmentInfo.records if #records > 1 then if alignmentInfo.reverseSort then table.sort(records, function(a,b) return a:get("order") > b:get("order") end) else table.sort(records, function(a,b) return a:get("order") < b:get("order") end) end end local totalIconX = 0 for i, otherIcon in pairs(records) do local increment = getIncrement(otherIcon, alignment) totalIconX = totalIconX + increment end local offsetX = alignmentInfo.getStartOffset(totalIconX, alignment) local preOffsetX = offsetX local containerX = TopbarPlusGui.TopbarContainer.AbsoluteSize.X for i, otherIcon in pairs(records) do local increment, preOffset = getIncrement(otherIcon, alignment) local newAbsoluteX = alignmentInfo.startScale*containerX + preOffsetX+preOffset preOffsetX = preOffsetX + increment end for i, otherIcon in pairs(records) do local container = otherIcon.instances.iconContainer local increment, preOffset = getIncrement(otherIcon, alignment) local topPadding = otherIcon.topPadding local newPositon = UDim2.new(alignmentInfo.startScale, offsetX+preOffset, topPadding.Scale, topPadding.Offset) local isAnOverflowIcon = string.match(otherIcon.name, "_overflowIcon-") local repositionInfo = otherIcon:get("repositionInfo") if repositionInfo then tweenService:Create(container, repositionInfo, {Position = newPositon}):Play() else container.Position = newPositon end offsetX = offsetX + increment otherIcon.targetPosition = UDim2.new(0, (newPositon.X.Scale*viewportSize.X) + newPositon.X.Offset, 0, (newPositon.Y.Scale*viewportSize.Y) + newPositon.Y.Offset) end end -- OVERFLOW HANDLER -------- local START_LEEWAY = 10 -- The additional offset where the end icon will be converted to ... without an apparant change in position local function getBoundaryX(iconToCheck, side, gap) local additionalGap = gap or 0 local currentSize = iconToCheck:get("iconSize", iconToCheck:getIconState()) local sizeX = currentSize.X.Offset local extendLeft, extendRight = IconController.getMenuOffset(iconToCheck) local boundaryXOffset = (side == "left" and (-additionalGap-extendLeft)) or (side == "right" and sizeX+additionalGap+extendRight) local boundaryX = iconToCheck.targetPosition.X.Offset + boundaryXOffset return boundaryX end local function getSizeX(iconToCheck, usePrevious) local currentSize, previousSize = iconToCheck:get("iconSize", iconToCheck:getIconState(), "beforeDropdown") local hoveringSize = iconToCheck:get("iconSize", "hovering") if iconToCheck.wasHoveringBeforeOverflow and previousSize and hoveringSize and hoveringSize.X.Offset > previousSize.X.Offset then -- This prevents hovering icons flicking back and forth, demonstrated at thread/1017485/191. previousSize = hoveringSize end local newSize = (usePrevious and previousSize) or currentSize local extendLeft, extendRight = IconController.getMenuOffset(iconToCheck) local sizeX = newSize.X.Offset + extendLeft + extendRight return sizeX end for alignment, alignmentInfo in pairs(alignmentDetails) do local overflowIcon = alignmentInfo.overflowIcon if overflowIcon then local alignmentGap = IconController[alignment.."Gap"] local oppositeAlignment = (alignment == "left" and "right") or "left" local oppositeAlignmentInfo = alignmentDetails[oppositeAlignment] local oppositeOverflowIcon = IconController.getIcon("_overflowIcon-"..oppositeAlignment) -- This determines whether any icons (from opposite or mid alignment) are overlapping with this alignment local overflowBoundaryX = getBoundaryX(overflowIcon, alignment) if overflowIcon.enabled then overflowBoundaryX = getBoundaryX(overflowIcon, oppositeAlignment, alignmentGap) end local function doesExceed(givenBoundaryX) local exceeds = (alignment == "left" and givenBoundaryX < overflowBoundaryX) or (alignment == "right" and givenBoundaryX > overflowBoundaryX) return exceeds end local alignmentOffset = oppositeAlignmentInfo.getOffset() if not overflowIcon.enabled then alignmentOffset += START_LEEWAY end local alignmentBorderX = (alignment == "left" and viewportSize.X - alignmentOffset) or (alignment == "right" and alignmentOffset) local closestBoundaryX = alignmentBorderX local exceededCriticalBoundary = doesExceed(closestBoundaryX) local function checkBoundaryExceeded(recordToCheck) local totalIcons = #recordToCheck for i = 1, totalIcons do local endIcon = recordToCheck[totalIcons+1 - i] if IconController.canShowIconOnTopbar(endIcon) then local isAnOverflowIcon = string.match(endIcon.name, "_overflowIcon-") if isAnOverflowIcon and totalIcons ~= 1 then break elseif isAnOverflowIcon and not endIcon.enabled then continue end local additionalMyX = 0 if not overflowIcon.enabled then additionalMyX = START_LEEWAY end local myBoundaryX = getBoundaryX(endIcon, alignment, additionalMyX) local isNowClosest = (alignment == "left" and myBoundaryX < closestBoundaryX) or (alignment == "right" and myBoundaryX > closestBoundaryX) if isNowClosest then closestBoundaryX = myBoundaryX if doesExceed(myBoundaryX) then exceededCriticalBoundary = true end end end end end checkBoundaryExceeded(alignmentDetails[oppositeAlignment].records) checkBoundaryExceeded(alignmentDetails.mid.records) -- This determines which icons to give to the overflow if an overlap is present if exceededCriticalBoundary then local recordToCheck = alignmentInfo.records local totalIcons = #recordToCheck for i = 1, totalIcons do local endIcon = (alignment == "left" and recordToCheck[totalIcons+1 - i]) or (alignment == "right" and recordToCheck[i]) if endIcon ~= overflowIcon and IconController.canShowIconOnTopbar(endIcon) then local additionalGap = alignmentGap local overflowIconSizeX = overflowIcon:get("iconSize", overflowIcon:getIconState()).X.Offset if overflowIcon.enabled then additionalGap += alignmentGap + overflowIconSizeX end local myBoundaryXPlusGap = getBoundaryX(endIcon, oppositeAlignment, additionalGap) local exceeds = (alignment == "left" and myBoundaryXPlusGap >= closestBoundaryX) or (alignment == "right" and myBoundaryXPlusGap <= closestBoundaryX) if exceeds then if not overflowIcon.enabled then local overflowContainer = overflowIcon.instances.iconContainer local yPos = overflowContainer.Position.Y local appearXAdditional = (alignment == "left" and -overflowContainer.Size.X.Offset) or 0 local appearX = getBoundaryX(endIcon, oppositeAlignment, appearXAdditional) overflowContainer.Position = UDim2.new(0, appearX, yPos.Scale, yPos.Offset) overflowIcon:setEnabled(true) end if #endIcon.dropdownIcons > 0 then endIcon._overflowConvertedToMenu = true local wasSelected = endIcon.isSelected endIcon:deselect() local iconsToConvert = {} for _, dIcon in pairs(endIcon.dropdownIcons) do table.insert(iconsToConvert, dIcon) end for _, dIcon in pairs(endIcon.dropdownIcons) do dIcon:leave() end endIcon:setMenu(iconsToConvert) if wasSelected and overflowIcon.isSelected then endIcon:select() end end if endIcon.hovering then endIcon.wasHoveringBeforeOverflow = true end endIcon:join(overflowIcon, "dropdown") if #endIcon.menuIcons > 0 and endIcon.menuOpen then endIcon:deselect() endIcon:select() overflowIcon:select() end end break end end else -- This checks to see if the lowest/highest (depending on left/right) ordered overlapping icon is no longer overlapping, removes from the dropdown, and repeats if valid local winningOrder, winningOverlappedIcon local totalOverlappingIcons = #overflowIcon.dropdownIcons if not (oppositeOverflowIcon and oppositeOverflowIcon.enabled and #alignmentInfo.records == 1 and #oppositeAlignmentInfo.records ~= 1) then for _, overlappedIcon in pairs(overflowIcon.dropdownIcons) do local iconOrder = overlappedIcon:get("order") if winningOverlappedIcon == nil or (alignment == "left" and iconOrder < winningOrder) or (alignment == "right" and iconOrder > winningOrder) then winningOrder = iconOrder winningOverlappedIcon = overlappedIcon end end end if winningOverlappedIcon then local sizeX = getSizeX(winningOverlappedIcon, true) local myForesightBoundaryX = getBoundaryX(overflowIcon, oppositeAlignment) if totalOverlappingIcons == 1 then myForesightBoundaryX = getBoundaryX(overflowIcon, alignment, alignmentGap-START_LEEWAY) end local availableGap = math.abs(closestBoundaryX - myForesightBoundaryX) - (alignmentGap*2) local noLongerExeeds = (sizeX < availableGap) if noLongerExeeds then if #overflowIcon.dropdownIcons == 1 then overflowIcon:setEnabled(false) end local overflowContainer = overflowIcon.instances.iconContainer local yPos = overflowContainer.Position.Y overflowContainer.Position = UDim2.new(0, myForesightBoundaryX, yPos.Scale, yPos.Offset) winningOverlappedIcon:leave() winningOverlappedIcon.wasHoveringBeforeOverflow = nil -- if winningOverlappedIcon._overflowConvertedToMenu then winningOverlappedIcon._overflowConvertedToMenu = nil local iconsToConvert = {} for _, dIcon in pairs(winningOverlappedIcon.menuIcons) do table.insert(iconsToConvert, dIcon) end for _, dIcon in pairs(winningOverlappedIcon.menuIcons) do dIcon:leave() end winningOverlappedIcon:setDropdown(iconsToConvert) end -- end end end end end -------- if requestedTopbarUpdate then requestedTopbarUpdate = false IconController.updateTopbar() end return true end)() end function IconController.setTopbarEnabled(bool, forceBool) if forceBool == nil then forceBool = true end local indicator = TopbarPlusGui.Indicator if forceBool and not bool then forceTopbarDisabled = true elseif forceBool and bool then forceTopbarDisabled = false end local topbarEnabledAccountingForMimic = checkTopbarEnabledAccountingForMimic() if IconController.controllerModeEnabled then if bool then if TopbarPlusGui.TopbarContainer.Visible or forceTopbarDisabled or menuOpen or not topbarEnabledAccountingForMimic then return end if forceBool then indicator.Visible = topbarEnabledAccountingForMimic else indicator.Active = false if controllerMenuOverride and controllerMenuOverride.Connected then controllerMenuOverride:Disconnect() end if hapticService:IsVibrationSupported(Enum.UserInputType.Gamepad1) and hapticService:IsMotorSupported(Enum.UserInputType.Gamepad1,Enum.VibrationMotor.Small) then hapticService:SetMotor(Enum.UserInputType.Gamepad1,Enum.VibrationMotor.Small,1) delay(0.2,function() pcall(function() hapticService:SetMotor(Enum.UserInputType.Gamepad1,Enum.VibrationMotor.Small,0) end) end) end TopbarPlusGui.TopbarContainer.Visible = true TopbarPlusGui.TopbarContainer:TweenPosition( UDim2.new(0,0,0,5 + STUPID_CONTROLLER_OFFSET), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.1, true ) local selectIcon local targetOffset = 0 IconController:_updateSelectionGroup() runService.Heartbeat:Wait() local indicatorSizeTrip = 50 --indicator.AbsoluteSize.Y * 2 for otherIcon, _ in pairs(topbarIcons) do if IconController.canShowIconOnTopbar(otherIcon) and (selectIcon == nil or otherIcon:get("order") > selectIcon:get("order")) then selectIcon = otherIcon end local container = otherIcon.instances.iconContainer local newTargetOffset = -27 + container.AbsoluteSize.Y + indicatorSizeTrip if newTargetOffset > targetOffset then targetOffset = newTargetOffset end end if guiService:GetEmotesMenuOpen() then guiService:SetEmotesMenuOpen(false) end if guiService:GetInspectMenuEnabled() then guiService:CloseInspectMenu() end local newSelectedObject = IconController._previousSelectedObject or selectIcon.instances.iconButton IconController._setControllerSelectedObject(newSelectedObject) indicator.Image = "rbxassetid://5278151071" indicator:TweenPosition( UDim2.new(0.5,0,0,targetOffset + STUPID_CONTROLLER_OFFSET), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.1, true ) end else if forceBool then indicator.Visible = false elseif topbarEnabledAccountingForMimic then indicator.Visible = true indicator.Active = true controllerMenuOverride = indicator.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then IconController.setTopbarEnabled(true,false) end end) else indicator.Visible = false end if not TopbarPlusGui.TopbarContainer.Visible then return end guiService.AutoSelectGuiEnabled = true IconController:_updateSelectionGroup(true) TopbarPlusGui.TopbarContainer:TweenPosition( UDim2.new(0,0,0,-TopbarPlusGui.TopbarContainer.Size.Y.Offset + STUPID_CONTROLLER_OFFSET), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.1, true, function() TopbarPlusGui.TopbarContainer.Visible = false end ) indicator.Image = "rbxassetid://5278151556" indicator:TweenPosition( UDim2.new(0.5,0,0,5), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.1, true ) end else local topbarContainer = TopbarPlusGui.TopbarContainer if topbarEnabledAccountingForMimic then topbarContainer.Visible = bool else topbarContainer.Visible = false end end end function IconController.setGap(value, alignment) local newValue = tonumber(value) or 12 local newAlignment = tostring(alignment):lower() if newAlignment == "left" or newAlignment == "mid" or newAlignment == "right" then IconController[newAlignment.."Gap"] = newValue IconController.updateTopbar() return end IconController.leftGap = newValue IconController.midGap = newValue IconController.rightGap = newValue IconController.updateTopbar() end function IconController.setLeftOffset(value) IconController.leftOffset = tonumber(value) or 0 IconController.updateTopbar() end function IconController.setRightOffset(value) IconController.rightOffset = tonumber(value) or 0 IconController.updateTopbar() end local localPlayer = players.LocalPlayer local iconsToClearOnSpawn = {} localPlayer.CharacterAdded:Connect(function() for _, icon in pairs(iconsToClearOnSpawn) do icon:destroy() end iconsToClearOnSpawn = {} end) function IconController.clearIconOnSpawn(icon) coroutine.wrap(function() local char = localPlayer.Character or localPlayer.CharacterAdded:Wait() table.insert(iconsToClearOnSpawn, icon) end)() end
-- Add scripts into game.
local ButterflyManagerScript = script.ButterflyManager if not game.StarterGui:FindFirstChild("ButterflyManager") then local NewScript = ButterflyManagerScript:Clone() NewScript.Parent = game.StarterGui NewScript.Disabled = false -- Give players scripts for _, Player in pairs(game.Players:GetPlayers()) do if Player:FindFirstChild("PlayerGui") and not Player.PlayerGui:FindFirstChild("ButterflyManagerScript") then local NewScript = ButterflyManagerScript:Clone() NewScript.Archivable = false NewScript.Disabled = false NewScript.Parent = Player.PlayerGui end end end
-- PUT ME IN SERVERSCRIPTSERVICE
local players = game:GetService("Players") local serverScriptService = game:GetService("ServerScriptService") local chatService = require(serverScriptService:WaitForChild("ChatServiceRunner"):WaitForChild("ChatService")) chatService.SpeakerAdded:Connect(function(player) local speaker = chatService:GetSpeaker(player) players[player]:IsInGroup(16072157) -- Change this then put your group ID! speaker:SetExtraData("Tags",{{TagText = players[player:GetRoleInGroup(16072157)]}}) -- Change this then put your group ID! end)
-- ROBLOX deviation: deviates from upstream substantially since Lua only has tables -- we only have two functions -- `printTableEntries` for formatting key, value pairs and -- `printListItems` for formatting arrays
-- Define setting instances
local IsOn = Configuration:WaitForChild("IsOn") local ShouldEmitSound = Configuration:WaitForChild("ShouldEmitSound") local MaxVolume = Configuration:WaitForChild("MaxVolume")
-- @Description Automatically Profile the given %Function. Arguments that will be passed to the %Function can be added after ... -- @Arg1 ProfilerString -- @Arg2 Function -- @Arg3 ...
function Debug.Profiler(ProfilerString, Callback, ...) debug.profilebegin(ProfilerString) local Results = table.pack(Callback(unpack({...} or {}))) debug.profileend() return table.unpack(Results or {}) end return Debug
--returns all of the instances of a specific instance in a model
function GetSpecificInstances(model,type) local tab={}; for _,v in pairs(model:GetChildren()) do if v:IsA(type) then table.insert(tab,v); end end return tab; end