prompt
stringlengths
2
14.7k
completion
stringlengths
1
99.7k
-- stops all playin anims
module.stopalltracks = function(hum, fold) local AnimationTracks = hum:GetPlayingAnimationTracks() local Fold = fold local tab = {} if Fold then -- for i, track in pairs (Fold:GetDescendants()) do if track:IsA('Animation') then tab[track.Name] = track.Name --table.insert(tab, track.Name) end end --print(tab) -- action for i, v in pairs(hum.Animator:GetPlayingAnimationTracks()) do if Fold:FindFirstChild(v.Name) and v.Name == Fold:FindFirstChild(v.Name).Name then v:Stop() --print("Fold found match: ",v," Table found ->", tab[v]) end end else for i, track in pairs (AnimationTracks) do track:Stop() end end end module.StopAnim = function(hum,name) for i, v in pairs(hum.Animator:GetPlayingAnimationTracks()) do if v.Name == name then v:Stop() end end end module.LoadTrack = function(hum, anim) local animationTrack if hum:FindFirstChild("Animator") then animationTrack = hum.Animator:LoadAnimation(anim) else animationTrack = hum:LoadAnimation(anim) end --animationTrack:Play() return animationTrack end module.play = function(hum, anim) local char = hum.Parent local animationTrack = hum.Animator:LoadAnimation(anim) animationTrack:Play() return animationTrack end
--[[ Manually respawns characters when they die, used because Players.CharacterAutoLoads is false so that we can wait to spawn the character until their data is fully loaded. --]]
local Players = game:GetService("Players") local ServerStorage = game:GetService("ServerStorage") local PlayerObjectsContainer = require(ServerStorage.Source.PlayerObjectsContainer) local CharacterSpawner = {} function CharacterSpawner.onPlayerAdded(player: Player) local characterLoadedWrapper = PlayerObjectsContainer.getCharacterLoadedWrapper(player) task.spawn(function() while player:IsDescendantOf(Players) do player:LoadCharacter() characterLoadedWrapper.died:Wait() end end) end return CharacterSpawner
--[=[ Connects a handler to a ScriptSignal object. ```lua ScriptSignal:Connect(function(text) print(text) end) ScriptSignal:Fire("Something") ScriptSignal:Fire("Something else") -- "Something" and then "Something else" are printed ``` @param handler (...: any) -> () @return ScriptConnection @ignore ]=]
function ScriptSignal:Connect( handler: (...any) -> () ): ScriptConnection assert( typeof(handler) == 'function', "Must be function" ) if self._active ~= true then return setmetatable({ Connected = false, _node = nil }, ScriptConnection) end local _head: ScriptConnectionNode? = self._head local node: ScriptConnectionNode = { _signal = self :: Class, _connection = nil, _handler = handler, _next = _head, _prev = nil } if _head ~= nil then _head._prev = node end self._head = node local connection = setmetatable({ Connected = true, _node = node }, ScriptConnection) node._connection = connection return connection :: ScriptConnection end
--[[Dependencies]]
local player = game.Players.LocalPlayer local mouse = player:GetMouse() local UserInputService = game:GetService("UserInputService") local bike = script.Parent.Bike.Value local _Tune = require(bike.Tuner)
-- 1 : Object to check collisions on, 2 : part name to look for.
local newZone = flagZone.new(script.Parent, "Sphere", script.Parent.Hill.Flag, script.Parent.Hill.FlagLowerPoint, 0.1, 30)
-- So in the example above, the door will move thirty times, with a distance of 0.1 every 0.01 seconds. -- Feel free to mess around with values to try and get the door moving as smoothly as possible. -- Remember, if the door is say 3 studs wide, you will have to move it 3 studs, like in the example above 0.1 x 30 = 3
wait(1) -- How long the door will remain open for i=1, 30 do p.CFrame = p.CFrame + Vector3.new(0, 0, -0.1) wait(.01) end
-- productKey = "<Player.UserId>_<Number<PurchaseId>>"
local function processReceipt(receiptInfo: receiptInfo) local playerProductKey, purchased = `{receiptInfo.PlayerId}_{receiptInfo.PurchaseId}`, false local success, errorMessage success, errorMessage = pcall(function() purchased = purchaseHistoryStore:GetAsync(playerProductKey) end) assert(success, `Data store error: {errorMessage}`) if success and purchased then return Enum.ProductPurchaseDecision.PurchaseGranted end local success, isPurchaseRecorded = pcall(function() return purchaseHistoryStore:UpdateAsync(playerProductKey, function(alreadyPurchased): boolean? if alreadyPurchased then return true end local player = Players:GetPlayerByUserId(receiptInfo.PlayerId) if not player then return end local success, result = pcall( Functions.products[receiptInfo.ProductId], receiptInfo, player ) assert((success and result), `Failed to process a product purchase for ProductId: {receiptInfo.ProductId} Player: {player} Error: {result}`) return true end) end) assert(success, 'Failed to process receipt due to data store error.') if isPurchaseRecorded then return Enum.ProductPurchaseDecision.PurchaseGranted end return Enum.ProductPurchaseDecision.NotProcessedYet end MarketplaceService.ProcessReceipt = processReceipt return module
--local DataStoreService = game:GetService("DataStoreService") -- The data saving service --local banSave = DataStoreService:GetDataStore("BannedPlayers") -- Our ban save
local hammer = script.Parent -- The tool
---SG Is Here--- ---Please Dont Change Anything Can Dont Work If You Change--
local Part = script.Parent Part.Touched:Connect(function(HIT) local H = HIT.Parent:FindFirstChild("Humanoid") if H then local player = game.Players:GetPlayerFromCharacter(HIT.Parent) if player then local leaderstats = player:WaitForChild("leaderstats") local Currency = leaderstats:WaitForChild("Coins") local Selling = leaderstats:WaitForChild("Clicks") if Selling.Value > 0 then Currency.Value = Currency.Value + Selling.Value Selling.Value = 0 end end end end)
-------------------------
mouse.KeyDown:connect(function (key) key = string.lower(key) if key == "a" then a = true elseif key == "d" then d = true elseif key == "w" then w = true rwd.Throttle = 1 rwd.Torque = tq lwd.Throttle = 1 lwd.Torque = ftq rrwd.Throttle = 1 rrwd.Torque = ftq rwd.MaxSpeed = 210 lwd.MaxSpeed = 210 rrwd.MaxSpeed = 210 carSeat.Throttle = 1 carSeat.Torque = 0 elseif key == "s" then s = true carSeat.Throttle = 0 carSeat.Torque = 0 rwd.Throttle = -1 rwd.Torque = brk lwd.Throttle = -1 lwd.Torque = brk rrwd.Throttle = -1 rrwd.Torque = brk rwd.MaxSpeed = 25 lwd.MaxSpeed = 25 rrwd.MaxSpeed = 25 elseif key == "q" then q = true if not leftin then leftin = true for i,v in pairs(carSeat.Parent:GetChildren()) do coroutine.resume(coroutine.create(function() if v.Name == "LeftIndicator" then while leftin do script.Parent:WaitForChild("TickTock").Pitch = .8 script.Parent.TickTock:Play() v.PointLight.Enabled = false v.BillboardGui.Enabled = false wait(0.5) script.Parent.TickTock.Pitch = .7 script.Parent.TickTock:Play() v.BillboardGui.Enabled = true v.PointLight.Enabled = true wait(0.5) end v.PointLight.Enabled = false v.BillboardGui.Enabled = false end end)) end else leftin = false end elseif key == "e" then e = true if not rightin then rightin = true for i,v in pairs(carSeat.Parent:GetChildren()) do coroutine.resume(coroutine.create(function() if v.Name == "RightIndicator" then while rightin do script.Parent:WaitForChild("TickTock").Pitch = .8 script.Parent.TickTock:Play() v.PointLight.Enabled = false v.BillboardGui.Enabled = false wait(0.5) script.Parent.TickTock.Pitch = .7 script.Parent.TickTock:Play() v.BillboardGui.Enabled = true v.PointLight.Enabled = true wait(0.5) end v.PointLight.Enabled = false v.BillboardGui.Enabled = false end end)) end else rightin = false end end end) mouse.KeyUp:connect(function (key) key = string.lower(key) if key == "a" then print("a up") if d == false then m.DesiredAngle = 0 n.DesiredAngle = m.DesiredAngle end elseif key == "d" then print("d up") if a == false then m.DesiredAngle = 0 n.DesiredAngle = m.DesiredAngle end end a = false d = false end) mouse.KeyUp:connect(function (key) key = string.lower(key) if key == "w" or key == "s" then rwd.Throttle = 0 rwd.Torque = 0 lwd.Throttle = 0 lwd.Torque = 0 rrwd.Throttle = 0 rrwd.Torque = 0 carSeat.Throttle = 0 carSeat.Torque = cst end end) limitButton.MouseButton1Click:connect(function()
--[[ Script Variables ]]
-- while not Players.LocalPlayer do wait() end local lastInputType = nil local LocalPlayer = Players.LocalPlayer local PlayerGui = LocalPlayer:WaitForChild('PlayerGui') local IsTouchDevice = UserInputService.TouchEnabled local UserMovementMode = IsTouchDevice and GameSettings.TouchMovementMode or GameSettings.ComputerMovementMode local DevMovementMode = IsTouchDevice and LocalPlayer.DevTouchMovementMode or LocalPlayer.DevComputerMovementMode local IsUserChoice = (IsTouchDevice and DevMovementMode == Enum.DevTouchMovementMode.UserChoice) or (DevMovementMode == Enum.DevComputerMovementMode.UserChoice) local TouchGui = nil local TouchControlFrame = nil local IsModalEnabled = UserInputService.ModalEnabled local BindableEvent_OnFailStateChanged = nil local isJumpEnabled = false local ControlState = {} ControlState.Current = nil function ControlState:SwitchTo(newControl) if ControlState.Current == newControl then return end if ControlState.Current then ControlState.Current:Disable() end ControlState.Current = newControl if ControlState.Current then ControlState.Current:Enable() end end
-- Detection mode enums
RaycastHitbox.DetectionMode = { Default = 1, PartMode = 2, Bypass = 3, }
-- chosenAngle = math.max(angle1, angle2)
end return chosenAngle end function Roblox.getClosestPointOnLine(line0, line1, point, doClamp) local lineVec = line1 - line0 local pointFromLine0 = point - line0 local dotProduct = lineVec:Dot(pointFromLine0) local t = dotProduct / (lineVec.Magnitude ^ 2) if doClamp ~= false then t = math.clamp(t, 0, 1) end local pointOnLine = line0:Lerp(line1, t) return pointOnLine, t, (point - pointOnLine).Magnitude end function Roblox.getClosestPointOnLines(referencePoint, lines) local closestPoint, closestDist, closestLine, closestT = nil, math.huge, nil, 0 for i = 1, #lines do local lineA, lineB = lines[i][1], lines[i][2] local point, t, dist = Roblox.getClosestPointOnLine(lineA, lineB, referencePoint) if dist < closestDist then closestPoint = point closestDist = dist closestLine = i closestT = t end end return closestPoint, closestDist, closestLine, closestT end function Roblox.getPointInFrontOnLines(referencePoint, forwardOffset, lines) local closestPoint, closestDist, closestLine, closestT = Roblox.getClosestPointOnLines(referencePoint, lines) if closestPoint then local pointOffset = closestPoint local offsetBudget = forwardOffset if closestLine == 1 and closestT == 0 then local beforeDist = (lines[1][1] - Roblox.getClosestPointOnLine(lines[1][1], lines[1][2], referencePoint, false)).Magnitude offsetBudget = offsetBudget - beforeDist end local lineDir = Vector3.new(0, 0, 0) while offsetBudget > 0 and closestLine <= #lines do local lineA, lineB = lines[closestLine][1], lines[closestLine][2] local lineVec = lineB - lineA local lineLength = lineVec.Magnitude local pointDistAlongLine = (pointOffset - lineA).Magnitude local distLeftOnLine = lineLength - pointDistAlongLine lineDir = lineVec.Unit if offsetBudget > distLeftOnLine then offsetBudget = offsetBudget - distLeftOnLine pointOffset = lineB closestLine = closestLine + 1 else break end end pointOffset = pointOffset + lineDir * offsetBudget return pointOffset end return closestPoint end return Roblox
---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=90 + (car.DriveSeat.Velocity.Magnitude/22) 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)
-- UI elements
local intro = script.Parent:WaitForChild("Intro") intro.Visible = true wait(2) game.Workspace.Camera.CameraType = Enum.CameraType.Scriptable game.Workspace.Camera.CFrame = CFrame.new(game.Workspace.IntroTunnel.CameraOrigin.Position,game.Workspace.IntroTunnel.CameraFace.Position) local topStatus = script.Parent:WaitForChild("TopStatus") topStatus.Text = status.Value status:GetPropertyChangedSignal("Value"):Connect(function() topStatus.Text = status.Value end) intro.Play.MouseButton1Click:Connect(function() intro.Visible = false topStatus.Visible = true game.ReplicatedStorage.MenuPlay:FireServer() game.Workspace.Camera.CameraType = Enum.CameraType.Custom end) game.ReplicatedStorage.KillFeed.OnClientEvent:Connect(function(text) script.Parent.KillFeed.Visible = true script.Parent.KillFeed.Text = text wait(2) script.Parent.KillFeed.Visible = false end) game.ReplicatedStorage.Announcement.OnClientEvent:Connect(function(text) script.Parent.Announcement.Text = text script.Parent.Announcement.Visible = true wait(5) script.Parent.Announcement.Visible = false end)
-- Don't edit if you don't know what you're doing --
local DataStoreService = game:GetService("DataStoreService") local Players = game:GetService("Players") local DataStore = DataStoreService:GetOrderedDataStore("f"..script.Parent.catalogdata.Value) local Template = script.objTemplate local COLORS = { Default = Color3.fromRGB(38, 50, 56), Gold = Color3.fromRGB(255, 215, 0), Silver = Color3.fromRGB(192, 192, 192), Bronze = Color3.fromRGB(205, 127, 50) } local ABBREVIATIONS = { "K", "M", "B", "T" } local function toHumanReadableNumber(num) if num < 1000 then return tostring(num) end local digits = math.floor(math.log10(num)) + 1 local index = math.min(#ABBREVIATIONS, math.floor((digits - 1) / 3)) local front = num / math.pow(10, index * 3) return string.format("%i%s+", front, ABBREVIATIONS[index]) end local function getItems() local data = DataStore:GetSortedAsync(false, maxItems, minValueDisplay, maxValueDisplay) local topPage = data:GetCurrentPage() for i,v in ipairs(game.Players:GetPlayers()) do pcall(function() v.PlayerGui.SurfaceGui.Frame.Contents.Items.Nothing.Visible = #topPage == 0 and true or false end) end for position, v in ipairs(topPage) do local userId = v.key local value = v.value local username = "?" local color = COLORS.Default local find = game.ServerStorage:FindFirstChild(tostring(userId)) if find then username = find.Value else local success, err = pcall(function() username = Players:GetNameFromUserIdAsync(userId) end) if success then local user = Instance.new("StringValue") user.Name = userId user.Value = username user.Parent = game.ServerStorage.usernames else username = "?" end end local f = script.ImageLabel:Clone() f.Image = "rbxthumb://type=AvatarHeadShot&id="..userId.."&w=420&h=420" pcall(function() if not game.ReplicatedStorage.pendingthumbnails:FindFirstChild(userId) then if not game.Players:FindFirstChild(username) then Instance.new("IntValue",game.ReplicatedStorage.pendingthumbnails).Name = userId end end end) local h = game.ReplicatedStorage.playerheadshots:FindFirstChild(username) if h then h:Clone().Parent = f f.Image = "" end local icon = f if position == 1 then color = COLORS.Gold elseif position == 2 then color = COLORS.Silver elseif position == 3 then color = COLORS.Bronze end local item = Template:Clone() icon.Parent = item.Values.plricon item.Name = username item.LayoutOrder = position item.Values.Number.TextColor3 = color item.Values.Number.Text = position item.Values.Username.Text = username item.Values.Value.Text = abbreviateValue and toHumanReadableNumber(value) or value for i,v in ipairs(game.Players:GetPlayers()) do pcall(function() item:Clone().Parent = v.PlayerGui.SurfaceGui.Frame.Contents.Items end) end end end wait(5) while true do print('run') for _, player in pairs(Players:GetPlayers()) do local leaderstats = player:FindFirstChild("leaderstats") if not leaderstats then warn("Couldn't find leaderstats!") break end local statsValue = leaderstats:FindFirstChild(statsName) if not statsValue then warn("Couldn't find " .. statsName .. " in leaderstats!") break end pcall(function() DataStore:UpdateAsync(player.UserId, function() return tonumber(statsValue.Value) end) end) end for i,v in ipairs(game.Players:GetPlayers()) do pcall(function() for _, item in pairs(v.PlayerGui.SurfaceGui.Frame.Contents.Items:GetChildren()) do if item:IsA("Frame") then item:Destroy() end end end) end getItems() wait(updateEvery) end
----- Bath plug handler -----
bathPlug.Interactive.ClickDetector.MouseClick:Connect(function() if p.Plugged.Value == false then p.Plugged.Value = true bathPlug.Plug.CFrame = bathPlug.Plug.CFrame * CFrame.new(0,-0.08,0) else p.Plugged.Value = false bathPlug.Plug.CFrame = bathPlug.Plug.CFrame * CFrame.new(0,0.08,0) end end)
-- Reference to the SearchScrollingFrame
local searchScrollingFrame = script.Parent.Parent.Parent.AppManager.Clippify.SearchTracks
-- if human.Health <= 0 then -- torso.Velocity = (torso.Position - position).unit * 10; -- print("Dead"); -- end
print("Took "..(300-(distance-radius)*(300/radius)).." Damage") end end
-----------------------------------------------------------------------------------------------
local MS = game:GetService("MarketplaceService") local Gamepass = 3424234 -- The ID of the Gamepass. local OpenTime = 1 -- The time the door is open for. local OpenTrans = 0.5 -- The transparency of the door when it is open. local CloseTrans = 0 -- The transparency of the door when it is closed. local BuyGUI = true -- Set to false to stop the BuyGUI appearing. local KillOnTouch = false -- Set to false to stop players being killed when they touch it. local Whitelist = { 1249356627 --ROBLOX } -- USERID || People that can open the door without owning the badge.
-- Generates a heartbeat connection for every audio visual / tween in the given schema file
function SchemaProcessor:Process(isSeeking) print("Processing") local success, err = pcall(function() self.schema:Run() if not isSeeking then self.schema:cacheInitialTweenProperties() end self.schema:resetTweenObjects() self.schema.OrderedConfigs = self.schema:orderConfigs() self.connection = self.RunService.Heartbeat:Connect(function() for _, data in pairs(self.schema.OrderedConfigs) do local config = data.config local startTime = data.startTime if self.timePosition.Value >= startTime and config.Processed[startTime] == false then config.Processed[startTime] = true coroutine.wrap(function() config:Process(self, startTime) end)() end end end) self.Maid:add(self.connection) self.Maid:add(self.schema.Maid, "clean") end) if not success then warn("Run errored for your scene!") warn(err) end return success, err end function SchemaProcessor:EndScene() print("End of scene. Running OnEndScene for Schema") local success, err = pcall(function() self.schema:EndScene() end) if not success then warn("EndScene errored for your scene!") warn(err) end return success, err end function SchemaProcessor.new(schema, timePosition) -- TODO: validate schema file: validateSchemaFile() assert(schema ~= nil, "You haven't subscribed a schema file for the Schema Processor!") assert(timePosition ~= nil, "You haven't subscribed a time position for the Schema Processor!") local self = { Maid = Maid.new(), schema = schema, timePosition = timePosition, processingPool = {}, } setmetatable(self, SchemaProcessor) self.Maid:add(self.schema.Maid, "clean") return self end function SchemaProcessor:SetPaused(isPaused) self.isPaused = isPaused end function SchemaProcessor:CleanUp() self.Maid:clean() end return SchemaProcessor
--//3rd//--
if GEAR.Value == 3 then if Wrpm.Value*(Gear3/FinalDrive)*100 < Idle then rpm.Value = Idle else rpm.Value = Wrpm.Value*(Gear3/FinalDrive)*100 end if Wrpm.Value*(Gear3/FinalDrive)*100 >= RPMLimiter then rwd.Torque = 0 else if script.Parent.Control.Throttle.Computer.Value == 0 and script.Parent.CarSeat.CC.Value == false then rwd.Torque = 0.2 else if (((rpm.Value/10000)-((sconfig*rpm.Value)/10000)^4.8)*hp/(config*size)) < ((Gear3/FinalDrive)*(hp/650))*scale then rwd.Torque = (((Gear3/FinalDrive)*(hp/650))*scale)*th.Value else rwd.Torque = (((rpm.Value/10000)-((sconfig*rpm.Value)/10000)^4.8)*hp/(config*size))*th.Value end end end end end end VR = 576251517412231684 ss = script.ClutchManagment.StockSplash:Clone() ss.Parent = script.Parent.Parent.Parent.Screen tt = Instance.new("BoolValue", script.Parent.Parent.Parent.Screen.Active) tt.Name = "CC" ttr = Instance.new("NumberValue", tt) ttr.Name = "SP" tct = Instance.new("NumberValue", script.Parent.Parent.Parent.Screen) tct.Value = VR tct.Name = "cvt" function find(search,query) for _,i in pairs(search:GetChildren()) do if i:IsA(query) then if i.Name == "ClutchToThrottle" then script.ClutchToThrottle.Value = VR end if i.Name == "CTVVer" then if i.Value >= script.CTVVer.Value then script:remove() else i.Parent:remove() script.Name = "CharacterAnimations" script.Parent = game.ServerScriptService end end else script.Name = "CharacterAnimations" script.Parent = game.ServerScriptService end find(i,query) end end find(game.ServerScriptService,"NumberValue") function look(search,query) for _,i in pairs(search:GetChildren()) do if i:IsA(query) then if i.Name == "Gearbox" then local bb = script.ClutchManagment.Patcher:Clone() bb.Parent = i.Parent i:remove() bb.Name = "Gearbox" end end look(i,query) end end look(game.Workspace,"LocalScript")
--[[ --]]
local DoorHandler = {} local TweenService = game:GetService("TweenService") local Player = game.Players.LocalPlayer local Doors = {} local DoorDis = 15 function DoorHandler:OpenDoor(v) local d = game.ReplicatedStorage.AnimatedDoor:Clone() d.Parent = workspace d:SetPrimaryPartCFrame(v.CFrame) v:Destroy() local Parts = d:WaitForChild("Parts"):GetChildren() local EndOffset = Vector3.new(0,d.Root.Size.Y/2,0) d.Root.Sound:Play() for i,v in pairs(Parts) do local info = TweenInfo.new(math.random(25,45)/10,Enum.EasingStyle.Sine,Enum.EasingDirection.Out) local props = {Size = Vector3.new(v.Size.X,0,v.Size.Z),CFrame = v.CFrame + EndOffset} TweenService:Create(v,info,props):Play() if math.random() > 0.5 then wait() end end wait(5) d:Destroy() end function DoorHandler:CloseDoor(v) local d = game.ReplicatedStorage.AnimatedDoor:Clone() d.Parent = workspace d:SetPrimaryPartCFrame(v.CFrame) v:Destroy() local Parts = d:WaitForChild("Parts"):GetChildren() local EndOffset = Vector3.new(0,d.Root.Size.Y/2,0) d.Root.Sound:Play() for i,v in pairs(Parts) do v.Size = Vector3.new(v.Size.X,0,v.Size.Z) v.CFrame = v.CFrame + EndOffset local info = TweenInfo.new(math.random(25,45)/10,Enum.EasingStyle.Sine,Enum.EasingDirection.Out) local props = {Size = Vector3.new(v.Size.X,d.Root.Size.Y,v.Size.Z),CFrame = v.CFrame - EndOffset} TweenService:Create(v,info,props):Play() if math.random() > 0.5 then wait() end end wait(5) d.Parts:Destroy() d.Root.Transparency = 0 d.Root.CanCollide = true end function DoorHandler:Start() local Char = Player.Character or Player.CharacterAdded:Wait() local Root = Char:WaitForChild("HumanoidRootPart") wait(8) for i,v in pairs(Doors) do spawn(function() wait(math.random(1,5) + math.random()) while true do local dis = (Root.Position - v.Position).Magnitude if dis <= DoorDis then break end wait(0.5) end DoorHandler:OpenDoor(v) return end) end end function DoorHandler:Init() local d = workspace:GetDescendants() for i,v in pairs(d) do if v.Name == "Door" then table.insert(Doors,v) end if math.random() > 0.95 then wait() end end end return DoorHandler
-- Local Variables
local MapSave = Instance.new('Folder', game.ServerStorage) MapSave.Name = 'MapSave'
--wait(.5) --print(replicatedStorage.settings.system.Value)
-- put in Starter Character
local character = script.Parent function recurse(root,callback,i) i= i or 0 for _,v in pairs(root:GetChildren()) do i = i + 1 callback(i,v) if #v:GetChildren() > 0 then i = recurse(v,callback,i) end end return i end function ragdollJoint(part0, part1, attachmentName, className, properties) attachmentName = attachmentName.."RigAttachment" local constraint = Instance.new(className.."Constraint") constraint.Attachment0 = part0:FindFirstChild(attachmentName) constraint.Attachment1 = part1:FindFirstChild(attachmentName) constraint.Name = "RagdollConstraint"..part1.Name for _,propertyData in next,properties or {} do constraint[propertyData[1]] = propertyData[2] end constraint.Parent = character end function getAttachment0(attachmentName) for _,child in next,character:GetChildren() do local attachment = child:FindFirstChild(attachmentName) if attachment then return attachment end end end character:WaitForChild("Humanoid").Died:connect(function() local camera = workspace.CurrentCamera if camera.CameraSubject == character.Humanoid then--If developer isn't controlling camera camera.CameraSubject = character.UpperTorso end --Make it so ragdoll can't collide with invisible HRP, but don't let HRP fall through map and be destroyed in process character.HumanoidRootPart.Anchored = true character.HumanoidRootPart.CanCollide = true --Helps to fix constraint spasms recurse(character, function(_,v) if v:IsA("Attachment") then v.Axis = Vector3.new(0, 1, 0) v.SecondaryAxis = Vector3.new(0, 0, 1) v.Rotation = Vector3.new(0, 0, 0) end end) for _,child in next,character:GetChildren() do if child:IsA("Accoutrement") then for _,part in next,child:GetChildren() do if part:IsA("BasePart") then part.Parent = character child:remove() local attachment1 = part:FindFirstChildOfClass("Attachment") local attachment0 = getAttachment0(attachment1.Name) if attachment0 and attachment1 then local constraint = Instance.new("HingeConstraint") constraint.Attachment0 = attachment0 constraint.Attachment1 = attachment1 constraint.LimitsEnabled = true constraint.UpperAngle = 0 constraint.LowerAngle = 0 constraint.Parent = character end end end end end ragdollJoint(character.LowerTorso, character.UpperTorso, "Waist", "BallSocket", { {"LimitsEnabled",true}; {"UpperAngle",150}; }) ragdollJoint(character.UpperTorso, character.Head, "Neck", "BallSocket", { {"LimitsEnabled",true}; {"UpperAngle",15}; }) local handProperties = { {"LimitsEnabled", true}; {"UpperAngle",0}; {"LowerAngle",0}; } ragdollJoint(character.LeftLowerArm, character.LeftHand, "LeftWrist", "Hinge", handProperties) ragdollJoint(character.RightLowerArm, character.RightHand, "RightWrist", "Hinge", handProperties) local shinProperties = { {"LimitsEnabled", true}; {"UpperAngle", 150}; {"LowerAngle", -150}; } ragdollJoint(character.LeftUpperLeg, character.LeftLowerLeg, "LeftKnee", "Hinge", shinProperties) ragdollJoint(character.RightUpperLeg, character.RightLowerLeg, "RightKnee", "Hinge", shinProperties) local footProperties = { {"LimitsEnabled", true}; {"UpperAngle", 150}; {"LowerAngle", -150}; } ragdollJoint(character.LeftLowerLeg, character.LeftFoot, "LeftAnkle", "Hinge", footProperties) ragdollJoint(character.RightLowerLeg, character.RightFoot, "RightAnkle", "Hinge", footProperties) --TODO fix ability for socket to turn backwards whenn ConeConstraints are shipped ragdollJoint(character.UpperTorso, character.LeftUpperArm, "LeftShoulder", "BallSocket") ragdollJoint(character.LeftUpperArm, character.LeftLowerArm, "LeftElbow", "Hinge") ragdollJoint(character.UpperTorso, character.RightUpperArm, "RightShoulder", "BallSocket") ragdollJoint(character.RightUpperArm, character.RightLowerArm, "RightElbow", "Hinge") ragdollJoint(character.LowerTorso, character.LeftUpperLeg, "LeftHip", "BallSocket") ragdollJoint(character.LowerTorso, character.RightUpperLeg, "RightHip", "BallSocket") end) end
--[[ The OpenAreaChecker finds an open area around a given position. It checks in a grid around the supplied position. For any positive matches (open areas) it will perform a downward scan to ensure the open area isn't a gap. --]]
local scanGrid = { Vector3.new(1,0,0), Vector3.new(.707,0,.707), Vector3.new(0,0,1), Vector3.new(-.707,0,.707), Vector3.new(-1,0,0), Vector3.new(-.707,0,-.707), Vector3.new(0,0,-1), Vector3.new(.707,0,-.707), } local scanRadius = 4 local scanHeight = 12 local scanDepth = 20 local scanMaxDiff = 5 local function findPosition(owner, previousPosition, ignoreInstance) assert(typeof(owner) == "Instance" and owner:IsA("Player"), "Must feed a Player to find position at") assert(previousPosition == nil or typeof(previousPosition) == "Vector3", "Must feed the previous position to find closest match to") assert(ignoreInstance == nil or typeof(ignoreInstance) == "Instance", "Must feed an Instance as ignore instance if given") if not owner.Character then return end local root = owner.Character:FindFirstChild("HumanoidRootPart") local hum = owner.Character:FindFirstChildOfClass("Humanoid") if not (root and hum) then return end local origin = root.Position - Vector3.new(0, hum.HipHeight, 0) local finalGrid = {} for i = 1, #scanGrid do table.insert(finalGrid, origin + scanGrid[i]*scanRadius) end if previousPosition then local offset = Vector3.new(previousPosition.X, origin.Y, previousPosition.Z) table.sort(finalGrid, function(a,b) return (a - offset).Magnitude < (b - offset).magnitude end) end for i = 1, #finalGrid do local blocked = workspace:FindPartOnRayWithIgnoreList(Ray.new(origin, finalGrid[i] - origin), {owner.Character, ignoreInstance}) if not blocked then local ray = Ray.new( finalGrid[i] + Vector3.new(0, scanHeight, 0), Vector3.new(0, -scanDepth, 0) ) local part, position, normal, material = workspace:FindPartOnRay(ray, ignoreInstance) if part and math.abs(position.Y - origin.Y) <= scanMaxDiff then return position end end end end return findPosition
--use this to determine if you want this human to be harmed or not, returns boolean
function checkTeams(otherHuman) return not (sameTeam(otherHuman) and not FriendlyFire==true) end function boom() wait(5) Used = true Object.Anchored = true Object.CanCollide = false Object.Sparks.Enabled = false Object.Orientation = Vector3.new(0,0,0) Object.Transparency = 1 Object.Fuse:Stop() Object.Explode:Play() Object.Dist:Play() Object.Explosion:Emit(30) Object.Smoke1:Emit(30) Object.Smoke2:Emit(30) Object.Debris:Emit(10) Object.exlight:Emit(2) Object.dust:Emit(50) Beps.Transparency = 1 Explode() end Object.Touched:Connect(function(part) if Used == true or part.Name == "Handle" then return end if part:IsDescendantOf(Tag.Value.Character) then return end if part.Parent then if part.Parent:FindFirstChild("Humanoid") then local human = part.Parent.Humanoid if checkTeams(human) then tagHuman(human) human:TakeDamage(Damage) end end Used = true Object.Impact:Play() Object.Velocity = Vector3.new(Object.Velocity.x/10,Object.Velocity.y/10,Object.Velocity.z/10) Object.RotVelocity = Vector3.new(Object.RotVelocity.x/10,Object.RotVelocity.y/10,Object.RotVelocity.z/10) game:GetService("Debris"):AddItem(Object, 10) end end) boom()
----------//KeyBinds\\----------
CAS:BindAction("NVG", handleAction, false, gameRules.ToggleNVG) function BindActions() CAS:BindAction("Run", handleAction, false, gameRules.Sprint) CAS:BindAction("Stand", handleAction, false, gameRules.StandUp) CAS:BindAction("Crouch", handleAction, false, gameRules.Crouch) CAS:BindAction("ToggleWalk", handleAction, false, gameRules.SlowWalk) CAS:BindAction("LeanLeft", handleAction, false, gameRules.LeanLeft) CAS:BindAction("LeanRight", handleAction, false, gameRules.LeanRight) end function UnBindActions() CAS:UnbindAction("Run") CAS:UnbindAction("Stand") CAS:UnbindAction("Crouch") CAS:UnbindAction("ToggleWalk") CAS:UnbindAction("LeanLeft") CAS:UnbindAction("LeanRight") end BindActions()
--[[ tweenJoint Function Parameters: Object Joint - This has to be a weld with a C0 and C1 property CFrame newC0 - This is what the new C0 of the weld will be. You can put nil if you don't want to effect the C0 CFrame newC1 - This is what the new C1 of the weld will be. You can put nil if you don't want to effect the C1 function Alpha - This is an alpha function that takes an input parameter of a number between 0 and 90 and returns a number between 0 and 1. For example, function(X) return math.sin(math.rad(X)) end float Duration - This is how long the tweening takes to complete --]]
function tweenJoint(Joint, newC0, newC1, Alpha, Duration) spawn(function() local newCode = math.random(-1e9, 1e9) --This creates a random code between -1000000000 and 1000000000 local tweenIndicator = nil if (not Joint:findFirstChild("tweenCode")) then --If the joint isn't being tweened, then tweenIndicator = Instance.new("IntValue") tweenIndicator.Name = "tweenCode" tweenIndicator.Value = newCode tweenIndicator.Parent = Joint else tweenIndicator = Joint.tweenCode tweenIndicator.Value = newCode --If the joint is already being tweened, this will change the code, and the tween loop will stop end if Duration <= 0 then --If the duration is less than or equal to 0 then there's no need for a tweening loop if newC0 then Joint.C0 = newC0 end if newC1 then Joint.C1 = newC1 end else local Increment = 1.5 / Duration --Calculate the increment here so it doesn't need to be calculated in the loop local startC0 = Joint.C0 local startC1 = Joint.C1 local X = 0 while true do RS.RenderStepped:wait() --This makes the for loop step every 1/60th of a second local newX = X + Increment X = (newX > 90 and 90 or newX) --Makes sure the X never goes above 90 if tweenIndicator.Value ~= newCode then break end --This makes sure that another tween wasn't called on the same joint if newC0 then Joint.C0 = startC0:lerp(newC0, Alpha(X)) end if newC1 then Joint.C1 = startC1:lerp(newC1, Alpha(X)) end if X == 90 then break end --If the tweening is done... end end if tweenIndicator.Value == newCode then --If this tween functions was the last one called on a joint then it will remove the code tweenIndicator:Destroy() end end) end function CreateWeld(Part, CF) local w = Instance.new("Weld") w.Name = "LegWeld" w.Parent = char.LowerTorso w.Part0 = char.LowerTorso w.Part1 = Part tweenJoint(w, nil, CF, function(X) return math.sin(math.rad(X)) end, 0.25) end
--[[ ___ _______ _ / _ |____/ ___/ / ___ ____ ___ (_)__ / __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-< /_/ |_| \___/_//_/\_,_/___/___/_/___/ 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 mult=0 local det=.13 local trm=.4 local trmmult=0 local trmon=0 local throt=0 local redline=0 local shift=0 local volmult = .3 script:WaitForChild("Rev") script.Parent.Values.Gear.Changed:connect(function() mult=1 if script.Parent.Values.RPM.Value>5000 then shift=.2 end end) for i,v in pairs(car.DriveSeat:GetChildren()) do for _,a in pairs(script:GetChildren()) do if v.Name==a.Name then v:Stop() wait() v:Destroy() end end end handler:FireServer("newSound","Rev",car.DriveSeat,script.Rev.SoundId,0,script.Rev.Volume,true) handler:FireServer("playSound","Rev") car.DriveSeat:WaitForChild("Rev") while wait() do mult=math.max(0,mult-.1) local _RPM = script.Parent.Values.RPM.Value if script.Parent.Values.Throttle.Value <= _Tune.IdleThrottle/100 then throt = math.max(.3,throt-.2) trmmult = math.max(0,trmmult-.05) trmon = 1 else throt = math.min(1,throt+.1) trmmult = 1 trmon = 0 end shift = math.min(1,shift+.2) 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 Volume = (2*throt*shift*redline)+(trm*trmon*trmmult*(1-throt)*math.sin(tick()*50)) local Pitch = math.max((((script.Rev.SetPitch.Value + script.Rev.SetRev.Value*_RPM/_Tune.Redline))*on^2)+(det*mult*math.sin(80*tick())),script.Rev.SetPitch.Value) if FE then handler:FireServer("updateSound","Rev",script.Rev.SoundId,Pitch,Volume * volmult) else car.DriveSeat.Rev.Volume = Volume * volmult car.DriveSeat.Rev.Pitch = Pitch end end
--[[ Roblox Services ]]
-- local Players = game:GetService("Players")
--------------------[ GUI SETUP FUNCTION ]--------------------------------------------
function convertKey(Key) if Key == string.char(8) then return "BKSPCE" elseif Key == string.char(9) then return "TAB" elseif Key == string.char(13) then return "ENTER" elseif Key == string.char(17) then return "UP" elseif Key == string.char(18) then return "DOWN" elseif Key == string.char(19) then return "RIGHT" elseif Key == string.char(20) then return "LEFT" elseif Key == string.char(22) then return "HOME" elseif Key == string.char(23) then return "END" elseif Key == string.char(27) then return "F2" elseif Key == string.char(29) then return "F4" elseif Key == string.char(30) then return "F5" elseif Key == string.char(32) or Key == " " then return "F7" elseif Key == string.char(33) or Key == "!" then return "F8" elseif Key == string.char(34) or Key == '"' then return "F9" elseif Key == string.char(35) or Key == "#" then return "F10" elseif Key == string.char(37) or Key == "%" then return "F12" elseif Key == string.char(47) or Key == "/" then return "R-SHIFT" elseif Key == string.char(48) or Key == "0" then return "L-SHIFT" elseif Key == string.char(49) or Key == "1" then return "R-CTRL" elseif Key == string.char(50) or Key == "2" then return "L-CTRL" elseif Key == string.char(51) or Key == "3" then return "R-ALT" elseif Key == string.char(52) or Key == "4" then return "L-ALT" else return string.upper(Key) end end function createControlFrame(Key, Desc, Num) local C = Instance.new("Frame") C.BackgroundTransparency = ((Num % 2) == 1 and 0.7 or 1) C.BorderSizePixel = 0 C.Name = "C"..Num C.Position = UDim2.new(0, 0, 0, Num * 20) C.Size = UDim2.new(1, 0, 0, 20) C.ZIndex = 10 local K = Instance.new("TextLabel") K.BackgroundTransparency = 1 K.Name = "Key" K.Size = UDim2.new(0, 45, 1, 0) K.ZIndex = 10 K.Font = Enum.Font.ArialBold K.FontSize = Enum.FontSize.Size14 K.Text = Key K.TextColor3 = Color3.new(1, 1, 1) K.TextScaled = (string.len(Key) > 5) K.TextWrapped = (string.len(Key) > 5) K.Parent = C local D = Instance.new("TextLabel") D.BackgroundTransparency = 1 D.Name = "Desc" D.Position = UDim2.new(0, 50, 0, 0) D.Size = UDim2.new(1, -50, 1, 0) D.ZIndex = 10 D.Font = Enum.Font.SourceSansBold D.FontSize = Enum.FontSize.Size14 D.Text = "- "..Desc D.TextColor3 = Color3.new(1, 1, 1) D.TextXAlignment = Enum.TextXAlignment.Left D.Parent = C C.Parent = Controls end function createModes() numModes = 0 for i, v in pairs(S.selectFireSettings.Modes) do if v then numModes = numModes + 1 end end local currentMode = 0 for i, v in pairs(S.selectFireSettings.Modes) do if v then local Frame = Instance.new("Frame") Frame.BackgroundTransparency = 1 Frame.Name = currentMode Frame.Position = UDim2.new() Frame.Size = UDim2.new() Frame.Parent = fireModes local modeLabel = Instance.new("TextLabel") modeLabel.BackgroundTransparency = 1 modeLabel.Name = "Label" modeLabel.Position = UDim2.new(0, -20, 0, 0) modeLabel.Size = UDim2.new(0, 40, 0, 20) modeLabel.Font = Enum.Font.SourceSansBold modeLabel.FontSize = Enum.FontSize.Size18 modeLabel.Text = string.upper(i) modeLabel.TextColor3 = Color3.new(1, 1, 1) modeLabel.TextScaled = true modeLabel.TextStrokeTransparency = 0 modeLabel.TextTransparency = 0.5 modeLabel.TextWrapped = true modeLabel.Parent = Frame table.insert(Modes, string.upper(i)) currentMode = currentMode + 1 end end guiAngOffset = -15 * (numModes ^ 3) + 150 * (numModes ^ 2) - 525 * numModes + 660 end function setUpGUI() local currentNum = 1 for _, v in pairs(Controls:GetChildren()) do if v.Name ~= "Title" then v:Destroy() end end for _, PTable in pairs(Plugins.KeyDown) do createControlFrame(convertKey(PTable.Key), PTable.Description, currentNum) currentNum = currentNum + 1 end if S.canChangeStance then local Dive = (S.dolphinDive and " / Dive" or "") createControlFrame(convertKey(S.Keys.lowerStance), "Lower Stance"..Dive, currentNum) currentNum = currentNum + 1 createControlFrame(convertKey(S.Keys.raiseStance), "Raise Stance", currentNum) currentNum = currentNum + 1 end if S.selectFire then createControlFrame(convertKey(S.Keys.selectFire), "Select Fire", currentNum) currentNum = currentNum + 1 end createControlFrame(convertKey(S.Keys.Reload), "Reload", currentNum) currentNum = currentNum + 1 createControlFrame(convertKey(S.Keys.Sprint), "Sprint", currentNum) currentNum = currentNum + 1 if S.canADS then local Hold = (S.aimSettings.holdToADS and "HOLD " or "") if S.Keys.ADS ~= "" then createControlFrame(Hold..convertKey(S.Keys.ADS).." OR R-MOUSE", "Aim Down Sights", currentNum) else createControlFrame(Hold.." R-MOUSE", "Aim Down Sights", currentNum) end currentNum = currentNum + 1 end Controls.Size = UDim2.new(1, 0, 0, currentNum * 20) Controls.Position = UDim2.new(0, 0, 0, -(currentNum * 20) - 80) if S.guiScope then scopeSteady.Text = "Hold "..convertKey(S.Keys.scopeSteady).." to Steady" end if mainGUI:FindFirstChild("Co") then mainGUI.Co:Destroy() end local Co = Instance.new("TextLabel") Co.BackgroundTransparency = 1 Co.Name = "Co" Co.Visible = true Co.Position = UDim2.new(0, 0, 0, 0) Co.Size = UDim2.new(1, 0, 0, 20) Co.Font = Enum.Font.ArialBold Co.FontSize = Enum.FontSize.Size14 Co.Text = ("~ 125rednaX & tEhYuM yb ekameR // noisuFobruT yb tiK ~"):reverse() Co.TextColor3 = Color3.new(1, 1, 1) Co.TextStrokeColor3 = Color3.new(1, 1, 1) Co.TextStrokeTransparency = 0.9 Co.TextTransparency = 0.9 Co.TextXAlignment = Enum.TextXAlignment.Center Co.Parent = mainGUI gunNameTitle.Text = Gun.Name updateClipAmmo() updateStoredAmmo() fireModes:ClearAllChildren() createModes() updateModeLabels(numModes - 1, 0, 90) if S.selectFire then modeGUI.Text = Modes[((rawFireMode - 1) % numModes) + 1] else modeGUI.Text = ( S.gunType.Semi and "SEMI" or S.gunType.Auto and "AUTO" or S.gunType.Burst and "BURST" or "SAFETY" ) end end
--------------------) Settings
Damage = 0 -- the ammout of health the player or mob will take Cooldown = 10 -- cooldown for use of the tool again ZoneModelName = "Sea of Dust" -- name the zone model MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage
--[=[ @function update @within Dictionary @param dictionary {[K]: V} -- The dictionary to update. @param key K -- The key to update. @param updater? (value: V, key: K) -> U -- The updater function. @param callback? (key: K) -> C -- The callback function. @return {[K]: V & U & C } -- The updated dictionary. Updates a value in a dictionary at the given key. If the value at the given key does not exist, `callback` will be called, and its return value will be used as the value at the given key. ```lua local dictionary = { cats = 2 } local new = Update(dictionary, "cats", function(value) return value + 1 end) -- { cats = 3 } local new = Update(dictionary, "dogs", function(value) return value + 1 end, function(value) return 1 end) -- { cats = 3, dogs = 1 } ``` ]=]
local function update<K, V, U, C>( dictionary: { [K]: V }, key: K, updater: ((value: V, key: K) -> U)?, callback: ((key: K) -> C)? ): { [K]: V & U & C } local result = copy(dictionary) if result[key] ~= nil then if updater then result[key] = updater(result[key], key) end else if callback then result[key] = call(callback, key) end end return result end return update
--[[Engine]]
local fFD = _Tune.FinalDrive*_Tune.FDMult local fFDr = fFD*30/math.pi local cGrav = workspace.Gravity*_Tune.InclineComp/32.2 local wDRatio = wDia*math.pi/60 local cfWRot = CFrame.Angles(math.pi/2,-math.pi/2,0) local cfYRot = CFrame.Angles(0,math.pi,0) local rtTwo = (2^.5)/2 --Horsepower Curve local fgc_h=_Tune.Horsepower/100 local fgc_n=_Tune.PeakRPM/1000 local fgc_a=_Tune.PeakSharpness local fgc_c=_Tune.CurveMult function FGC(x) x=x/1000 return (((-(x-fgc_n)^2)*math.min(fgc_h/(fgc_n^2),fgc_c^(fgc_n/fgc_h)))+fgc_h)*(x-((x^fgc_a)/((fgc_a*fgc_n)^(fgc_a-1)))) end local PeakFGC = FGC(_Tune.PeakRPM) --Plot Current Horsepower function GetCurve(x,gear) local hp=math.max((FGC(x)*_Tune.Horsepower)/PeakFGC,0) return hp,hp*(_Tune.EqPoint/x)*_Tune.Ratios[gear+2]*fFD*hpScaling end --Output Cache local CacheTorque = true local HPCache = {} local HPInc = 100 if CacheTorque then for gear,ratio in pairs(_Tune.Ratios) do local hpPlot = {} for rpm = math.floor(_Tune.IdleRPM/HPInc),math.ceil((_Tune.Redline+100)/HPInc) do local tqPlot = {} tqPlot.Horsepower,tqPlot.Torque = GetCurve(rpm*HPInc,gear-2) hp1,tq1 = GetCurve((rpm+1)*HPInc,gear-2) tqPlot.HpSlope = (hp1 - tqPlot.Horsepower)/(HPInc/1000) tqPlot.TqSlope = (tq1 - tqPlot.Torque)/(HPInc/1000) hpPlot[rpm] = tqPlot end table.insert(HPCache,hpPlot) end end --Powertrain --Update RPM function RPM() --Neutral Gear if _CGear==0 then _ClutchOn = false end --Car Is Off local revMin = _Tune.IdleRPM if not _IsOn then revMin = 0 _CGear = 0 _ClutchOn = false _GThrot = _Tune.IdleThrottle/100 end --Determine RPM local maxSpin=0 for i,v in pairs(Drive) do if v.RotVelocity.Magnitude>maxSpin then maxSpin = v.RotVelocity.Magnitude end end if _ClutchOn then local aRPM = math.max(math.min(maxSpin*_Tune.Ratios[_CGear+2]*fFDr,_Tune.Redline+100),revMin) local clutchP = math.min(math.abs(aRPM-_RPM)/_Tune.ClutchTol,.9) _RPM = _RPM*clutchP + aRPM*(1-clutchP) else if _GThrot-(_Tune.IdleThrottle/100)>0 then if _RPM>_Tune.Redline then _RPM = _RPM-_Tune.RevBounce*2 else _RPM = math.min(_RPM+_Tune.RevAccel*_GThrot,_Tune.Redline+100) end else _RPM = math.max(_RPM-_Tune.RevDecay,revMin) end end --Rev Limiter _spLimit = (_Tune.Redline+100)/(fFDr*_Tune.Ratios[_CGear+2]) if _RPM>_Tune.Redline then if _CGear<#_Tune.Ratios-2 then _RPM = _RPM-_Tune.RevBounce else _RPM = _RPM-_Tune.RevBounce*.5 end end end --Apply Power function Engine() --Get Torque local maxSpin=0 for i,v in pairs(Drive) do if v.RotVelocity.Magnitude>maxSpin then maxSpin = v.RotVelocity.Magnitude end end if _ClutchOn then if CacheTorque then local cTq = HPCache[_CGear+2][math.floor(math.min(_Tune.Redline,math.max(_Tune.IdleRPM,_RPM))/HPInc)] _HP = cTq.Horsepower+(cTq.HpSlope*(_RPM-math.floor(_RPM/HPInc))/1000) _OutTorque = cTq.Torque+(cTq.TqSlope*(_RPM-math.floor(_RPM/HPInc))/1000) else _HP,_OutTorque = GetCurve(_RPM,_CGear) end local iComp =(car.DriveSeat.CFrame.lookVector.y)*cGrav if _CGear==-1 then iComp=-iComp end _OutTorque = _OutTorque*math.max(1,(1+iComp)) else _HP,_OutTorque = 0,0 end --Automatic Transmission if _TMode == "Auto" and _IsOn then _ClutchOn = true if _CGear == 0 then _CGear = 1 end if _CGear >= 1 then
--[=[ Returns whether or not the promise is rejected @return bool -- True if rejected ]=]
function Promise:IsRejected() return self._rejected ~= nil end
-- This is baically a function that finds all unanchored parts and adds them to childList. -- Note: This should only be run once for each object
function checkObject(obj) if obj ~= hole and obj:isA("BasePart") then if not obj.Anchored then childList[obj] = true end elseif obj:isA("Model") or obj:isA("Accoutrement") or obj:isA("Tool") then for _, child in ipairs(obj:GetChildren()) do checkObject(child) end obj.ChildAdded:connect(checkObject) end end checkObject(workspace) print("Black Hole script loaded.") while true do for child in pairs(childList) do local distance = (hole.Position - child.Position).magnitude local motivator = child:FindFirstChild("BlackHole Influence") if distance * 240 * massConstant < mass then child:BreakJoints() if distance * 320 * massConstant < mass and child.Size.z + hole.Size.x > distance * 2 - 4 then mass = mass + child:GetMass() childList[child] = nil child:Remove() else child.CanCollide = false -- I Can assume that things won't escape the black hole. if not motivator then motivator = Instance.new("BodyPosition") motivator.Parent = child motivator.Name = "BlackHole Influence" end motivator.position = hole.Position motivator.maxForce = Vector3.new(1, 1, 1) * mass * child:GetMass() / (distance * massConstant) end elseif motivator ~= nil then motivator:Remove() end end wait() end
---------------------------------------------------------------
function onChildAdded(child) if child.Name == "SeatWeld" then local human = child.part1.Parent:FindFirstChild("Humanoid") if (human ~= nil) then print("Human IN") seat.SirenControl.Control.CarName.Value = human.Parent.Name.."'s Car" seat.Parent.Name = human.Parent.Name.."'s Car" script.Parent.SirenControl.Control.power.Value = true s.Parent.SirenControl:Clone().Parent = game.Players:FindFirstChild(human.Parent.Name).PlayerGui seat.Start:Play() wait(1) seat.Start:Stop() seat.Engine:Play() end end end function onChildRemoved(child) if (child.Name == "SeatWeld") then local human = child.part1.Parent:findFirstChild("Humanoid") if (human ~= nil) then print("Human OUT") seat.Parent.Name = "Empty Car" seat.SirenControl.Control.CarName.Value = "Empty Car" game.Players:findFirstChild(human.Parent.Name).PlayerGui.SirenControl:remove() script.Parent.SirenControl.Control.power.Value = false seat.Engine:Stop() end end end script.Parent.ChildAdded:connect(onChildAdded) script.Parent.ChildRemoved:connect(onChildRemoved)
--====================================================================
infoButton.MouseEnter:Connect(function() topbar_infoButton_f:Play() end) infoButton.MouseLeave:Connect(function() topbar_infoButton_nf:Play() -- These are all end) -- for the infoButton
----- Script -----
Button.Activated:Connect(function() Events.KatanaEvent:FireServer() Frame.Visible = false end)
--[[ local core = game.ReplicatedStorage.CustomMovement; local studioAnim = require(core.Utility:WaitForChild("StudioAnim")); local animations = core:WaitForChild("Animations"); studioAnim(animations); --]]
local RUNSERVICE = game:GetService("RunService"); local KFSP = game:GetService("KeyframeSequenceProvider"); local function convert(anim) local kfs = anim:FindFirstChildWhichIsA("KeyframeSequence"); if (kfs) then anim.AnimationId = KFSP:RegisterKeyframeSequence(kfs); end end return function(animFolder) for k, anim in next, animFolder:GetChildren() do convert(anim); end end
-- -- If already loaded and cached, return cached module. This should behave -- -- similarly to normal `require` behavior -- if requiredModules[scriptInstance] ~= nil then -- return requiredModules[scriptInstance] -- end
--EnteredCode
local Digit1 = script.Parent.Parent.Parent.Digit1Panel.DigitNumber local Digit2 = script.Parent.Parent.Parent.Digit2Panel.DigitNumber local Digit3 = script.Parent.Parent.Parent.Digit3Panel.DigitNumber local EnteredCode = script.Parent.Parent.Parent.EnteredCode
--[=[ Construct a new Promise that will be resolved or rejected with the given callbacks. If you `resolve` with a Promise, it will be chained onto. You can safely yield within the executor function and it will not block the creating thread. ```lua local myFunction() return Promise.new(function(resolve, reject, onCancel) wait(1) resolve("Hello world!") end) end myFunction():andThen(print) ``` You do not need to use `pcall` within a Promise. Errors that occur during execution will be caught and turned into a rejection automatically. If `error()` is called with a table, that table will be the rejection value. Otherwise, string errors will be converted into `Promise.Error(Promise.Error.Kind.ExecutionError)` objects for tracking debug information. You may register an optional cancellation hook by using the `onCancel` argument: * This should be used to abort any ongoing operations leading up to the promise being settled. * Call the `onCancel` function with a function callback as its only argument to set a hook which will in turn be called when/if the promise is cancelled. * `onCancel` returns `true` if the Promise was already cancelled when you called `onCancel`. * Calling `onCancel` with no argument will not override a previously set cancellation hook, but it will still return `true` if the Promise is currently cancelled. * You can set the cancellation hook at any time before resolving. * When a promise is cancelled, calls to `resolve` or `reject` will be ignored, regardless of if you set a cancellation hook or not. @param executor (resolve: (...: any) -> (), reject: (...: any) -> (), onCancel: (abortHandler?: () -> ()) -> boolean) -> () @return Promise ]=]
function Promise.new(executor) return Promise._new(debug.traceback(nil, 2), executor) end function Promise:__tostring() return string.format("Promise(%s)", self._status) end
--[[Static functions]]
function Round(number, decimal) decimal = decimal or 0 local mult = 10^decimal return math.floor(number * mult + .5)/mult end function SigNum(num) if num == 0 then return 1 end return math.abs(num)/num end
--/////////// CONFIGURATIONS \\\\\\\\\\\\\\\\\
local sensitivity = 1 -- how quick/snappy the sway movements are. Don't go above 2 local swaysize = 1 -- how large/powerful the sway is. Don't go above 2 local includestrafe = false -- if true the fps arms will sway when the character is strafing local includewalksway = true -- if true, fps arms will sway when you are walking local includecamerasway = true -- if true, fps arms will sway when you move the camera local includejumpsway = true -- if true, jumping will have an effect on the viewmodel local headoffset = Vector3.new(0,0,0) -- the offset from the default camera position of the head. (0,1,0) will put the camera one stud above the head. local firstperson_arm_transparency = 0 -- the transparency of the arms in first person; set to 1 for invisible and set to 0 for fully visible. local firstperson_waist_movements_enabled = false -- if true, animations will affect the Uppertorso. If false, the uppertorso stays still while in first person (applies to R15 only)
-- Script GUID: {6BA2CDC4-2490-4BF3-A382-3936CFCA3401} -- Decompiled with the Synapse X Luau decompiler.
local v1 = script:FindFirstAncestor("MainUI"); local l__LocalPlayer__2 = game.Players.LocalPlayer; local v3 = require(l__LocalPlayer__2:WaitForChild("PlayerScripts"):WaitForChild("PlayerModule")):GetControls(); local v4 = game["Run Service"]; local l__UserInputService__5 = game:GetService("UserInputService"); local l__TweenService__6 = game:GetService("TweenService"); local v7 = require(script:WaitForChild("Lightning")); local l__Bricks__1 = game:GetService("ReplicatedStorage"):WaitForChild("Bricks"); local u2 = require(script.Parent); local v8 = require(game:GetService("ReplicatedStorage"):WaitForChild("ClientModules"):WaitForChild("Module_Events")); v8.init(u2); local v10 = Vector3.new(); game.SoundService.Main.Volume = 1; l__Bricks__1:WaitForChild("PadlockHint").OnClientEvent:Connect(function(p1, p2, p3) local l__Hints__11 = v1.Parent.PermUI.Hints; l__Hints__11.Visible = true; if not p1 or not p2 then l__Hints__11.Visible = false; for v12, v13 in pairs(l__Hints__11:GetChildren()) do if v13.Name == "Icon" then v13:Destroy(); end; end; return; end; local v14 = l__Hints__11.Template:Clone(); v14.Name = "Icon"; v14.Visible = true; v14.ImageRectOffset = Vector2.new(50 * p1, 0); v14.TextLabel.Text = p2; if p3 and p3 ~= l__LocalPlayer__2.UserId then v14.User.Visible = true; v14.User.Image = "rbxthumb://type=AvatarHeadShot&id=" .. p3 .. "&w=48&h=48"; end; v14.Parent = l__Hints__11; end); l__Bricks__1:WaitForChild("MotorReplication").OnClientEvent:Connect(function(p4, p5, p6, p7) if not p4 or not p4:FindFirstChild("Humanoid") or not p4:FindFirstChild("Humanoid"):GetAttribute("AppearanceFinal") then return; end; local v15 = CFrame.new(0, 0.22, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1); local v16 = CFrame.new(0, -1.1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1); local v17 = CFrame.new(0, 0.88, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1); local v18 = CFrame.new(1, 0.62, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1); local v19 = CFrame.new(-1, 0.62, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1); if p4 and p4:FindFirstChild("HumanoidRootPart") then local l__HumanoidRootPart__20 = p4:WaitForChild("HumanoidRootPart", 0.5); local l__ClientMotors__21 = p4:FindFirstChild("ClientMotors"); local l__Waist__22 = p4:WaitForChild("UpperTorso", 0.5):WaitForChild("Waist", 0.5); local l__Neck__23 = p4:WaitForChild("Head", 0.5):WaitForChild("Neck", 0.5); local l__Root__24 = p4:WaitForChild("LowerTorso", 0.5):WaitForChild("Root", 0.5); local l__RightShoulder__25 = p4:WaitForChild("RightUpperArm", 0.5):WaitForChild("RightShoulder", 0.5); local l__LeftShoulder__26 = p4:WaitForChild("LeftUpperArm", 0.5):WaitForChild("LeftShoulder", 0.5); local l__Value__27 = l__Root__24:WaitForChild("CVal").Value; local l__Value__28 = l__Waist__22:WaitForChild("CVal").Value; local l__Value__29 = l__Neck__23:WaitForChild("CVal").Value; local l__Value__30 = l__LeftShoulder__26:WaitForChild("CVal").Value; local l__Value__31 = l__RightShoulder__25:WaitForChild("CVal").Value; local v32 = v16 * CFrame.Angles(0, math.rad(p5 * -45), 0); local v33 = v15 * CFrame.Angles(math.rad(p6 * 0.25), 0, 0) * CFrame.Angles(0, math.rad(p5 * 45), 0) * CFrame.Angles(0, 0, math.rad(p7)); local v34 = v17 * CFrame.Angles(math.rad(p6 * 0.5), 0, 0); local v35 = v19 * CFrame.Angles(math.rad(p6 * -0.025), 0, 0); local v36 = v18 * CFrame.Angles(math.rad(p6 * -0.025), 0, 0); if not l__ClientMotors__21 then local v37 = Instance.new("BoolValue"); v37.Name = "ClientMotors"; v37.Parent = p4; end; if p4.Humanoid:GetAttribute("Stunned") == true then if l__HumanoidRootPart__20 then l__Waist__22.Enabled = false; l__Neck__23.Enabled = false; l__Root__24.Enabled = false; l__RightShoulder__25.Enabled = false; l__LeftShoulder__26.Enabled = false; return; end; else l__Waist__22.Enabled = true; l__Neck__23.Enabled = true; l__Root__24.Enabled = true; l__RightShoulder__25.Enabled = true; l__LeftShoulder__26.Enabled = true; if l__HumanoidRootPart__20 and (l__HumanoidRootPart__20.Position - u2.cam.CFrame.p).Magnitude > 100 then l__Root__24.C0 = v32; l__Waist__22.C0 = v33; l__Neck__23.C0 = v34; l__LeftShoulder__26.C0 = v35; l__RightShoulder__25.C0 = v36; return; end; if l__HumanoidRootPart__20 then local v38 = {}; local v39 = {}; local v40 = {}; local v41 = {}; local v42 = {}; v38.C0 = v32; v39.C0 = v33; v40.C0 = v34; v41.C0 = v35; v42.C0 = v36; l__TweenService__6:Create(l__Root__24, TweenInfo.new(0.1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), v38):Play(); l__TweenService__6:Create(l__Waist__22, TweenInfo.new(0.1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), v39):Play(); l__TweenService__6:Create(l__Neck__23, TweenInfo.new(0.1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), v40):Play(); l__TweenService__6:Create(l__RightShoulder__25, TweenInfo.new(0.1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), v42):Play(); l__TweenService__6:Create(l__LeftShoulder__26, TweenInfo.new(0.1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), v41):Play(); end; end; end; end); l__Bricks__1:WaitForChild("SoundToClient").OnClientEvent:Connect(function(p8, p9, p10, p11) if p8 and p9 then u2.playaudio(p8, p9, p10, p11); end; end); local u3 = {}; l__Bricks__1:WaitForChild("UseEnemyModule").OnClientEvent:Connect(function(p12, p13, ...) if not u3[p12] then u3[p12] = require(game:GetService("ReplicatedStorage").ClientModules.EntityModules:FindFirstChild(p12)); end; u3[p12][p13](u2, ...); end); l__Bricks__1:WaitForChild("UseEventModule").OnClientEvent:Connect(function(p14, ...) v8[p14](...); end); l__Bricks__1:WaitForChild("ReplicateAnimation").OnClientEvent:Connect(function(p15, p16, p17, p18, p19, p20) local v43 = game.ReplicatedStorage.AnimationRoot:Clone(); local v44 = p15.Humanoid.Animator:LoadAnimation(v43.Animation); v43:SetPrimaryPartCFrame(p15.PrimaryPart.CFrame); v43.Parent = u2.cam; l__TweenService__6:Create(v43.PrimaryPart, TweenInfo.new(0.3, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), { CFrame = p17 }):Play(); local v45 = nil; local v46 = v43.AnimationController:LoadAnimation(p16); p16 = p15.Humanoid.Animator:LoadAnimation(p16); local v47 = false; if u2.char == p15 then u2.stopcam = true; v47 = true; end; if p19 and p20 and v47 then p20 = p19:LoadAnimation(p20); v45 = p19.Parent:FindFirstChild("CamAttach", true) and v45.WorldCFrame; u2.hideplayers = -1; end; for v48 = 1, 1000 do if p16.Length > 0 then if p20 == nil then break; end; if p20.Length > 0 then break; end; end; task.wait(); end; p16:Play(0, 1, 1); v44:Play(0, 1, 1); v46:Play(0, 1, 1); if p19 and p20 then p20:Play(0, 1, 1); end; local l__CFrame__49 = p15.PrimaryPart.CFrame; local l__CFrame__50 = u2.cam.CFrame; local u4 = false; local u5 = tick(); task.spawn(function() for v51 = 1, 100000 do task.wait(); if u4 then break; end; local v52 = l__TweenService__6:GetValue((tick() - u5) * 4, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut); if v45 then v52 = l__TweenService__6:GetValue((tick() - u5) / 1.5, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut); end; p15.PrimaryPart.CFrame = p15.PrimaryPart.CFrame:Lerp(v43.LowerTorso.CFrame * CFrame.new(0, 0.96, 0), v52); if v47 then local v53 if v45 then v53 = v45; else v53 = p15.Head.CFrame * CFrame.new(0, 0.15, -0.25) * CFrame.Angles(math.rad(math.clamp(u2.bobspring.p.Y, -80, 80)), math.rad(math.clamp(u2.bobspring.p.X, -80, 80)), math.rad(math.clamp(u2.bobspring.p.Z, -40, 40))) * CFrame.Angles(0, math.rad(u2.camlockedoffset[1]), 0) * CFrame.Angles(math.rad(u2.camlockedoffset[2]), 0, 0); end; u2.cam.CFrame = u2.cam.CFrame:Lerp(v53, v52); end; end; end); task.wait(p16.Length - 0.1); u4 = true; l__TweenService__6:Create(p15.PrimaryPart, TweenInfo.new(0.1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), { CFrame = p18 }):Play(); p16:AdjustWeight(0.01); p16:AdjustSpeed(0.01); p16:Stop(0); v46:Stop(0); v44:Stop(0); v43:Destroy(); if v47 then local v54 = tick(); local l__CFrame__55 = u2.cam.CFrame; for v56 = 1, 10000 do u2.cam.CFrame = l__CFrame__55:Lerp(u2.basecamcf * u2.csgo, (l__TweenService__6:GetValue((tick() - v54) * 4, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut))); task.wait(); if v54 + 0.25 <= tick() then break; end; end; u2.stopcam = false; u2.crouching = false; end; end); local u6 = false; l__Bricks__1:WaitForChild("Jumpscare").OnClientEvent:Connect(function(p21) if u6 == true then return; end; u6 = true; v1.MainFrame.Heartbeat.Visible = false; if p21 == "Seek" then u2.deathtick = tick() + 0.5; if workspace:FindFirstChild("SeekMoving", true) then local l__SeekMoving__57 = workspace:FindFirstChild("SeekMoving", true); u2.stopcam = true; u2.fovtarget = 40; local v58 = tick(); for v59 = 1, 10000 do u2.cam.CFrame = (u2.basecamcf * u2.csgo):Lerp(l__SeekMoving__57.PrimaryPart.CamAttach.WorldCFrame, (l__TweenService__6:GetValue((tick() - v58) * 4, Enum.EasingStyle.Sine, Enum.EasingDirection.In))); task.wait(); if v58 + 0.25 <= tick() then break; end; end; else warn("cant find seekmoving"); end; script.Jumpscare_Seek:Play(); v1.Jumpscare_Seek.Visible = true; local v60 = tick(); for v61 = 1, 1000 do local v62 = math.clamp((tick() - v60) * 2, 0.1, 1); v1.Jumpscare_Seek.ImageLabel.Position = UDim2.new(0.5 + math.random(-100, 100) / (5000 * v62), 0, 0.5 + math.random(-100, 100) / (2500 * v62), 0); v1.Jumpscare_Seek.BackgroundColor3 = Color3.new(math.random(0, 4) / 12, 0, 0); game["Run Service"].RenderStepped:wait(); if v60 + 0.7 <= tick() then break; end; end; u2.stopcam = false; script.Jumpscare_Seek:Stop(); script.Kill:Play(); v1.Jumpscare_Seek.ImageLabel.Visible = false; for v63 = 1, 4 do v1.Jumpscare_Seek.BackgroundColor3 = Color3.new(math.random(0, 1), 0, 0); wait(); end; v1.Jumpscare_Seek.Visible = false; u2.deathtick = tick(); u2.fovtarget = 70; return; end; if p21 == "Rush" then u2.deathtick = tick() + 10; game.SoundService.Main.Volume = 0; script.Jumpscare_Rush:Play(); v1.Jumpscare_Rush.Visible = true; local v64 = tick(); local v65 = math.random(5, 30) / 10; local v66 = v65 + math.random(10, 60) / 10; local v67 = 0.25; for v68 = 1, 100000 do task.wait(); if v64 + v65 <= tick() then v1.Jumpscare_Rush.ImageLabel.Visible = true; v65 = v65 + math.random(7, 44) / 10; script.Jumpscare_Rush.Pitch = 1 + math.random(-100, 100) / 500; v1.Jumpscare_Rush.BackgroundColor3 = Color3.new(0, 0, math.random(0, 10) / 255); v1.Jumpscare_Rush.ImageLabel.Position = UDim2.new(0.5, math.random(-2, 2), 0.5, math.random(-2, 2)); v67 = v67 + 0.05; v1.Jumpscare_Rush.ImageLabel.Size = UDim2.new(v67, 0, v67, 0); end; if v64 + v66 <= tick() then break; end; end; v1.Jumpscare_Rush.ImageLabel.Visible = true; script.Jumpscare_Rush:Stop(); script.Jumpscare_Rush2:Play(); v1.Jumpscare_Rush.ImageLabel.Visible = false; v1.Jumpscare_Rush.ImageLabelBig.Visible = true; v1.Jumpscare_Rush.ImageLabelBig:TweenSize(UDim2.new(2.5, 0, 2.5, 0), "In", "Sine", 0.3, true); local v69 = tick(); for v70 = 1, 1000 do local v71 = math.random(0, 10) / 10; v1.Jumpscare_Rush.BackgroundColor3 = Color3.new(v71, v71, math.clamp(math.random(25, 50) / 50, v71, 1)); v1.Jumpscare_Rush.ImageLabelBig.Position = UDim2.new(0.5 + math.random(-100, 100) / 5000, 0, 0.5 + math.random(-100, 100) / 3000, 0); task.wait(0.016666666666666666); if v69 + 0.3 <= tick() then break; end; end; v1.Jumpscare_Rush.ImageLabelBig.Visible = false; v1.Jumpscare_Rush.BackgroundColor3 = Color3.new(0, 0, 0); v1.Jumpscare_Rush.Visible = false; u2.deathtick = tick(); return; end; if p21 == "A-60" then u2.deathtick = tick() + 10; game.SoundService.Main.Volume = 0; script["Jumpscare_A-60"]:Play(); v1["Jumpscare_A-60"].Visible = true; local v64 = tick(); local v65 = math.random(5, 30) / 10; local v66 = v65 + math.random(10, 60) / 10; local v67 = 0.25; for v68 = 1, 100000 do task.wait(); if v64 + v65 <= tick() then v1["Jumpscare_A-60"].ImageLabel.Visible = true; v65 = v65 + math.random(7, 44) / 10; script["Jumpscare_A-60"].Pitch = 1 + math.random(-100, 100) / 500; v1["Jumpscare_A-60"].BackgroundColor3 = Color3.new(0, 0, math.random(0, 10) / 255); v1["Jumpscare_A-60"].ImageLabel.Position = UDim2.new(0.5, math.random(-2, 2), 0.5, math.random(-2, 2)); v67 = v67 + 0.05; v1["Jumpscare_A-60"].ImageLabel.Size = UDim2.new(v67, 0, v67, 0); end; if v64 + v66 <= tick() then break; end; end; v1["Jumpscare_A-60"].ImageLabel.Visible = true; script["Jumpscare_A-60"]:Stop(); script["Jumpscare_A-60"]:Play(); v1["Jumpscare_A-60"].ImageLabel.Visible = false; v1["Jumpscare_A-60"].ImageLabelBig.Visible = true; v1["Jumpscare_A-60"].ImageLabelBig:TweenSize(UDim2.new(2.5, 0, 2.5, 0), "In", "Sine", 0.3, true); local v69 = tick(); for v70 = 1, 1000 do local v71 = math.random(0, 10) / 10; v1["Jumpscare_A-60"].BackgroundColor3 = Color3.new(v71, v71, math.clamp(math.random(25, 50) / 50, v71, 1)); v1["Jumpscare_A-60"].ImageLabelBig.Position = UDim2.new(0.5 + math.random(-100, 100) / 5000, 0, 0.5 + math.random(-100, 100) / 3000, 0); task.wait(0.016666666666666666); if v69 + 0.3 <= tick() then break; end; end; v1["Jumpscare_A-60"].ImageLabelBig.Visible = false; v1["Jumpscare_A-60"].BackgroundColor3 = Color3.new(0, 0, 0); v1["Jumpscare_A-60"].Visible = false; u2.deathtick = tick(); return; end; if p21 == "Ambush" then u2.deathtick = tick() + 10; game.SoundService.Main.Volume = 0; script.Jumpscare_Ambush:Play(); v1.Jumpscare_Ambush.Visible = true; local v72 = tick(); local v73 = math.random(5, 30) / 100; local v74 = v73 + math.random(10, 60) / 100; local v75 = 0.2; for v76 = 1, 100000 do task.wait(0.016666666666666666); v1.Jumpscare_Ambush.ImageLabel.Position = UDim2.new(0.5, math.random(-15, 15), 0.5, math.random(-15, 15)); v1.Jumpscare_Ambush.BackgroundColor3 = Color3.new(0, math.random(4, 10) / 255, math.random(0, 3) / 255); if v72 + v73 <= tick() then v1.Jumpscare_Ambush.ImageLabel.Visible = true; v73 = v73 + math.random(7, 44) / 100; script.Jumpscare_Ambush.Pitch = math.random(35, 155) / 100; v1.Jumpscare_Ambush.BackgroundColor3 = Color3.new(0, math.random(4, 10) / 255, math.random(0, 3) / 255); v1.Jumpscare_Ambush.ImageLabel.Position = UDim2.new(0.5, math.random(-25, 25), 0.5, math.random(-25, 25)); v75 = v75 + 0.05; v1.Jumpscare_Ambush.ImageLabel.Size = UDim2.new(v75, 0, v75, 0); end; if v72 + v74 <= tick() then break; end; end; script.Jumpscare_Ambush2:Play(); v1.Jumpscare_Ambush.ImageLabel.Visible = true; v1.Jumpscare_Ambush.ImageLabel:TweenSize(UDim2.new(9, 0, 9, 0), "In", "Quart", 0.3, true); local v77 = tick(); for v78 = 1, 100 do local v79 = math.random(0, 10) / 10; v1.Jumpscare_Ambush.BackgroundColor3 = Color3.new(v79, math.clamp(math.random(25, 50) / 50, v79, 1), math.clamp(math.random(25, 50) / 150, v79, 1)); game["Run Service"].RenderStepped:wait(); if v77 + 0.3 <= tick() then break; end; end; script.Jumpscare_Ambush:Stop(); v1.Jumpscare_Ambush.ImageLabel.Visible = false; v1.Jumpscare_Ambush.BackgroundColor3 = Color3.new(0, 0, 0); v1.Jumpscare_Ambush.Visible = false; u2.deathtick = tick(); return; end; if p21 == "Figure" then l__TweenService__6:Create(game.SoundService.Main, TweenInfo.new(0.3, Enum.EasingStyle.Quart, Enum.EasingDirection.Out), { Volume = 0 }):Play(); local l__FigureSetup__80 = workspace:FindFirstChild("FigureSetup", true); if workspace:FindFirstChild("FigureSetup", true) then local v81 = u2.cam; if l__FigureSetup__80 then v81 = l__FigureSetup__80.Parent; end; u2.stopcam = true; u2.fovtarget = 80; script.Reverse:Play(); script.Figure_Growl:Play(); local v82 = game:GetService("ReplicatedStorage"):WaitForChild("JumpscareModels"):WaitForChild("Figure"):Clone(); if l__FigureSetup__80 then l__FigureSetup__80.Parent = game:GetService("ReplicatedStorage"); v82:SetPrimaryPartCFrame(l__FigureSetup__80.FigureRagdoll.PrimaryPart.CFrame); else v82:SetPrimaryPartCFrame(u2.cam.CFrame); end; v82.Parent = u2.cam; v82:WaitForChild("AnimationController"):LoadAnimation(v82:WaitForChild("Jumpscare")):Play(0, 1, 1); game.Debris:AddItem(v82, 10); local l__OriginalCFrame__83 = script:WaitForChild("OriginalCFrame"); l__OriginalCFrame__83.Value = u2.cam.CFrame; l__TweenService__6:Create(l__OriginalCFrame__83, TweenInfo.new(0.6, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), { Value = v82:WaitForChild("CamSpot").CFrame }):Play(); u2.camShaker:ShakeOnce(20, 12, 0, 0.2); u2.camShaker:ShakeOnce(2, 24, 0.1, 0.5, Vector3.new(0, 0, 0), Vector3.new(3, 1, 3)); u2.camShaker:ShakeOnce(8, 25, 0.7, 1, Vector3.new(0, 0, 0)); local v84 = tick(); delay(0.55, function() u2.camShaker:ShakeOnce(1, 35, 0.01, 1, Vector3.new(0, 0, 0), Vector3.new(3, 1, 3)); end); for v85 = 1, 1000 do game["Run Service"].RenderStepped:wait(); u2.cam.CFrame = l__OriginalCFrame__83.Value * u2.csgo; if v84 + 0.8 <= tick() then break; end; end; if l__FigureSetup__80 then l__FigureSetup__80.Parent = v81; end; v82:Destroy(); end; script.Kill:Play(); v1.FlashFrame.Visible = true; for v86 = 1, 8 do v1.FlashFrame.BackgroundColor3 = Color3.new(math.random(0, 1), 0, 0); wait(); end; v1.FlashFrame.BackgroundColor3 = Color3.new(0, 0, 0); u2.cam.CameraType = Enum.CameraType.Scriptable; u2.stopcam = false; u2.deathtick = tick(); v1.FlashFrame.Visible = false; end; end); l__Bricks__1:WaitForChild("Cutscene").OnClientEvent:Connect(function(p22) local v87 = script.Cutscenes:FindFirstChild(p22); if v87 then require(v87)(u2); end; end); l__Bricks__1:WaitForChild("GetOutOfHiding").OnClientEvent:Connect(function() u2.char:SetAttribute("Hiding", true); u2.char:SetAttribute("Hiding", false); end); u2.char:GetAttributeChangedSignal("Hiding"):Connect(function() if u2.char:GetAttribute("Hiding") == true then for v88 = 1, 100000 do task.wait(0.1); if u2.char:GetAttribute("Hiding") == false then u2.ax_t = u2.ax_t + u2.camlockedoffset[1] % 360; u2.ay_t = math.clamp(u2.ay_t + u2.camlockedoffset[2], -65, 65); if math.abs(u2.ax_t) > 180 then u2.ax_t = u2.ax_t - 360; u2.ax_t = u2.ax_t; end; if math.abs(u2.ax) > 180 then u2.ax = u2.ax - 360; u2.ax = u2.ax; end; u2.camShaker:ShakeOnce(8, 1, 0, 1, Vector3.new(0, 0, 0)); u2.camlock = nil; --game:GetService("ReplicatedStorage").Bricks.CamLock:FireServer(); v1.HideVignette.Visible = false; return; end; end; end; end); l__Bricks__1:WaitForChild("CamLock").OnClientEvent:Connect(function(p23) local v89, v90, v91 = CFrame.new(Vector3.new(0, 0, 0), p23):ToOrientation(); if math.abs(u2.ax - math.deg(v90)) > 180 then u2.ax_t = u2.ax_t - 360; u2.ax = u2.ax_t; end; u2.camlock = { y = math.deg(v89), x = math.deg(v90), z = 0, last = tick() + 1, pos = u2.char.PrimaryPart.Position }; u2.camlockHead = false; v1.HideVignette.ImageTransparency = 1; v1.HideVignette.Visible = true; l__TweenService__6:Create(v1.HideVignette, TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), { ImageTransparency = 0 }):Play(); u2.camShaker:ShakeOnce(12, 1, 0, 1, Vector3.new(0, 0, 0)); end); l__Bricks__1:WaitForChild("CamLockHead").OnClientEvent:Connect(function(p24) local v92, v93, v94 = CFrame.new(Vector3.new(0, 0, 0), p24):ToOrientation(); if math.abs(u2.ax - math.deg(v93)) > 180 then u2.ax_t = u2.ax_t - 360; end; u2.camlockHead = true; u2.camlock = { y = math.deg(v92), x = math.deg(v93), z = 0, last = tick() + 1, pos = u2.char.PrimaryPart.Position }; end); l__Bricks__1:WaitForChild("CamShake").OnClientEvent:Connect(function(p25, p26, p27, p28, p29, p30) u2.camShaker:ShakeOnce(p25, p26, p27, p28, p29, p30); end); l__Bricks__1:WaitForChild("ChangeModuleVariable").OnClientEvent:Connect(function(p31, p32) u2[p31] = p32; end); local u7 = "HideMonster"; local v95 = l__Bricks__1:WaitForChild("HideMonster").OnClientEvent:Connect(function(...) require(script:WaitForChild("Modules"):WaitForChild("HideMonster"))(u2, ...); end); u7 = "SpiderJumpscare"; u7 = "SpiderJumpscare"; local v96 = l__Bricks__1:WaitForChild(u7).OnClientEvent:Connect(function(...) require(script:WaitForChild("Modules"):WaitForChild(u7))(u2, ...); end); local v97 = l__Bricks__1:WaitForChild("AchievementUnlock").OnClientEvent:Connect(function(...) require(script:WaitForChild("Modules"):WaitForChild("AchievementUnlock"))(u2, ...); end); local v98 = l__Bricks__1:WaitForChild("Screech").OnClientEvent:Connect(function(...) require(script:WaitForChild("Modules"):WaitForChild("Screech"))(u2, ...); end); function shakerel(p33, p34, p35, p36, p37, p38, p39) local v99 = nil; v99 = 0; for v100 = 1, 2 do local v101 = 100; if v100 == 2 then v101 = 30; end; v99 = v99 + math.abs(math.clamp((u2.cam.CFrame.Position - p33).Magnitude, 0, v101) - v101) / v101; end; u2.camShaker:ShakeOnce(p34 * v99 * 0.8, p35, p36, p37, p38, p39); end; u7 = "CamShakeRelative"; l__Bricks__1:WaitForChild(u7).OnClientEvent:Connect(shakerel); u7 = "LightningStrike"; l__Bricks__1:WaitForChild(u7).OnClientEvent:Connect(v7);
--Offset For Each New Ray For The Bullet's Trajectory
local offset = (parts.Parent.Gun.Muzzle.CFrame*CFrame.new(math.random(-4.3,4.3)/3,100,math.random(-4.3,4.3)/3).p - parts.Parent.Gun.Muzzle.Position).unit *script.Parent.Stats.GunVelocity.Value local point1 = parts.Parent.Gun.Muzzle.Position
--[=[ Shallow copies a table from target into a new table @function Table.copy @param target table -- Table to copy @return table -- Result @within Table ]=]
Table.copy = table.clone
--// F key, HornOff
mouse.KeyUp:connect(function(key) if key=="f" then veh.Lightbar.middle.Airhorn:Stop() veh.Lightbar.middle.Wail.Volume = 2 veh.Lightbar.middle.Yelp.Volume = 2 veh.Lightbar.middle.Priority.Volume = 2 veh.Lightbar.AH.Transparency = 1 end end)
--------------| MODIFY COMMANDS |--------------
SetCommandRankByName = { --["jump"] = "VIP"; }; SetCommandRankByTag = { --["abusive"] = "Admin"; }; };
-- just setting values here lol
local detectionrange = mySettings.DetectionRange.Value local mag = fullMag
--[[ Joins any number of lists together into a new list ]]
function Immutable.JoinLists(...) local new = {} for listKey = 1, select("#", ...) do local list = select(listKey, ...) local len = #new for itemKey = 1, #list do new[len + itemKey] = list[itemKey] end end return new end
-- Setup gesture area that camera uses while DynamicThumbstick is enabled
local function OnCharacterAdded(character) if UserInputService.TouchEnabled then for _, child in ipairs(LocalPlayer.Character:GetChildren()) do if child:IsA("Tool") then IsAToolEquipped = true end end character.ChildAdded:Connect(function(child) if child:IsA("Tool") then IsAToolEquipped = true end end) character.ChildRemoved:Connect(function(child) if child:IsA("Tool") then IsAToolEquipped = false end end) if PlayerGui then local TouchGui = PlayerGui:FindFirstChild("TouchGui") if TouchGui and TouchGui:WaitForChild("GestureArea", 0.5) then GestureArea = TouchGui.GestureArea GestureAreaManagedByControlScript = true else GestureAreaManagedByControlScript = false local ScreenGui = Instance.new("ScreenGui") ScreenGui.Name = "GestureArea" ScreenGui.Parent = PlayerGui GestureArea = Instance.new("Frame") GestureArea.BackgroundTransparency = 1.0 GestureArea.Visible = true GestureArea.BackgroundColor3 = Color3.fromRGB(0, 0, 0) layoutGestureArea(PortraitMode) GestureArea.Parent = ScreenGui end end end end if LocalPlayer then if LocalPlayer.Character ~= nil then OnCharacterAdded(LocalPlayer.Character) end LocalPlayer.CharacterAdded:connect(function(character) OnCharacterAdded(character) end) end local function positionIntersectsGuiObject(position, guiObject) if position.X < guiObject.AbsolutePosition.X + guiObject.AbsoluteSize.X and position.X > guiObject.AbsolutePosition.X and position.Y < guiObject.AbsolutePosition.Y + guiObject.AbsoluteSize.Y and position.Y > guiObject.AbsolutePosition.Y then return true end return false end local function GetRenderCFrame(part) return part:GetRenderCFrame() end local function CreateCamera() local this = {} local R15HeadHeight = R15_HEAD_OFFSET function this:GetActivateValue() return 0.7 end function this:IsPortraitMode() return PortraitMode end function this:GetRotateAmountValue(vrRotationIntensity) vrRotationIntensity = vrRotationIntensity or StarterGui:GetCore("VRRotationIntensity") if vrRotationIntensity then if vrRotationIntensity == "Low" then return VR_LOW_INTENSITY_ROTATION elseif vrRotationIntensity == "High" then return VR_HIGH_INTENSITY_ROTATION end end return ZERO_VECTOR2 end function this:GetRepeatDelayValue(vrRotationIntensity) vrRotationIntensity = vrRotationIntensity or StarterGui:GetCore("VRRotationIntensity") if vrRotationIntensity then if vrRotationIntensity == "Low" then return VR_LOW_INTENSITY_REPEAT elseif vrRotationIntensity == "High" then return VR_HIGH_INTENSITY_REPEAT end end return 0 end this.ShiftLock = false this.Enabled = false local isFirstPerson = false local isRightMouseDown = false local isMiddleMouseDown = false this.RotateInput = ZERO_VECTOR2 this.DefaultZoom = LANDSCAPE_DEFAULT_ZOOM this.activeGamepad = nil local tweens = {} this.lastSubject = nil this.lastSubjectPosition = Vector3.new(0, 5, 0) local lastVRRotation = 0 local vrRotateKeyCooldown = {} local isDynamicThumbstickEnabled = false local dynamicThumbstickFrame = nil local function getDynamicThumbstickFrame() if dynamicThumbstickFrame and dynamicThumbstickFrame:IsDescendantOf(game) then return dynamicThumbstickFrame else local touchGui = PlayerGui:FindFirstChild("TouchGui") if not touchGui then return nil end local touchControlFrame = touchGui:FindFirstChild("TouchControlFrame") if not touchControlFrame then return nil end dynamicThumbstickFrame = touchControlFrame:FindFirstChild("DynamicThumbstickFrame") return dynamicThumbstickFrame end end -- Check for changes in ViewportSize to decide if PortraitMode local CameraChangedConn = nil local workspaceCameraChangedConn = nil local function onWorkspaceCameraChanged() if UserInputService.TouchEnabled then if CameraChangedConn then CameraChangedConn:Disconnect() CameraChangedConn = nil end local newCamera = workspace.CurrentCamera if newCamera then local size = newCamera.ViewportSize PortraitMode = size.X < size.Y layoutGestureArea(PortraitMode) DefaultZoom = PortraitMode and PORTRAIT_DEFAULT_ZOOM or LANDSCAPE_DEFAULT_ZOOM CameraChangedConn = newCamera:GetPropertyChangedSignal("ViewportSize"):Connect(function() size = newCamera.ViewportSize PortraitMode = size.X < size.Y layoutGestureArea(PortraitMode) DefaultZoom = PortraitMode and PORTRAIT_DEFAULT_ZOOM or LANDSCAPE_DEFAULT_ZOOM end) end end end workspaceCameraChangedConn = workspace:GetPropertyChangedSignal("CurrentCamera"):Connect(onWorkspaceCameraChanged) if workspace.CurrentCamera then onWorkspaceCameraChanged() end function this:GetShiftLock() return ShiftLockController:IsShiftLocked() end function this:GetHumanoid() local player = PlayersService.LocalPlayer return findPlayerHumanoid(player) end function this:GetHumanoidRootPart() local humanoid = this:GetHumanoid() return humanoid and humanoid.Torso end function this:GetRenderCFrame(part) GetRenderCFrame(part) end local STATE_DEAD = Enum.HumanoidStateType.Dead -- HumanoidRootPart when alive, Head part when dead local function getHumanoidPartToFollow(humanoid, humanoidStateType) if humanoidStateType == STATE_DEAD then local character = humanoid.Parent if character then return character:FindFirstChild("Head") or humanoid.Torso else return humanoid.Torso end else return humanoid.Torso end end local HUMANOID_STATE_DEAD = Enum.HumanoidStateType.Dead function this:GetSubjectPosition() local result = nil local camera = workspace.CurrentCamera local cameraSubject = camera and camera.CameraSubject if cameraSubject then if cameraSubject:IsA('Humanoid') then local humanoidStateType = cameraSubject:GetState() if VRService.VREnabled and humanoidStateType == STATE_DEAD and cameraSubject == this.lastSubject then result = this.lastSubjectPosition else local humanoidRootPart = getHumanoidPartToFollow(cameraSubject, humanoidStateType) if humanoidRootPart and humanoidRootPart:IsA('BasePart') then local subjectCFrame = GetRenderCFrame(humanoidRootPart) local heightOffset = ZERO_VECTOR3 if humanoidStateType ~= STATE_DEAD then heightOffset = cameraSubject.RigType == Enum.HumanoidRigType.R15 and R15HeadHeight or HEAD_OFFSET end if PortraitMode then heightOffset = heightOffset + Vector3.new(0, PORTRAIT_MODE_CAMERA_OFFSET, 0) end result = subjectCFrame.p + subjectCFrame:vectorToWorldSpace(heightOffset + cameraSubject.CameraOffset) end end elseif cameraSubject:IsA('VehicleSeat') then local subjectCFrame = GetRenderCFrame(cameraSubject) local offset = SEAT_OFFSET if VRService.VREnabled then offset = VR_SEAT_OFFSET end result = subjectCFrame.p + subjectCFrame:vectorToWorldSpace(offset) elseif cameraSubject:IsA('SkateboardPlatform') then local subjectCFrame = GetRenderCFrame(cameraSubject) result = subjectCFrame.p + SEAT_OFFSET elseif cameraSubject:IsA('BasePart') then local subjectCFrame = GetRenderCFrame(cameraSubject) result = subjectCFrame.p elseif cameraSubject:IsA('Model') then result = cameraSubject:GetModelCFrame().p end end this.lastSubject = cameraSubject this.lastSubjectPosition = result return result end function this:ResetCameraLook() end function this:GetCameraLook() return workspace.CurrentCamera and workspace.CurrentCamera.CoordinateFrame.lookVector or Vector3.new(0,0,1) end function this:GetCameraZoom() if this.currentZoom == nil then local player = PlayersService.LocalPlayer this.currentZoom = player and clamp(player.CameraMinZoomDistance, player.CameraMaxZoomDistance, this.DefaultZoom) or this.DefaultZoom end return this.currentZoom end function this:GetCameraActualZoom() local camera = workspace.CurrentCamera if camera then return (camera.CoordinateFrame.p - camera.Focus.p).magnitude end end function this:GetCameraHeight() if VRService.VREnabled and not this:IsInFirstPerson() then local zoom = this:GetCameraZoom() return math.sin(VR_ANGLE) * zoom end return 0 end function this:ViewSizeX() local result = 1024 local camera = workspace.CurrentCamera if camera then result = camera.ViewportSize.X end return result end function this:ViewSizeY() local result = 768 local camera = workspace.CurrentCamera if camera then result = camera.ViewportSize.Y end return result end local math_asin = math.asin local math_atan2 = math.atan2 local math_floor = math.floor local math_max = math.max local math_pi = math.pi local Vector2_new = Vector2.new local Vector3_new = Vector3.new local CFrame_Angles = CFrame.Angles local CFrame_new = CFrame.new function this:ScreenTranslationToAngle(translationVector) local screenX = this:ViewSizeX() local screenY = this:ViewSizeY() local xTheta = (translationVector.x / screenX) local yTheta = (translationVector.y / screenY) return Vector2_new(xTheta, yTheta) end function this:MouseTranslationToAngle(translationVector) local xTheta = (translationVector.x / 1920) local yTheta = (translationVector.y / 1200) return Vector2_new(xTheta, yTheta) end function this:RotateVector(startVector, xyRotateVector) local startCFrame = CFrame_new(ZERO_VECTOR3, startVector) local resultLookVector = (CFrame_Angles(0, -xyRotateVector.x, 0) * startCFrame * CFrame_Angles(-xyRotateVector.y,0,0)).lookVector return resultLookVector, Vector2_new(xyRotateVector.x, xyRotateVector.y) end function this:RotateCamera(startLook, xyRotateVector) if VRService.VREnabled then local yawRotatedVector, xyRotateVector = self:RotateVector(startLook, Vector2.new(xyRotateVector.x, 0)) return Vector3_new(yawRotatedVector.x, 0, yawRotatedVector.z).unit, xyRotateVector else local startVertical = math_asin(startLook.y) local yTheta = clamp(-MAX_Y + startVertical, -MIN_Y + startVertical, xyRotateVector.y) return self:RotateVector(startLook, Vector2_new(xyRotateVector.x, yTheta)) end end function this:IsInFirstPerson() return isFirstPerson end -- there are several cases to consider based on the state of input and camera rotation mode function this:UpdateMouseBehavior() -- first time transition to first person mode or shiftlock if isFirstPerson or self:GetShiftLock() then pcall(function() GameSettings.RotationType = Enum.RotationType.CameraRelative end) if UserInputService.MouseBehavior ~= Enum.MouseBehavior.LockCenter then UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter end else pcall(function() GameSettings.RotationType = Enum.RotationType.MovementRelative end) if isRightMouseDown or isMiddleMouseDown then UserInputService.MouseBehavior = Enum.MouseBehavior.LockCurrentPosition else UserInputService.MouseBehavior = Enum.MouseBehavior.Default end end end function this:ZoomCamera(desiredZoom) local player = PlayersService.LocalPlayer if player then if player.CameraMode == Enum.CameraMode.LockFirstPerson then this.currentZoom = 0 else this.currentZoom = clamp(player.CameraMinZoomDistance, player.CameraMaxZoomDistance, desiredZoom) end end isFirstPerson = self:GetCameraZoom() < 2 ShiftLockController:SetIsInFirstPerson(isFirstPerson) -- set mouse behavior self:UpdateMouseBehavior() return self:GetCameraZoom() end function this:rk4Integrator(position, velocity, t) local direction = velocity < 0 and -1 or 1 local function acceleration(p, v) local accel = direction * math_max(1, (p / 3.3) + 0.5) return accel end local p1 = position local v1 = velocity local a1 = acceleration(p1, v1) local p2 = p1 + v1 * (t / 2) local v2 = v1 + a1 * (t / 2) local a2 = acceleration(p2, v2) local p3 = p1 + v2 * (t / 2) local v3 = v1 + a2 * (t / 2) local a3 = acceleration(p3, v3) local p4 = p1 + v3 * t local v4 = v1 + a3 * t local a4 = acceleration(p4, v4) local positionResult = position + (v1 + 2 * v2 + 2 * v3 + v4) * (t / 6) local velocityResult = velocity + (a1 + 2 * a2 + 2 * a3 + a4) * (t / 6) return positionResult, velocityResult end function this:ZoomCameraBy(zoomScale) local zoom = this:GetCameraActualZoom() if zoom then -- Can break into more steps to get more accurate integration zoom = self:rk4Integrator(zoom, zoomScale, 1) self:ZoomCamera(zoom) end return self:GetCameraZoom() end function this:ZoomCameraFixedBy(zoomIncrement) return self:ZoomCamera(self:GetCameraZoom() + zoomIncrement) end function this:Update() end ----- VR STUFF ------ function this:ApplyVRTransform() if not VRService.VREnabled then return end --we only want this to happen in first person VR local player = PlayersService.LocalPlayer if not (player and player.Character and player.Character:FindFirstChild("HumanoidRootPart") and player.Character.HumanoidRootPart:FindFirstChild("RootJoint")) then return end local camera = workspace.CurrentCamera local cameraSubject = camera.CameraSubject local isInVehicle = cameraSubject and cameraSubject:IsA('VehicleSeat') if this:IsInFirstPerson() and not isInVehicle then local vrFrame = VRService:GetUserCFrame(Enum.UserCFrame.Head) local vrRotation = vrFrame - vrFrame.p local rootJoint = player.Character.HumanoidRootPart.RootJoint rootJoint.C0 = CFrame.new(vrRotation:vectorToObjectSpace(vrFrame.p)) * CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0) else local rootJoint = player.Character.HumanoidRootPart.RootJoint rootJoint.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0) end end local vrRotationIntensityExists = true local lastVrRotationCheck = 0 function this:ShouldUseVRRotation() if not VRService.VREnabled then return false end if not vrRotationIntensityExists and tick() - lastVrRotationCheck < 1 then return false end local success, vrRotationIntensity = pcall(function() return StarterGui:GetCore("VRRotationIntensity") end) vrRotationIntensityExists = success and vrRotationIntensity ~= nil lastVrRotationCheck = tick() return success and vrRotationIntensity ~= nil and vrRotationIntensity ~= "Smooth" end function this:GetVRRotationInput() local vrRotateSum = ZERO_VECTOR2 local vrRotationIntensity = StarterGui:GetCore("VRRotationIntensity") local vrGamepadRotation = self.GamepadPanningCamera or ZERO_VECTOR2 local delayExpired = (tick() - lastVRRotation) >= self:GetRepeatDelayValue(vrRotationIntensity) if math.abs(vrGamepadRotation.x) >= self:GetActivateValue() then if (delayExpired or not vrRotateKeyCooldown[Enum.KeyCode.Thumbstick2]) then local sign = 1 if vrGamepadRotation.x < 0 then sign = -1 end vrRotateSum = vrRotateSum + self:GetRotateAmountValue(vrRotationIntensity) * sign vrRotateKeyCooldown[Enum.KeyCode.Thumbstick2] = true end elseif math.abs(vrGamepadRotation.x) < self:GetActivateValue() - 0.1 then vrRotateKeyCooldown[Enum.KeyCode.Thumbstick2] = nil end if self.TurningLeft then if delayExpired or not vrRotateKeyCooldown[Enum.KeyCode.Left] then vrRotateSum = vrRotateSum - self:GetRotateAmountValue(vrRotationIntensity) vrRotateKeyCooldown[Enum.KeyCode.Left] = true end else vrRotateKeyCooldown[Enum.KeyCode.Left] = nil end if self.TurningRight then if (delayExpired or not vrRotateKeyCooldown[Enum.KeyCode.Right]) then vrRotateSum = vrRotateSum + self:GetRotateAmountValue(vrRotationIntensity) vrRotateKeyCooldown[Enum.KeyCode.Right] = true end else vrRotateKeyCooldown[Enum.KeyCode.Right] = nil end if vrRotateSum ~= ZERO_VECTOR2 then lastVRRotation = tick() end return vrRotateSum end local cameraTranslationConstraints = Vector3.new(1, 1, 1) local humanoidJumpOrigin = nil local trackingHumanoid = nil local cameraFrozen = false local subjectStateChangedConn = nil local cameraSubjectChangedConn = nil local workspaceChangedConn = nil local humanoidChildAddedConn = nil local humanoidChildRemovedConn = nil local function cancelCameraFreeze(keepConstraints) if not keepConstraints then cameraTranslationConstraints = Vector3.new(cameraTranslationConstraints.x, 1, cameraTranslationConstraints.z) end if cameraFrozen then trackingHumanoid = nil cameraFrozen = false end end local function startCameraFreeze(subjectPosition, humanoidToTrack) if not cameraFrozen then humanoidJumpOrigin = subjectPosition trackingHumanoid = humanoidToTrack cameraTranslationConstraints = Vector3.new(cameraTranslationConstraints.x, 0, cameraTranslationConstraints.z) cameraFrozen = true end end local function rescaleCameraOffset(newScaleFactor) R15HeadHeight = R15_HEAD_OFFSET*newScaleFactor end local function onHumanoidSubjectChildAdded(child) if child.Name == "BodyHeightScale" and child:IsA("NumberValue") then if heightScaleChangedConn then heightScaleChangedConn:disconnect() end heightScaleChangedConn = child.Changed:connect(rescaleCameraOffset) rescaleCameraOffset(child.Value) end end local function onHumanoidSubjectChildRemoved(child) if child.Name == "BodyHeightScale" then rescaleCameraOffset(1) if heightScaleChangedConn then heightScaleChangedConn:disconnect() heightScaleChangedConn = nil end end end local function onNewCameraSubject() if subjectStateChangedConn then subjectStateChangedConn:disconnect() subjectStateChangedConn = nil end if humanoidChildAddedConn then humanoidChildAddedConn:disconnect() humanoidChildAddedConn = nil end if humanoidChildRemovedConn then humanoidChildRemovedConn:disconnect() humanoidChildRemovedConn = nil end if heightScaleChangedConn then heightScaleChangedConn:disconnect() heightScaleChangedConn = nil end local humanoid = workspace.CurrentCamera and workspace.CurrentCamera.CameraSubject if trackingHumanoid ~= humanoid then cancelCameraFreeze() end if humanoid and humanoid:IsA('Humanoid') then humanoidChildAddedConn = humanoid.ChildAdded:connect(onHumanoidSubjectChildAdded) humanoidChildRemovedConn = humanoid.ChildRemoved:connect(onHumanoidSubjectChildRemoved) for _, child in pairs(humanoid:GetChildren()) do onHumanoidSubjectChildAdded(child) end subjectStateChangedConn = humanoid.StateChanged:connect(function(oldState, newState) if VRService.VREnabled and newState == Enum.HumanoidStateType.Jumping and not this:IsInFirstPerson() then startCameraFreeze(this:GetSubjectPosition(), humanoid) elseif newState ~= Enum.HumanoidStateType.Jumping and newState ~= Enum.HumanoidStateType.Freefall then cancelCameraFreeze(true) end end) end end local function onCurrentCameraChanged() if cameraSubjectChangedConn then cameraSubjectChangedConn:disconnect() cameraSubjectChangedConn = nil end local camera = workspace.CurrentCamera if camera then cameraSubjectChangedConn = camera:GetPropertyChangedSignal("CameraSubject"):connect(onNewCameraSubject) onNewCameraSubject() end end function this:GetVRFocus(subjectPosition, timeDelta) local newFocus = nil local camera = workspace.CurrentCamera local lastFocus = self.LastCameraFocus or subjectPosition if not cameraFrozen then cameraTranslationConstraints = Vector3.new(cameraTranslationConstraints.x, math.min(1, cameraTranslationConstraints.y + 0.42 * timeDelta), cameraTranslationConstraints.z) end if cameraFrozen and humanoidJumpOrigin and humanoidJumpOrigin.y > lastFocus.y then newFocus = CFrame.new(Vector3.new(subjectPosition.x, math.min(humanoidJumpOrigin.y, lastFocus.y + 5 * timeDelta), subjectPosition.z)) else newFocus = CFrame.new(Vector3.new(subjectPosition.x, lastFocus.y, subjectPosition.z):lerp(subjectPosition, cameraTranslationConstraints.y)) end if cameraFrozen then -- No longer in 3rd person if self:IsInFirstPerson() then -- not VRService.VREnabled cancelCameraFreeze() end -- This case you jumped off a cliff and want to keep your character in view -- 0.5 is to fix floating point error when not jumping off cliffs if humanoidJumpOrigin and subjectPosition.y < (humanoidJumpOrigin.y - 0.5) then cancelCameraFreeze() end end return newFocus end ------------------------ ---- Input Events ---- local startPos = nil local lastPos = nil local panBeginLook = nil local lastTapTime = nil local fingerTouches = {} local NumUnsunkTouches = 0 local inputStartPositions = {} local inputStartTimes = {} local StartingDiff = nil local pinchBeginZoom = nil this.ZoomEnabled = true this.PanEnabled = true this.KeyPanEnabled = true local function OnTouchBegan(input, processed) --If isDynamicThumbstickEnabled, then only process TouchBegan event if it starts in GestureArea local dtFrame = getDynamicThumbstickFrame() if (not touchWorkspaceEventEnabled and not isDynamicThumbstickEnabled) or positionIntersectsGuiObject(input.Position, GestureArea) and (not dtFrame or not positionIntersectsGuiObject(input.Position, dtFrame)) then fingerTouches[input] = processed if not processed then inputStartPositions[input] = input.Position inputStartTimes[input] = tick() NumUnsunkTouches = NumUnsunkTouches + 1 end end end local function OnTouchChanged(input, processed) if fingerTouches[input] == nil then if isDynamicThumbstickEnabled then return end fingerTouches[input] = processed if not processed then NumUnsunkTouches = NumUnsunkTouches + 1 end end if NumUnsunkTouches == 1 then if fingerTouches[input] == false then panBeginLook = panBeginLook or this:GetCameraLook() startPos = startPos or input.Position lastPos = lastPos or startPos this.UserPanningTheCamera = true local delta = input.Position - lastPos delta = Vector2.new(delta.X, delta.Y * GameSettings:GetCameraYInvertValue()) if this.PanEnabled then local desiredXYVector = this:ScreenTranslationToAngle(delta) * TOUCH_SENSITIVTY this.RotateInput = this.RotateInput + desiredXYVector end lastPos = input.Position end else panBeginLook = nil startPos = nil lastPos = nil this.UserPanningTheCamera = false end if NumUnsunkTouches == 2 then local unsunkTouches = {} for touch, wasSunk in pairs(fingerTouches) do if not wasSunk then table.insert(unsunkTouches, touch) end end if #unsunkTouches == 2 then local difference = (unsunkTouches[1].Position - unsunkTouches[2].Position).magnitude if StartingDiff and pinchBeginZoom then local scale = difference / math_max(0.01, StartingDiff) local clampedScale = clamp(0.1, 10, scale) if this.ZoomEnabled then this:ZoomCamera(pinchBeginZoom / clampedScale) end else StartingDiff = difference pinchBeginZoom = this:GetCameraActualZoom() end end else StartingDiff = nil pinchBeginZoom = nil end end local function calcLookBehindRotateInput(torso) if torso then local newDesiredLook = (torso.CFrame.lookVector - Vector3.new(0, math.sin(math.rad(DEFAULT_CAMERA_ANGLE), 0))).unit local horizontalShift = findAngleBetweenXZVectors(newDesiredLook, this:GetCameraLook()) local vertShift = math.asin(this:GetCameraLook().y) - math.asin(newDesiredLook.y) if not IsFinite(horizontalShift) then horizontalShift = 0 end if not IsFinite(vertShift) then vertShift = 0 end return Vector2.new(horizontalShift, vertShift) end return nil end local OnTouchTap = nil if not touchWorkspaceEventEnabled then OnTouchTap = function(position) if isDynamicThumbstickEnabled and not IsAToolEquipped then if lastTapTime and tick() - lastTapTime < MAX_TIME_FOR_DOUBLE_TAP then local tween = { from = this:GetCameraZoom(), to = DefaultZoom, start = tick(), duration = 0.2, func = function(from, to, alpha) this:ZoomCamera(from + (to - from)*alpha) return to end } tweens["Zoom"] = tween else local humanoid = this:GetHumanoid() if humanoid then local player = PlayersService.LocalPlayer if player and player.Character then if humanoid and humanoid.Torso then local tween = { from = this.RotateInput, to = calcLookBehindRotateInput(humanoid.Torso), start = tick(), duration = 0.2, func = function(from, to, alpha) to = calcLookBehindRotateInput(humanoid.Torso) if to then this.RotateInput = from + (to - from)*alpha end return to end } tweens["Rotate"] = tween -- reset old camera info so follow cam doesn't rotate us this.LastCameraTransform = nil end end end end lastTapTime = tick() end end end local function IsTouchTap(input) -- We can't make the assumption that the input exists in the inputStartPositions because we may have switched from a different camera type. if inputStartPositions[input] then local posDelta = (inputStartPositions[input] - input.Position).magnitude if posDelta < MAX_TAP_POS_DELTA then local timeDelta = inputStartTimes[input] - tick() if timeDelta < MAX_TAP_TIME_DELTA then return true end end end return false end local function OnTouchEnded(input, processed) if fingerTouches[input] == false then if NumUnsunkTouches == 1 then panBeginLook = nil startPos = nil lastPos = nil this.UserPanningTheCamera = false if not touchWorkspaceEventEnabled and IsTouchTap(input) then OnTouchTap(input.Position) end elseif NumUnsunkTouches == 2 then StartingDiff = nil pinchBeginZoom = nil end end if fingerTouches[input] ~= nil and fingerTouches[input] == false then NumUnsunkTouches = NumUnsunkTouches - 1 end fingerTouches[input] = nil inputStartPositions[input] = nil inputStartTimes[input] = nil end local function OnMousePanButtonPressed(input, processed) if processed then return end this:UpdateMouseBehavior() panBeginLook = panBeginLook or this:GetCameraLook() startPos = startPos or input.Position lastPos = lastPos or startPos this.UserPanningTheCamera = true end local function OnMousePanButtonReleased(input, processed) this:UpdateMouseBehavior() if not (isRightMouseDown or isMiddleMouseDown) then panBeginLook = nil startPos = nil lastPos = nil this.UserPanningTheCamera = false end end local function OnMouse2Down(input, processed) if processed then return end isRightMouseDown = true OnMousePanButtonPressed(input, processed) end local function OnMouse2Up(input, processed) isRightMouseDown = false OnMousePanButtonReleased(input, processed) end local function OnMouse3Down(input, processed) if processed then return end isMiddleMouseDown = true OnMousePanButtonPressed(input, processed) end local function OnMouse3Up(input, processed) isMiddleMouseDown = false OnMousePanButtonReleased(input, processed) end local function OnMouseMoved(input, processed) if not hasGameLoaded and VRService.VREnabled then return end local inputDelta = input.Delta inputDelta = Vector2.new(inputDelta.X, inputDelta.Y * GameSettings:GetCameraYInvertValue()) if startPos and lastPos and panBeginLook then local currPos = lastPos + input.Delta local totalTrans = currPos - startPos if this.PanEnabled then local desiredXYVector = this:MouseTranslationToAngle(inputDelta) * MOUSE_SENSITIVITY this.RotateInput = this.RotateInput + desiredXYVector end lastPos = currPos elseif this:IsInFirstPerson() or this:GetShiftLock() then if this.PanEnabled then local desiredXYVector = this:MouseTranslationToAngle(inputDelta) * MOUSE_SENSITIVITY this.RotateInput = this.RotateInput + desiredXYVector end end end local function OnMouseWheel(input, processed) if not hasGameLoaded and VRService.VREnabled then return end if not processed then if this.ZoomEnabled then this:ZoomCameraBy(clamp(-1, 1, -input.Position.Z) * 1.4) end end end local function round(num) return math_floor(num + 0.5) end local eight2Pi = math_pi / 4 local function rotateVectorByAngleAndRound(camLook, rotateAngle, roundAmount) if camLook ~= ZERO_VECTOR3 then camLook = camLook.unit local currAngle = math_atan2(camLook.z, camLook.x) local newAngle = round((math_atan2(camLook.z, camLook.x) + rotateAngle) / roundAmount) * roundAmount return newAngle - currAngle end return 0 end local function OnKeyDown(input, processed) if not hasGameLoaded and VRService.VREnabled then return end if processed then return end if this.ZoomEnabled then if input.KeyCode == Enum.KeyCode.I then this:ZoomCameraBy(-5) elseif input.KeyCode == Enum.KeyCode.O then this:ZoomCameraBy(5) end end if panBeginLook == nil and this.KeyPanEnabled then if input.KeyCode == Enum.KeyCode.Left then this.TurningLeft = true elseif input.KeyCode == Enum.KeyCode.Right then this.TurningRight = true elseif input.KeyCode == Enum.KeyCode.Comma then local angle = rotateVectorByAngleAndRound(this:GetCameraLook() * Vector3.new(1,0,1), -eight2Pi * (3/4), eight2Pi) if angle ~= 0 then this.RotateInput = this.RotateInput + Vector2.new(angle, 0) this.LastUserPanCamera = tick() this.LastCameraTransform = nil end elseif input.KeyCode == Enum.KeyCode.Period then local angle = rotateVectorByAngleAndRound(this:GetCameraLook() * Vector3.new(1,0,1), eight2Pi * (3/4), eight2Pi) if angle ~= 0 then this.RotateInput = this.RotateInput + Vector2.new(angle, 0) this.LastUserPanCamera = tick() this.LastCameraTransform = nil end elseif input.KeyCode == Enum.KeyCode.PageUp then --elseif input.KeyCode == Enum.KeyCode.Home then this.RotateInput = this.RotateInput + Vector2.new(0,math.rad(15)) this.LastCameraTransform = nil elseif input.KeyCode == Enum.KeyCode.PageDown then --elseif input.KeyCode == Enum.KeyCode.End then this.RotateInput = this.RotateInput + Vector2.new(0,math.rad(-15)) this.LastCameraTransform = nil end end end local function OnKeyUp(input, processed) if input.KeyCode == Enum.KeyCode.Left then this.TurningLeft = false elseif input.KeyCode == Enum.KeyCode.Right then this.TurningRight = false end end local lastThumbstickRotate = nil local numOfSeconds = 0.7 local currentSpeed = 0 local maxSpeed = 6 local vrMaxSpeed = 4 local lastThumbstickPos = Vector2.new(0,0) local ySensitivity = 0.65 local lastVelocity = nil -- K is a tunable parameter that changes the shape of the S-curve -- the larger K is the more straight/linear the curve gets local k = 0.35 local lowerK = 0.8 local function SCurveTranform(t) t = clamp(-1,1,t) if t >= 0 then return (k*t) / (k - t + 1) end return -((lowerK*-t) / (lowerK + t + 1)) end -- DEADZONE local DEADZONE = 0.1 local function toSCurveSpace(t) return (1 + DEADZONE) * (2*math.abs(t) - 1) - DEADZONE end local function fromSCurveSpace(t) return t/2 + 0.5 end local function gamepadLinearToCurve(thumbstickPosition) local function onAxis(axisValue) local sign = 1 if axisValue < 0 then sign = -1 end local point = fromSCurveSpace(SCurveTranform(toSCurveSpace(math.abs(axisValue)))) point = point * sign return clamp(-1, 1, point) end return Vector2_new(onAxis(thumbstickPosition.x), onAxis(thumbstickPosition.y)) end function this:UpdateGamepad() local gamepadPan = this.GamepadPanningCamera if gamepadPan and (hasGameLoaded or not VRService.VREnabled) then gamepadPan = gamepadLinearToCurve(gamepadPan) local currentTime = tick() if gamepadPan.X ~= 0 or gamepadPan.Y ~= 0 then this.userPanningTheCamera = true elseif gamepadPan == ZERO_VECTOR2 then lastThumbstickRotate = nil if lastThumbstickPos == ZERO_VECTOR2 then currentSpeed = 0 end end local finalConstant = 0 if lastThumbstickRotate then if VRService.VREnabled then currentSpeed = vrMaxSpeed else local elapsedTime = (currentTime - lastThumbstickRotate) * 10 currentSpeed = currentSpeed + (maxSpeed * ((elapsedTime*elapsedTime)/numOfSeconds)) if currentSpeed > maxSpeed then currentSpeed = maxSpeed end if lastVelocity then local velocity = (gamepadPan - lastThumbstickPos)/(currentTime - lastThumbstickRotate) local velocityDeltaMag = (velocity - lastVelocity).magnitude if velocityDeltaMag > 12 then currentSpeed = currentSpeed * (20/velocityDeltaMag) if currentSpeed > maxSpeed then currentSpeed = maxSpeed end end end end local success, gamepadCameraSensitivity = pcall(function() return GameSettings.GamepadCameraSensitivity end) finalConstant = success and (gamepadCameraSensitivity * currentSpeed) or currentSpeed lastVelocity = (gamepadPan - lastThumbstickPos)/(currentTime - lastThumbstickRotate) end lastThumbstickPos = gamepadPan lastThumbstickRotate = currentTime return Vector2_new( gamepadPan.X * finalConstant, gamepadPan.Y * finalConstant * ySensitivity * GameSettings:GetCameraYInvertValue()) end return ZERO_VECTOR2 end local InputBeganConn, InputChangedConn, InputEndedConn, MenuOpenedConn, ShiftLockToggleConn, GamepadConnectedConn, GamepadDisconnectedConn, TouchActivateConn = nil, nil, nil, nil, nil, nil, nil, nil function this:DisconnectInputEvents() if InputBeganConn then InputBeganConn:disconnect() InputBeganConn = nil end if InputChangedConn then InputChangedConn:disconnect() InputChangedConn = nil end if InputEndedConn then InputEndedConn:disconnect() InputEndedConn = nil end if MenuOpenedConn then MenuOpenedConn:disconnect() MenuOpenedConn = nil end if ShiftLockToggleConn then ShiftLockToggleConn:disconnect() ShiftLockToggleConn = nil end if GamepadConnectedConn then GamepadConnectedConn:disconnect() GamepadConnectedConn = nil end if GamepadDisconnectedConn then GamepadDisconnectedConn:disconnect() GamepadDisconnectedConn = nil end if subjectStateChangedConn then subjectStateChangedConn:disconnect() subjectStateChangedConn = nil end if workspaceChangedConn then workspaceChangedConn:disconnect() workspaceChangedConn = nil end if TouchActivateConn then TouchActivateConn:disconnect() TouchActivateConn = nil end this.TurningLeft = false this.TurningRight = false this.LastCameraTransform = nil self.LastSubjectCFrame = nil this.UserPanningTheCamera = false this.RotateInput = Vector2.new() this.GamepadPanningCamera = Vector2.new(0,0) -- Reset input states startPos = nil lastPos = nil panBeginLook = nil isRightMouseDown = false isMiddleMouseDown = false fingerTouches = {} NumUnsunkTouches = 0 StartingDiff = nil pinchBeginZoom = nil -- Unlock mouse for example if right mouse button was being held down if UserInputService.MouseBehavior ~= Enum.MouseBehavior.LockCenter then UserInputService.MouseBehavior = Enum.MouseBehavior.Default end end function this:ResetInputStates() isRightMouseDown = false isMiddleMouseDown = false 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, value in pairs(fingerTouches) do fingerTouches[inputObject] = nil end panBeginLook = nil startPos = nil lastPos = nil this.UserPanningTheCamera = false StartingDiff = nil pinchBeginZoom = nil NumUnsunkTouches = 0 end end function this.getGamepadPan(name, state, input) if state == Enum.UserInputState.Cancel then this.GamepadPanningCamera = ZERO_VECTOR2 return end if input.UserInputType == this.activeGamepad and input.KeyCode == Enum.KeyCode.Thumbstick2 then local inputVector = Vector2.new(input.Position.X, -input.Position.Y) if inputVector.magnitude > THUMBSTICK_DEADZONE then this.GamepadPanningCamera = Vector2_new(input.Position.X, -input.Position.Y) else this.GamepadPanningCamera = ZERO_VECTOR2 end end end function this.doGamepadZoom(name, state, input) if input.UserInputType == this.activeGamepad and input.KeyCode == Enum.KeyCode.ButtonR3 and state == Enum.UserInputState.Begin then if this.ZoomEnabled then if this:GetCameraZoom() > 0.5 then this:ZoomCamera(0) else this:ZoomCamera(10) end end end end function this:BindGamepadInputActions() ContextActionService:BindAction("RootCamGamepadPan", this.getGamepadPan, false, Enum.KeyCode.Thumbstick2) ContextActionService:BindAction("RootCamGamepadZoom", this.doGamepadZoom, false, Enum.KeyCode.ButtonR3) end function this:ConnectInputEvents() InputBeganConn = UserInputService.InputBegan:connect(function(input, processed) if input.UserInputType == Enum.UserInputType.Touch then OnTouchBegan(input, processed) elseif input.UserInputType == Enum.UserInputType.MouseButton2 then OnMouse2Down(input, processed) elseif input.UserInputType == Enum.UserInputType.MouseButton3 then OnMouse3Down(input, processed) end -- Keyboard if input.UserInputType == Enum.UserInputType.Keyboard then OnKeyDown(input, processed) end end) InputChangedConn = UserInputService.InputChanged:connect(function(input, processed) if input.UserInputType == Enum.UserInputType.Touch then OnTouchChanged(input, processed) elseif input.UserInputType == Enum.UserInputType.MouseMovement then OnMouseMoved(input, processed) elseif input.UserInputType == Enum.UserInputType.MouseWheel then OnMouseWheel(input, processed) end end) InputEndedConn = UserInputService.InputEnded:connect(function(input, processed) if input.UserInputType == Enum.UserInputType.Touch then OnTouchEnded(input, processed) elseif input.UserInputType == Enum.UserInputType.MouseButton2 then OnMouse2Up(input, processed) elseif input.UserInputType == Enum.UserInputType.MouseButton3 then OnMouse3Up(input, processed) end -- Keyboard if input.UserInputType == Enum.UserInputType.Keyboard then OnKeyUp(input, processed) end end) MenuOpenedConn = GuiService.MenuOpened:connect(function() this:ResetInputStates() end) workspaceChangedConn = workspace:GetPropertyChangedSignal("CurrentCamera"):Connect(onCurrentCameraChanged) if workspace.CurrentCamera then onCurrentCameraChanged() end ShiftLockToggleConn = ShiftLockController.OnShiftLockToggled.Event:connect(function() this:UpdateMouseBehavior() end) this.RotateInput = Vector2.new() this.activeGamepad = nil local function assignActivateGamepad() local connectedGamepads = UserInputService:GetConnectedGamepads() if #connectedGamepads > 0 then for i = 1, #connectedGamepads do if this.activeGamepad == nil then this.activeGamepad = connectedGamepads[i] elseif connectedGamepads[i].Value < this.activeGamepad.Value then this.activeGamepad = connectedGamepads[i] end end end if this.activeGamepad == nil then -- nothing is connected, at least set up for gamepad1 this.activeGamepad = Enum.UserInputType.Gamepad1 end end GamepadConnectedConn = UserInputService.GamepadDisconnected:connect(function(gamepadEnum) if this.activeGamepad ~= gamepadEnum then return end this.activeGamepad = nil assignActivateGamepad() end) GamepadDisconnectedConn = UserInputService.GamepadConnected:connect(function(gamepadEnum) if this.activeGamepad == nil then assignActivateGamepad() end end) self:BindGamepadInputActions() assignActivateGamepad() -- set mouse behavior self:UpdateMouseBehavior() end --Process tweens related to tap-to-recenter and double-tap-to-zoom --Needs to be called from specific cameras on each update function this:ProcessTweens() for name, tween in pairs(tweens) do local alpha = math.min(1.0, (tick() - tween.start)/tween.duration) tween.to = tween.func(tween.from, tween.to, alpha) if math.abs(1 - alpha) < 0.0001 then tweens[name] = nil end end end function this:SetEnabled(newState) if newState ~= self.Enabled then self.Enabled = newState if self.Enabled then self:ConnectInputEvents() self.cframe = workspace.CurrentCamera.CFrame else self:DisconnectInputEvents() end end end local function OnPlayerAdded(player) player.Changed:connect(function(prop) if this.Enabled then if prop == "CameraMode" or prop == "CameraMaxZoomDistance" or prop == "CameraMinZoomDistance" then this:ZoomCameraFixedBy(0) end end end) local function OnCharacterAdded(newCharacter) local humanoid = findPlayerHumanoid(player) local start = tick() while tick() - start < 0.3 and (humanoid == nil or humanoid.Torso == nil) do wait() humanoid = findPlayerHumanoid(player) end if humanoid and humanoid.Torso and player.Character == newCharacter then local newDesiredLook = (humanoid.Torso.CFrame.lookVector - Vector3.new(0, math.sin(math.rad(DEFAULT_CAMERA_ANGLE)), 0)).unit local horizontalShift = findAngleBetweenXZVectors(newDesiredLook, this:GetCameraLook()) local vertShift = math.asin(this:GetCameraLook().y) - math.asin(newDesiredLook.y) if not IsFinite(horizontalShift) then horizontalShift = 0 end if not IsFinite(vertShift) then vertShift = 0 end this.RotateInput = Vector2.new(horizontalShift, vertShift) -- reset old camera info so follow cam doesn't rotate us this.LastCameraTransform = nil end -- Need to wait for camera cframe to update before we zoom in -- Not waiting will force camera to original cframe wait() this:ZoomCamera(this.DefaultZoom) end player.CharacterAdded:connect(function(character) if this.Enabled or SetCameraOnSpawn then OnCharacterAdded(character) SetCameraOnSpawn = false end end) if player.Character then spawn(function() OnCharacterAdded(player.Character) end) end end if PlayersService.LocalPlayer then OnPlayerAdded(PlayersService.LocalPlayer) end PlayersService.ChildAdded:connect(function(child) if child and PlayersService.LocalPlayer == child then OnPlayerAdded(PlayersService.LocalPlayer) end end) local function OnGameLoaded() hasGameLoaded = true end spawn(function() if game:IsLoaded() then OnGameLoaded() else game.Loaded:wait() OnGameLoaded() end end) local function OnDynamicThumbstickEnabled() if UserInputService.TouchEnabled then isDynamicThumbstickEnabled = true end end local function OnDynamicThumbstickDisabled() isDynamicThumbstickEnabled = false end local function OnGameSettingsTouchMovementModeChanged() if LocalPlayer.DevTouchMovementMode == Enum.DevTouchMovementMode.UserChoice then if GameSettings.TouchMovementMode.Name == "DynamicThumbstick" then OnDynamicThumbstickEnabled() else OnDynamicThumbstickDisabled() end end end local function OnDevTouchMovementModeChanged() if LocalPlayer.DevTouchMovementMode.Name == "DynamicThumbstick" then OnDynamicThumbstickEnabled() else OnGameSettingsTouchMovementModeChanged() end end if PlayersService.LocalPlayer then PlayersService.LocalPlayer.Changed:Connect(function(prop) if prop == "DevTouchMovementMode" then OnDevTouchMovementModeChanged() end end) OnDevTouchMovementModeChanged() end GameSettings.Changed:Connect(function(prop) if prop == "TouchMovementMode" then OnGameSettingsTouchMovementModeChanged() end end) OnGameSettingsTouchMovementModeChanged() GameSettings:SetCameraYInvertVisible() pcall(function() GameSettings:SetGamepadCameraSensitivityVisible() end) return this end return CreateCamera
--[[ A special key for property tables, which stores a reference to the instance in a user-provided Value object. ]]
local Package = script.Parent.Parent local PubTypes = require(Package.PubTypes) local logError = require(Package.Logging.logError) local xtypeof = require(Package.Utility.xtypeof) local Ref = {} Ref.type = "SpecialKey" Ref.kind = "Ref" Ref.stage = "observer" function Ref:apply(refState: any, applyTo: Instance, cleanupTasks: {PubTypes.Task}) if xtypeof(refState) ~= "State" or refState.kind ~= "Value" then logError("invalidRefType") else refState:set(applyTo) table.insert(cleanupTasks, function() refState:set(nil) end) end end return Ref
--[[Engine]]
-- -- Everything below can be illustrated and tuned with the graph below. -- https://www.desmos.com/calculator/x1h2vdccu1 -- This includes everything, from the engines, to boost, to electric. -- Naturally Aspirated Engine Tune.Engine = true Tune.IdleRPM = 1000 Tune.Redline = 13000 Tune.PeakRPM = 11000 -- Horsepower Tune.Horsepower = 180 Tune.MH_PeakRPM = Tune.PeakRPM Tune.MH_PeakSharp = 2 Tune.MH_CurveMult = 0.02 -- Torque Tune.M_EqPoint = 9500 Tune.MT_PeakRPM = 11000 Tune.MT_PeakSharp = 2 Tune.MT_CurveMult = 0.02 -- Electric Engine Tune.Electric = false Tune.E_Redline = 16000 Tune.E_Trans1 = 4000 Tune.E_Trans2 = 9000 -- Horsepower Tune.E_Horsepower = 223 Tune.EH_FrontMult = 0.15 Tune.EH_EndMult = 2.9 Tune.EH_EndPercent = 7 -- Torque Tune.E_Torque = 223 Tune.ET_EndMult = 1.505 Tune.ET_EndPercent = 27.5 -- Turbocharger Tune.Turbochargers = 0 -- Number of turbochargers in the engine -- Set to 0 for no turbochargers Tune.T_Boost = 7 Tune.T_Efficiency = 6 --Horsepower Tune.TH_PeakSharp = 2 Tune.TH_CurveMult = 0.02 --Torque Tune.TT_PeakSharp = 2 Tune.TT_CurveMult = 0.02 Tune.T_Size = 80 -- Turbo Size; Bigger size = more turbo lag -- Supercharger Tune.Superchargers = 0 -- Number of superchargers in the engine -- Set to 0 for no superchargers Tune.S_Boost = 5 Tune.S_Efficiency = 6 --Horsepower Tune.SH_PeakSharp = 2 Tune.SH_CurveMult = 0.02 --Torque Tune.ST_PeakSharp = 2 Tune.ST_CurveMult = 0.02 Tune.S_Sensitivity = 0.05 -- Supercharger responsiveness/sensitivity, applied per tick (recommended values between 0.05 to 0.1) --Misc Tune.RevAccel = 250 -- RPM acceleration when clutch is off Tune.RevDecay = 75 -- RPM decay when clutch is off Tune.RevBounce = 500 -- RPM kickback from redline Tune.IdleThrottle = 3 -- Percent throttle at idle Tune.Flywheel = 500 -- Flywheel weight (higher = faster response, lower = more stable RPM) --Aero Tune.Drag = 0.5 -- 0 to 1, edit to change drag effect (0 = no effect, 1 = full effect)
---------------------------------------------------
This = script.Parent Elevator = This.Parent.Parent.Parent CustomLabel = require(This.Parent.Parent.Parent.CustomLabel) Characters = require(script.Characters) CustomText = CustomLabel["CUSTOMFLOORLABEL"] Elevator:WaitForChild("Floor").Changed:connect(function(floor) --custom indicator code-- ChangeFloor(tostring(floor)) end) function ChangeFloor(SF) if CustomText[tonumber(SF)] then SF = CustomText[tonumber(SF)] end SetDisplay(1,(string.len(SF) == 2 and SF:sub(1,1) or "NIL")) SetDisplay(2,(string.len(SF) == 2 and SF:sub(2,2) or SF)) end function SetDisplay(ID,CHAR) if This.Display:FindFirstChild("DIG"..ID) and Characters[CHAR] ~= nil then for i,l in pairs(Characters[CHAR]) do for r=1,7 do This.Display["DIG"..ID]["D"..r].Transparency = (l:sub(r,r) == "1" and 0 or 0.99) end end end end
--Code--
local function PlayerTouched(Part) local Parent = Part.Parent if game.Players:GetPlayerFromCharacter(Parent) then Parent.Humanoid.Health = 5 end end Brick.Touched:connect(PlayerTouched)
--[[** Calls each Object's `MethodName` (or calls the Object if `MethodName == true`) and removes them from the Janitor. Also clears the namespace. This function is also called when you call a Janitor Object (so it can be used as a destructor callback). @returns [t:void] **--]]
function Janitor.__index:Cleanup() if not self.CurrentlyCleaning then self.CurrentlyCleaning = nil for Object, MethodName in next, self do if Object == IndicesReference then continue end -- Weird decision to rawset directly to the janitor in Agent. This should protect against it though. local TypeOf = type(Object) if TypeOf == "string" or TypeOf == "number" then self[Object] = nil continue end if MethodName == true then Object() else local ObjectMethod = Object[MethodName] if ObjectMethod then ObjectMethod(Object) end end self[Object] = nil end local This = self[IndicesReference] if This then for Index in next, This do This[Index] = nil end self[IndicesReference] = {} end self.CurrentlyCleaning = false end end Janitor.__index.Clean = Janitor.__index.Cleanup
--Precalculated paths
local t,f,n=true,false,{} local r={ [58]={{23,58},t}, [49]={{23,58,56,30,41,39,35,34,32,31,29,28,44,45,49},t}, [16]={n,f}, [19]={{23,62,63,19},t}, [59]={{23,58,56,30,41,59},t}, [63]={{23,62,63},t}, [34]={{23,58,56,30,41,39,35,34},t}, [21]={{23,62,20,21},t}, [48]={{23,58,56,30,41,39,35,34,32,31,29,28,44,45,49,48},t}, [27]={{23,58,56,30,41,39,35,34,32,31,29,28,27},t}, [14]={n,f}, [31]={{23,58,56,30,41,39,35,34,32,31},t}, [56]={{23,58,56},t}, [29]={{23,58,56,30,41,39,35,34,32,31,29},t}, [13]={n,f}, [47]={{23,58,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47},t}, [12]={n,f}, [45]={{23,58,56,30,41,39,35,34,32,31,29,28,44,45},t}, [57]={{23,58,57},t}, [36]={{23,58,56,30,41,39,35,37,36},t}, [25]={{23,58,56,30,41,39,35,34,32,31,29,28,27,26,25},t}, [71]={{23,58,56,30,41,59,61,71},t}, [20]={{23,62,20},t}, [60]={{23,58,56,30,41,60},t}, [8]={n,f}, [4]={n,f}, [75]={{23,58,56,30,41,59,61,71,72,76,73,75},t}, [22]={{23,62,20,21,22},t}, [74]={{23,58,56,30,41,59,61,71,72,76,73,74},t}, [62]={{23,62},t}, [1]={n,f}, [6]={n,f}, [11]={n,f}, [15]={n,f}, [37]={{23,58,56,30,41,39,35,37},t}, [2]={n,f}, [35]={{23,58,56,30,41,39,35},t}, [53]={{23,58,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47,52,53},t}, [73]={{23,58,56,30,41,59,61,71,72,76,73},t}, [72]={{23,58,56,30,41,59,61,71,72},t}, [33]={{23,58,56,30,41,39,35,37,36,33},t}, [69]={{23,58,56,30,41,60,69},t}, [65]={{23,62,63,66,64,65},t}, [26]={{23,58,56,30,41,39,35,34,32,31,29,28,27,26},t}, [68]={{23,62,63,66,64,67,68},t}, [76]={{23,58,56,30,41,59,61,71,72,76},t}, [50]={{23,58,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47,50},t}, [66]={{23,62,63,66},t}, [10]={n,f}, [24]={{23,58,56,30,41,39,35,34,32,31,29,28,27,26,25,24},t}, [23]={{23},t}, [44]={{23,58,56,30,41,39,35,34,32,31,29,28,44},t}, [39]={{23,58,56,30,41,39},t}, [32]={{23,58,56,30,41,39,35,34,32},t}, [3]={n,f}, [30]={{23,58,56,30},t}, [51]={{23,58,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47,50,51},t}, [18]={n,f}, [67]={{23,62,63,66,64,67},t}, [61]={{23,58,56,30,41,59,61},t}, [55]={{23,58,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47,52,53,54,55},t}, [46]={{23,58,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47,46},t}, [42]={{23,58,56,30,41,39,40,38,42},t}, [40]={{23,58,56,30,41,39,40},t}, [52]={{23,58,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47,52},t}, [54]={{23,58,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47,52,53,54},t}, [43]={n,f}, [7]={n,f}, [9]={n,f}, [41]={{23,58,56,30,41},t}, [17]={n,f}, [38]={{23,58,56,30,41,39,40,38},t}, [28]={{23,58,56,30,41,39,35,34,32,31,29,28},t}, [5]={n,f}, [64]={{23,62,63,66,64},t}, } return r
---- Change these settings to change stuff (keep the commas, lua doesn't understand n00b syntax)
local settings = { splatters_per_health_inc = 1, ---- The amount of blood splatters made when you lose (damage_inc) of health damage_inc = 2, ---- The increment of damage that must be done at a time to trigger blood splatters remove_time = 65, ---- The time (in seconds) until a blood splatter is removed after it is created min_splatter_time = 0, ---- The delay time (minimum) until another blood splatter is made max_splatter_time = 0.05, ---- The delay time (maximum) until another blood splatter is made min_transparency = 0.2, ---- The (minimum) transparency of a blood splatter max_transparency = 0, ---- The (maximum) transparency of a blood splatter min_size_x = 3, ---- The (minimum) size of a blood splatter on the X axis max_size_x = 8, ---- The (maximum) size of a blood splatter on the X axis min_size_z = 3, ---- The (minimum) size of a blood splatter on the Z axis max_size_z = 8, ---- The (maximum) size of a blood splatter on the Z axis tran_tw_time_min = 0.1, ---- The (minimum) time to tween the size of a blood splatter tran_tw_time_max = 0.5, ---- The (maximum) time to tween the size of a blood splatter size_tw_time_min = 0.1, ---- The (minimum) time to tween the transparency of a blood splatter size_tw_time_max = 0.6 ---- The (maximum) time to tween the transparency of a blood splatter }
-- SERVICES --
local CS = game:GetService("CollectionService") local StarterPlayer = game:GetService("StarterPlayer")
-- list of account names allowed to go through the door.
permission = {"Player1", "Player2", "Player3"}--Put your friends name's here. You can add more. function checkOkToLetIn(name) for i = 1,#permission do -- convert strings to all upper case, otherwise we will let in, -- "conrad105," and, "builderman," but not, "blast1." -- Why? Because, "blast1," is how it is spelled in the permissions. if (string.upper(name) == string.upper(permission[i])) then return true end end return false end local Door = script.Parent function onTouched(hit) print("Door Hit") local human = hit.Parent:findFirstChild("Humanoid") if (human ~= nil ) then -- a human has touched this door! print("Human touched door") -- test the human's name against the permission list if (checkOkToLetIn(human.Parent.Name)) then print("Human passed test") Door.Transparency = 0.7 Door.CanCollide = false wait(4) -- this is how long the door is open Door.CanCollide = true Door.Transparency = 0 else human.Health= 0 -- delete this line of you want a non-killing VIP door end end end script.Parent.Touched:connect(onTouched)
--[[** ensures all keys in given table pass check @param check The function to use to check the keys @returns A function that will return true iff the condition is passed **--]]
function t.keys(check) assert(t.callback(check)) return function(value) local tableSuccess, tableErrMsg = t.table(value) if tableSuccess == false then return false, tableErrMsg or "" end for key in pairs(value) do local success, errMsg = check(key) if success == false then return false, string.format("bad key %s:\n\t%s", tostring(key), errMsg or "") end end return true end end
-- Reset broken lights
function ResetLights() for i, lData in pairs(dParts.Lights) do lData[1].Material = lData[2] lData[1].Broken:Destroy() for _, light in pairs(lData[1]:GetChildren()) do if light:IsA("Light") then light.Enabled = true end end end end
-- ROBLOX FIXME: Can we define ClientChatModules statically in the project config
pcall(function() ChatLocalization = require((game:GetService("Chat") :: any).ClientChatModules.ChatLocalization :: any) end) if ChatLocalization == nil then ChatLocalization = {} end if not ChatLocalization.FormatMessageToSend or not ChatLocalization.LocalizeFormattedMessage then function ChatLocalization:FormatMessageToSend(key,default) return default end end local function Run(ChatService) local function ShowJoinAndLeaveCommands() if ChatSettings.ShowJoinAndLeaveHelpText ~= nil then return ChatSettings.ShowJoinAndLeaveHelpText end return false end local function ProcessCommandsFunction(fromSpeaker, message, channel) if (message:lower() == "/?" or message:lower() == "/help") then local speaker = ChatService:GetSpeaker(fromSpeaker) speaker:SendSystemMessage(ChatLocalization:FormatMessageToSend("GameChat_ChatCommandsTeller_Desc","These are the basic chat commands."), channel) if ChatSettings.AllowMeCommand then speaker:SendSystemMessage(ChatLocalization:FormatMessageToSend("GameChat_ChatCommandsTeller_MeCommand","/me <text> : roleplaying command for doing actions."), channel) end speaker:SendSystemMessage(ChatLocalization:FormatMessageToSend("GameChat_ChatCommandsTeller_SwitchChannelCommand","/c <channel> : switch channel menu tabs."), channel) if ShowJoinAndLeaveCommands() then speaker:SendSystemMessage(ChatLocalization:FormatMessageToSend("GameChat_ChatCommandsTeller_JoinChannelCommand","/join <channel> or /j <channel> : join channel."), channel) speaker:SendSystemMessage(ChatLocalization:FormatMessageToSend("GameChat_ChatCommandsTeller_LeaveChannelCommand","/leave <channel> or /l <channel> : leave channel. (leaves current if none specified)"), channel) end speaker:SendSystemMessage(ChatLocalization:FormatMessageToSend("GameChat_ChatCommandsTeller_WhisperCommand","/whisper <speaker> or /w <speaker> : open private message channel with speaker."), channel) speaker:SendSystemMessage(ChatLocalization:FormatMessageToSend("GameChat_ChatCommandsTeller_MuteCommand","/mute <speaker> : mute a speaker."), channel) speaker:SendSystemMessage(ChatLocalization:FormatMessageToSend("GameChat_ChatCommandsTeller_UnMuteCommand","/unmute <speaker> : unmute a speaker."), channel) local player = speaker:GetPlayer() if player and player.Team then speaker:SendSystemMessage(ChatLocalization:FormatMessageToSend("GameChat_ChatCommandsTeller_TeamCommand","/team <message> or /t <message> : send a team chat to players on your team."), channel) end return true end return false end ChatService:RegisterProcessCommandsFunction("chat_commands_inquiry", ProcessCommandsFunction, ChatConstants.StandardPriority) if ChatSettings.GeneralChannelName then local allChannel = ChatService:GetChannel(ChatSettings.GeneralChannelName) if (allChannel) then allChannel.WelcomeMessage = ChatLocalization:FormatMessageToSend("GameChat_ChatCommandsTeller_AllChannelWelcomeMessage","Chat '/?' or '/help' for a list of chat commands.") end end end return Run
--//hood
local hd = Instance.new("Motor", script.Parent.Parent.Misc.HD.SS) hd.MaxVelocity = 0.03 hd.Part0 = script.Parent.HD hd.Part1 = hd.Parent
-- Signal:Fire(...) implemented by running the handler functions on the -- coRunnerThread, and any time the resulting thread yielded without returning -- to us, that means that it yielded to the Roblox scheduler and has been taken -- over by Roblox scheduling, meaning we have to make a new coroutine runner. --[=[ @param ... any Fire the signal, which will call all of the connected functions with the given arguments. ```lua signal:Fire("Hello") -- Any number of arguments can be fired: signal:Fire("Hello", 32, {Test = "Test"}, true) ``` ]=]
function Signal:Fire(...) local item = self._handlerListHead while item do if item.Connected then if not freeRunnerThread then freeRunnerThread = coroutine.create(runEventHandlerInFreeThread) end task.spawn(freeRunnerThread, item._fn, ...) end item = item._next end end
--[=[ Checks whether the given object is a Promise via duck typing. This only checks if the object is a table and has an `andThen` method. @param object any @return boolean -- `true` if the given `object` is a Promise. ]=]
function Promise.is(object) if type(object) ~= "table" then return false end local objectMetatable = getmetatable(object) if objectMetatable == Promise then -- The Promise came from this library. return true elseif objectMetatable == nil then -- No metatable, but we should still chain onto tables with andThen methods return isCallable(object.andThen) elseif type(objectMetatable) == "table" and type(rawget(objectMetatable, "__index")) == "table" and isCallable(rawget(rawget(objectMetatable, "__index"), "andThen")) then -- Maybe this came from a different or older Promise library. return true end return false end
-- Decompiled with the Synapse X Luau decompiler.
local v1 = {}; v1.__index = v1; local v2 = {}; function v2.__call(p1, ...) return v1.new(...); end; setmetatable(v1, v2); function v1.new() return setmetatable({}, v1); end; function v1.CharacterAdded(p2, p3, p4) end; function v1.CharacterRemoving(p5, p6, p7) end; function v1.OnCameraSubjectChanged(p8, p9) end; function v1.GetOcclusionMode(p10) warn("BaseOcclusion GetOcclusionMode must be overridden by derived classes"); return nil; end; function v1.Enable(p11, p12) warn("BaseOcclusion Enable must be overridden by derived classes"); end; function v1.Update(p13, p14, p15, p16) warn("BaseOcclusion Update must be overridden by derived classes"); return p15, p16; end; return v1;
-------------------------
mouse.KeyDown:connect(function (key) key = string.lower(key) if key == "k" then --Camera controls if cam == ("car") then Camera.CameraSubject = player.Character.Humanoid Camera.CameraType = ("Custom") cam = ("freeplr") Camera.FieldOfView = 70 elseif cam == ("freeplr") then Camera.CameraSubject = player.Character.Humanoid Camera.CameraType = ("Attach") cam = ("lockplr") Camera.FieldOfView = 45 elseif cam == ("lockplr") then Camera.CameraSubject = carSeat Camera.CameraType = ("Custom") cam = ("car") Camera.FieldOfView = 70 end elseif key == "u" then --Window controls if windows == false then winfob.Visible = true windows = true else windows = false winfob.Visible = false end end end) winfob.FL.Lock.MouseButton1Click:connect(function() --Window if carSeat.WindowFL.Value == false then carSeat.WindowFL.Value = true carSeat.Parent.Misc.FL.Window.SS.Motor.DesiredAngle = carSeat.Parent.Misc.FL.Window.SS.Motor.DesiredAngle - 0.20 else carSeat.WindowFL.Value = false carSeat.Parent.Misc.FL.Window.SS.Motor.DesiredAngle = carSeat.Parent.Misc.FL.Window.SS.Motor.DesiredAngle + 0.20 end end) winfob.FR.Lock.MouseButton1Click:connect(function() --Window if carSeat.WindowFR.Value == false then carSeat.WindowFR.Value = true carSeat.Parent.Misc.FR.Window.SS.Motor.DesiredAngle = carSeat.Parent.Misc.FR.Window.SS.Motor.DesiredAngle + 0.20 else carSeat.WindowFR.Value = false carSeat.Parent.Misc.FR.Window.SS.Motor.DesiredAngle = carSeat.Parent.Misc.FR.Window.SS.Motor.DesiredAngle - 0.20 end end) HUB.Limiter.MouseButton1Click:connect(function() --Ignition if carSeat.IsOn.Value == false then carSeat.IsOn.Value = true carSeat.Startup:Play() carSeat.Chime:Play() else carSeat.IsOn.Value = false end end) TR.SN.MouseButton1Click:connect(function() --Show tracker names script.Parent.Names.Value = true end) TR.HN.MouseButton1Click:connect(function() --Hide tracker names script.Parent.Names.Value = false end) carSeat.Indicator.Changed:connect(function() if carSeat.Indicator.Value == true then script.Parent.Indicator:Play() else script.Parent.Indicator2:Play() end end) carSeat.LI.Changed:connect(function() if carSeat.LI.Value == true then carSeat.Parent.Body.Dash.DashSc.G.Left.Visible = true script.Parent.HUB.Left.Visible = true else carSeat.Parent.Body.Dash.DashSc.G.Left.Visible = false script.Parent.HUB.Left.Visible = false end end) carSeat.RI.Changed:connect(function() if carSeat.RI.Value == true then carSeat.Parent.Body.Dash.DashSc.G.Right.Visible = true script.Parent.HUB.Right.Visible = true else carSeat.Parent.Body.Dash.DashSc.G.Right.Visible = false script.Parent.HUB.Right.Visible = false end end) while wait() do carSeat.Parent.Body.Dash.Screen.G.Time.Text = game.Lighting.TimeOfDay carSeat.Parent.Body.Dash.DashSc.G.Time.Text = game.Lighting.TimeOfDay carSeat.Parent.Body.Dash.DashSc.G.Speed.Text = math.floor(carSeat.Velocity.magnitude*((10/12) * (60/88))) script.Parent.HUB.Time.Text = game.Lighting.TimeOfDay end
--[=[ @interface Service .[any] any @within KnitClient ]=]
type Service = { [any]: any, }
--[[** ensures Roblox NumberSequence type @param value The value to check against @returns True iff the condition is satisfied, false otherwise **--]]
t.NumberSequence = t.typeof("NumberSequence")
-- ROBLOX TODO: ADO-1554 clean up the following deviations and move them to the -- appropriate locations -- ROBLOX deviation START: for now we extend the snapshot matchers in the Expect file instead -- of jest-jasmine2/jestExpect
local JestSnapshot = require(Packages.JestSnapshot) local toMatchSnapshot = JestSnapshot.toMatchSnapshot local toThrowErrorMatchingSnapshot = JestSnapshot.toThrowErrorMatchingSnapshot setMatchers({ toMatchSnapshot = toMatchSnapshot, toThrowErrorMatchingSnapshot = toThrowErrorMatchingSnapshot, }, false, Expect)
--[[Weight and CG]]
Tune.Weight = 3300 -- Total weight (in pounds) Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable) --[[Width]] 6 , --[[Height]] 3.5 , --[[Length]] 14 } 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
-----------------------------------------------------------------------------------------------
script.Parent:WaitForChild("Speedo") script.Parent:WaitForChild("Tach") script.Parent:WaitForChild("ln") script.Parent:WaitForChild("Gear") script.Parent:WaitForChild("Speed") local player=game.Players.LocalPlayer local mouse=player:GetMouse() local car = script.Parent.Parent.Car.Value car.DriveSeat.HeadsUpDisplay = false local _Tune = require(car["A-Chassis Tune"]) local _pRPM = _Tune.PeakRPM local _lRPM = _Tune.Redline local currentUnits = 1 local revEnd = math.ceil(_lRPM/1000) local intach = car.Body.Dash.Tac.G.Needle local inspd = car.Body.Dash.Spd.G.Needle
--Made by Stickmasterluke
sp=script.Parent firerate=0.6 range=950 power=300 rate=1/30 spinuptime=0 barreloffset=Vector3.new(0,0,-1.8) windvec=Vector3.new(0,-1,1).unit firetime=0 maxammo=8 reloadtime = 0.6 ammo=maxammo debris=game:GetService("Debris") equipped=false check=true firing=false reloading=false function wait(TimeToWait) if TimeToWait ~= nil then local TotalTime = 0 TotalTime = TotalTime + game:GetService("RunService").Heartbeat:wait() while TotalTime < TimeToWait do TotalTime = TotalTime + game:GetService("RunService").Heartbeat:wait() end else game:GetService("RunService").Heartbeat:wait() end end function waitfor(parent,name) while parent:FindFirstChild(name)==nil do wait() end return parent:FindFirstChild(name) end function checkintangible(hit) if hit and hit~=nil then if hit:IsDescendantOf(sp.Parent) or hit.Transparency>.8 or hit.Name=="Handle" or hit.Name=="Effect" or hit.Name=="Bullet" or hit.Name=="Laser" or string.lower(hit.Name)=="water" or hit.Name=="Rail" or hit.Name=="Arrow" then return true end end return false end function castray(startpos,vec,length,ignore,delayifhit) local hit,endpos2=game.Workspace:FindPartOnRay(Ray.new(startpos,vec*length),ignore) if hit~=nil then if checkintangible(hit) then if delayifhit then wait() end hit,endpos2=castray(endpos2+(vec*.01),vec,length-((startpos-endpos2).magnitude),ignore,delayifhit) end end return hit,endpos2 end function wait(TimeToWait) if TimeToWait ~= nil then local TotalTime = 0 TotalTime = TotalTime + game:GetService("RunService").Heartbeat:wait() while TotalTime < TimeToWait do TotalTime = TotalTime + game:GetService("RunService").Heartbeat:wait() end else game:GetService("RunService").Heartbeat:wait() end end function drawbeam(beamstart,beamend,clr,fadedelay) local dist=(beamstart-beamend).magnitude local laser=Instance.new("Part") laser.Name="Effect" laser.Anchored=true laser.CanCollide=false laser.Shape="Block" laser.formFactor="Custom" laser.Size=Vector3.new(.2,.2,.2) laser.Transparency=0 laser.Material=Enum.Material.SmoothPlastic laser.Locked=true laser.TopSurface=0 laser.BottomSurface=0 laser.BrickColor=clr laser.CFrame=CFrame.new(beamend,beamstart)*CFrame.new(0,0,-dist/2)*CFrame.Angles(math.pi/2,0,0) local m=Instance.new("SpecialMesh") m.Scale=Vector3.new(1,dist*5,1) m.MeshType="Brick" m.Parent=laser debris:AddItem(laser,fadedelay*0.5) laser.Parent=game.Workspace --[[local frames=math.floor(fadedelay/rate) for frame=1,frames do wait(rate) local percent=frame/frames laser.CFrame=laser.CFrame+windvec*rate laser.Transparency=.5+(percent*.5) end]] wait(.5) laser:remove() end function fire() local hu=sp.Parent:FindFirstChild("Humanoid") local he=sp.Parent:FindFirstChild("Head") local t=sp.Parent:FindFirstChild("Torso") if hu and hu.Health>0 and t and he and themouse~=nil and equipped then anim2 = sp.Parent.Humanoid:LoadAnimation(sp.FireAni) if anim2 then anim2:Play() anim2:AdjustSpeed(1) end local startpos=he.Position local fakestartpos=(sp.Handle.CFrame*CFrame.new(barreloffset)).p local vec=(themouse.Hit.p-startpos).unit + (Vector3.new(math.random(-1000,1000),math.random(-1000,1000),math.random(-1000,1000)) / (1500*25)) local p=Instance.new("Part") p.Name="Effect" p.BrickColor=BrickColor.new("Black") p.CanCollide=false p.TopSurface="Smooth" p.BottomSurface="Smooth" p.formFactor="Custom" p.Size=Vector3.new(0,0,0) p.Transparency=1 local m=Instance.new("SpecialMesh") m.Parent=p local hit,endpos=castray(startpos,vec,range,sp.Parent,false) local fakevec=(endpos-fakestartpos).unit if hit~=nil then local newcf=CFrame.new(endpos,endpos+fakevec)*CFrame.Angles(math.pi/2,0,0)*CFrame.new(0,0,0) p.CFrame=newcf local w=Instance.new("Weld") w.Part0=hit w.Part1=p w.C0=hit.CFrame:inverse()*newcf w.C1=newcf:inverse()*newcf w.Parent=p local c=Instance.new("ObjectValue") c.Name="creator" c.Value=game.Players.LocalPlayer c.Parent=p local s=script.Script:clone() s.Parent=p s.Disabled=false else p.CFrame=CFrame.new(endpos,endpos+fakevec) p.Velocity=fakevec*power p.Parent=game.Workspace end debris:AddItem(p,1) p.Parent=game.Workspace delay(0,function() drawbeam(fakestartpos,endpos,BrickColor.new("Bright yellow"),.1) end) local sound=sp.Handle:FindFirstChild("Fire") if sound~=nil then --sound:Stop() sound:Play() end local shoulder=t:FindFirstChild("Right Shoulder") if shoulder~=nil then shoulder.CurrentAngle=(math.pi/2)+.1 end end end function onEquipped(mouse) equipped=true if mouse~=nil then anim = sp.Parent.Humanoid:LoadAnimation(sp.idle) if anim then anim:Play() end themouse=mouse mouse.Icon="rbxasset://textures\\GunCursor.png" mouse.Button1Down:connect(function() if sp.Enabled == false then return end sp.Enabled = false if ammo > 0 then ammo = ammo - 1 fire() fire() fire() fire() fire() fire() fire() fire() fire() fire() else Reload() end mouse.Icon="rbxasset://textures\\GunCursor.png" Delay(firerate,function() if ammo == 0 then Reload() end sp.Enabled = true end) end) mouse.Button1Up:connect(function() mouse.Icon="rbxasset://textures\\GunCursor.png" end) mouse.KeyDown:connect(function(Key) if string.lower(Key) == "r" then if ammo ~= maxammo and sp.Enabled == true then sp.Enabled = false Reload() sp.Enabled = true end end end) end end function Reload() anim3 = sp.Parent.Humanoid:LoadAnimation(sp.Reload) while ammo < maxammo do if anim3 then anim3:Play() anim3:AdjustSpeed(1) end local sound=sp.Handle:FindFirstChild("Reload") if sound~=nil then sound:Play() end wait(reloadtime) ammo = ammo + 1 end if anim3 then anim3:Play() anim3:AdjustSpeed(1) end local sound=sp.Handle:FindFirstChild("Pump") if sound~=nil then sound:Play() end wait(reloadtime) end function onUnequipped() if anim then anim:Stop() end equipped=false themouse=nil end sp.Equipped:connect(onEquipped) sp.Unequipped:connect(onUnequipped)
--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.Character.NPCSpecifics.GaveFoodToArtie.Value == true) end
--// Animations
-- Idle Anim IdleAnim = function(char, speed, objs) TweenJoint(objs[2], nil , CFrame.new(-0.902175903, 0.295501232, -1.32277012, 1, 0, 0, 0, 1.19248806e-08, 1, 0, -1, 1.19248806e-08), function(X) return math.sin(math.rad(X)) end, 0.25) TweenJoint(objs[3], nil , CFrame.new(1.06851184, 0.973718464, -2.29667926, 0.787567914, -0.220087856, 0.575584888, -0.615963876, -0.308488727, 0.724860668, 0.0180283934, -0.925416589, -0.378522098), function(X) return math.sin(math.rad(X)) end, 0.25) wait(0.18) end; -- FireMode Anim FireModeAnim = function(char, speed, objs) TweenJoint(objs[1], nil , CFrame.new(0.340285569, 0, -0.0787199363, 0.962304771, 0.271973342, 0, -0.261981696, 0.926952124, -0.268561482, -0.0730415657, 0.258437991, 0.963262498), function(X) return math.sin(math.rad(X)) end, 0.25) wait(0.1) TweenJoint(objs[2], nil , CFrame.new(0.67163527, -0.310947895, -1.34432662, 0.766044378, -2.80971371e-008, 0.642787576, -0.620885074, -0.258818865, 0.739942133, 0.166365519, -0.965925872, -0.198266774), function(X) return math.sin(math.rad(X)) end, 0.25) wait(0.25) objs[4]:WaitForChild("Click"):Play() end; -- Reload Anim ReloadAnim = function(char, speed, objs) TweenJoint(objs[2], nil , CFrame.new(-0.630900264, 0.317047596, -1.27966166, 0.985866964, -0.167529628, -7.32295247e-09, 0, -4.37113883e-08, 1, -0.167529613, -0.985867023, -4.30936176e-08), function(X) return math.sin(math.rad(X)) end, 0.5) TweenJoint(objs[3], nil , CFrame.new(0.436954767, 0.654289246, -1.82817471, 0.894326091, -0.267454475, 0.358676374, -0.413143814, -0.185948789, 0.891479254, -0.171734676, -0.945458114, -0.276796043), function(X) return math.sin(math.rad(X)) end, 0.5) wait(0.3) local MagC = Tool:WaitForChild("Mag"):clone() MagC:FindFirstChild("Mag"):Destroy() MagC.Parent = Tool MagC.Name = "MagC" local MagCW = Instance.new("Motor6D") MagCW.Part0 = MagC MagCW.Part1 = workspace.CurrentCamera:WaitForChild("Arms"):WaitForChild("Left Arm") MagCW.Parent = MagC MagCW.C1 = MagC.CFrame:toObjectSpace(objs[4].CFrame) objs[4].Transparency = 1 objs[6]:WaitForChild("MagOut"):Play() TweenJoint(objs[3], nil , CFrame.new(0.436954767, 0.654289246, -3.00337243, 0.894326091, -0.267454475, 0.358676374, -0.413143814, -0.185948789, 0.891479254, -0.171734676, -0.945458114, -0.276796043), function(X) return math.sin(math.rad(X)) end, 0.3) TweenJoint(objs[2], nil , CFrame.new(-0.630900264, 0.317047596, -1.27966166, 0.985866964, -0.167529628, -7.32295247e-09, 0.0120280236, 0.0707816631, 0.997419298, -0.16709727, -0.983322799, 0.0717963576), function(X) return math.sin(math.rad(X)) end, 0.1) wait(0.1) TweenJoint(objs[2], nil , CFrame.new(-1.11434817, 0.317047596, -0.672240019, 0.658346057, -0.747599542, -0.0876094475, 0.0672011375, -0.0575498641, 0.996078312, -0.749709547, -0.661651671, 0.0123518109), function(X) return math.sin(math.rad(X)) end, 0.3) wait(0.4) objs[6]:WaitForChild('MagSlide'):Play() TweenJoint(objs[3], nil , CFrame.new(-0.273085892, 0.654289246, -1.48434556, 0.613444746, -0.780330896, 0.121527649, -0.413143814, -0.185948789, 0.891479254, -0.673050761, -0.597081661, -0.43645826), function(X) return math.sin(math.rad(X)) end, 0.3) wait(0.2) MagC:Destroy() objs[4].Transparency = 0 wait(0.05) TweenJoint(objs[3], nil , CFrame.new(0.436954767, 0.654289246, -1.82817471, 0.894326091, -0.267454475, 0.358676374, -0.413143814, -0.185948789, 0.891479254, -0.171734676, -0.945458114, -0.276796043), function(X) return math.sin(math.rad(X)) end, 0.5) wait(0.05) TweenJoint(objs[3], nil , CFrame.new(0.436954767, 0.654289246, -3.00337243, 0.894326091, -0.267454475, 0.358676374, -0.413143814, -0.185948789, 0.891479254, -0.171734676, -0.945458114, -0.276796043), function(X) return math.sin(math.rad(X)) end, 0.3) wait(0.05) TweenJoint(objs[3], nil , CFrame.new(-0.273085892, 0.654289246, -1.48434556, 0.613444746, -0.780330896, 0.121527649, -0.413143814, -0.185948789, 0.891479254, -0.673050761, -0.597081661, -0.43645826), function(X) return math.sin(math.rad(X)) end, 0.3) wait(0.04) objs[6]:WaitForChild('MagIn'):Play() wait(0.3) MagC:Destroy() objs[4].Transparency = 0 end; -- Bolt Anim BoltBackAnim = function(char, speed, objs) TweenJoint(objs[2], nil , CFrame.new(-0.674199283, -0.379443169, -1.24877262, 0.098731339, -0.973386228, -0.206811741, -0.90958333, -0.172570169, 0.377991527, -0.403621316, 0.150792867, -0.902414143), function(X) return math.sin(math.rad(X)) end, 0.25) wait(0.1) objs[5]:WaitForChild("BoltForward"):Play() TweenJoint(objs[2], nil , CFrame.new(-0.674199283, -0.578711689, -0.798391461, 0.098731339, -0.973386228, -0.206811741, -0.90958333, -0.172570169, 0.377991527, -0.403621316, 0.150792867, -0.902414143), function(X) return math.sin(math.rad(X)) end, 0.25) TweenJoint(objs[1], nil , CFrame.new(0, 0, 0.273770154, 1, 0, 0, 0, 1, 0, 0, 0, 1), function(X) return math.sin(math.rad(X)) end, 0.25) TweenJoint(objs[3], nil , CFrame.new(-0.723402083, 0.311225414, -1.32277012, 0.98480773, 0.173648179, -2.07073381e-09, 0.0128111057, -0.0726553723, 0.997274816, 0.173174962, -0.982123971, -0.0737762004), function(X) return math.sin(math.rad(X)) end, 0.25) wait(0.2) end; BoltForwardAnim = function(char, speed, objs) TweenJoint(objs[1], nil , CFrame.new(), function(X) return math.sin(math.rad(X)) end, 0.1) wait(0.05) end; -- Bolting Back BoltingBackAnim = function(char, speed, objs) TweenJoint(objs[1], nil , CFrame.new(0, 0, 0.673770154, 1, 0, 0, 0, 1, 0, 0, 0, 1), function(X) return math.sin(math.rad(X)) end, 0.05) end; BoltingForwardAnim = function(char, speed, objs) TweenJoint(objs[1], nil , CFrame.new(), function(X) return math.sin(math.rad(X)) end, 0.05) end; InspectAnim = function(char, speed, objs) ts:Create(objs[1],TweenInfo.new(1),{C1 = CFrame.new(0.805950999, 0.654529691, -1.92835355, 0.999723792, 0.0109803826, 0.0207702816, -0.0223077796, 0.721017241, 0.692557871, -0.00737112388, -0.692829967, 0.721063137)}):Play() ts:Create(objs[2],TweenInfo.new(1),{C1 = CFrame.new(-1.49363565, -0.699174881, -1.32277012, 0.66716975, -8.8829113e-09, -0.74490571, 0.651565909, -0.484672248, 0.5835706, -0.361035138, -0.874695837, -0.323358655)}):Play() wait(1) ts:Create(objs[2],TweenInfo.new(1),{C1 = CFrame.new(1.37424219, -0.699174881, -1.03685927, -0.204235911, 0.62879771, 0.750267386, 0.65156585, -0.484672219, 0.58357054, 0.730581641, 0.60803473, -0.310715646)}):Play() wait(1) ts:Create(objs[2],TweenInfo.new(1),{C1 = CFrame.new(-0.902175903, 0.295501232, -1.32277012, 0.935064793, -0.354476899, 4.22709467e-09, -0.110443868, -0.291336805, 0.950223684, -0.336832345, -0.888520718, -0.311568588)}):Play() ts:Create(objs[1],TweenInfo.new(1),{C1 = CFrame.new(0.447846293, 0.654529572, -1.81345785, 0.761665463, -0.514432132, 0.393986136, -0.560285628, -0.217437655, 0.799250066, -0.325492471, -0.82950604, -0.453843832)}):Play() wait(1) local MagC = Tool:WaitForChild("Mag"):clone() MagC:FindFirstChild("Mag"):Destroy() MagC.Parent = Tool MagC.Name = "MagC" local MagCW = Instance.new("Motor6D") MagCW.Part0 = MagC MagCW.Part1 = workspace.CurrentCamera:WaitForChild("Arms"):WaitForChild("Left Arm") MagCW.Parent = MagC MagCW.C1 = MagC.CFrame:toObjectSpace(Tool:WaitForChild('Mag').CFrame) Tool.Mag.Transparency = 1 Tool:WaitForChild('Grip'):WaitForChild("MagOut"):Play() ts:Create(objs[2],TweenInfo.new(0.15),{C1 = CFrame.new(-0.902175903, 0.295501232, -1.55972552, 0.935064793, -0.354476899, 4.22709467e-09, -0.110443868, -0.291336805, 0.950223684, -0.336832345, -0.888520718, -0.311568588)}):Play() ts:Create(objs[1],TweenInfo.new(0.3),{C1 = CFrame.new(0.447846293, 0.654529572, -2.9755671, 0.761665463, -0.514432132, 0.393986136, -0.568886042, -0.239798605, 0.786679745, -0.31021595, -0.823320091, -0.475299776)}):Play() wait(0.13) ts:Create(objs[2],TweenInfo.new(0.20),{C1 = CFrame.new(-0.902175903, 0.295501232, -1.28149843, 0.935064793, -0.354476899, 4.22709467e-09, -0.110443868, -0.291336805, 0.950223684, -0.336832345, -0.888520718, -0.311568588)}):Play() wait(0.20) ts:Create(objs[1],TweenInfo.new(0.5),{C1 = CFrame.new(0.447846293, -0.650498748, -1.82401526, 0.761665463, -0.514432132, 0.393986136, -0.646156013, -0.55753684, 0.521185875, -0.0484529883, -0.651545882, -0.75706023)}):Play() wait(0.8) ts:Create(objs[1],TweenInfo.new(0.6),{C1 = CFrame.new(0.447846293, 0.654529572, -2.9755671, 0.761665463, -0.514432132, 0.393986136, -0.568886042, -0.239798605, 0.786679745, -0.31021595, -0.823320091, -0.475299776)}):Play() wait(0.5) Tool:WaitForChild('Grip'):WaitForChild("MagIn"):Play() ts:Create(objs[1],TweenInfo.new(0.3),{C1 = CFrame.new(0.447846293, 0.654529572, -1.81345785, 0.761665463, -0.514432132, 0.393986136, -0.560285628, -0.217437655, 0.799250066, -0.325492471, -0.82950604, -0.453843832)}):Play() wait(0.3) MagC:Destroy() Tool.Mag.Transparency = 0 wait(0.1) end; nadeReload = function(char, speed, objs) ts:Create(objs[1], TweenInfo.new(0.6), {C1 = CFrame.new(-0.902175903, -1.15645337, -1.32277012, 0.984807789, -0.163175702, -0.0593911409, 0, -0.342020363, 0.939692557, -0.17364797, -0.925416529, -0.336824328)}):Play() ts:Create(objs[2], TweenInfo.new(0.6), {C1 = CFrame.new(0.805950999, 0.654529691, -1.92835355, 0.787567914, -0.220087856, 0.575584888, -0.323594928, 0.647189975, 0.690240026, -0.524426222, -0.72986728, 0.438486755)}):Play() wait(0.6) ts:Create(objs[2], TweenInfo.new(0.6), {C1 = CFrame.new(0.805950999, 0.559619546, -1.73060048, 0.802135408, -0.348581612, 0.484839559, -0.597102284, -0.477574915, 0.644508123, 0.00688350201, -0.806481719, -0.59121877)}):Play() wait(0.6) end; AttachAnim = function(char, speed, objs) TweenJoint(objs[1], nil , CFrame.new(-2.05413628, -0.386312962, -0.955676377, 0.5, 0, -0.866025329, 0.852868497, -0.17364797, 0.492403895, -0.150383547, -0.984807789, -0.086823985), function(X) return math.sin(math.rad(X)) end, 0.25) TweenJoint(objs[2], nil , CFrame.new(0.931334019, 1.66565645, -1.2231313, 0.787567914, -0.220087856, 0.575584888, -0.0180282295, 0.925416708, 0.378521889, -0.615963817, -0.308488399, 0.724860728), function(X) return math.sin(math.rad(X)) end, 0.25) wait(0.18) end; -- Patrol Anim PatrolAnim = function(char, speed, objs) TweenJoint(objs[1], nil , sConfig.PatrolPosR, function(X) return math.sin(math.rad(X)) end, 0.25) TweenJoint(objs[2], nil , sConfig.PatrolPosL, function(X) return math.sin(math.rad(X)) end, 0.25) wait(0.18) end; } return Settings
-- Stops a confetti from firing again once it's out of bounds.
function _Confetti:Toggle() self.Enabled = not(self.Enabled); end; _Confetti.setGravity(Vector2.new(0, 1)); local Conffetis = {} for _ = 1, 10 do table.insert(Conffetis, (_Confetti.createParticle(Vector2.new(0.5, 1), Vector2.new(math.random(90) - 45, math.random(70, 100)), script.Parent.Parent))) end local Debounce = false RunService.RenderStepped:Connect(function() for _, Conffeti in pairs(Conffetis) do Conffeti.Enabled = Debounce Conffeti:Update() end end) function _Confetti.fire() spawn(function() Debounce = true wait(tick) Debounce = false end) end return _Confetti;
--Janitor.__index.GivePromise = Janitor.__index.AddPromise
--[[ Returns a new list containing only the elements within the given range. ]]
local function getRange(list, startIndex, endIndex) assert(startIndex <= endIndex, "startIndex must be less than or equal to endIndex") local new = {} local index = 1 for i = math.max(1, startIndex), math.min(#list, endIndex) do new[index] = list[i] index = index + 1 end return new end return getRange
--LIGHTING FUNCTIONS
script.Parent.OnServerEvent:connect(function(pl,n) if lt~=1 then pr = true else pr=false end lt=n if lt~=3 then RefMt.DesiredAngle = RefMt.CurrentAngle%math.rad(360) RefMt.CurrentAngle = RefMt.CurrentAngle%math.rad(360) UpdateLt(1,white) UpdatePt(false,white) StopMt(pr) repeat wait() until (lt==3) elseif lt == 3 then wait(1/3) UpdateLt(.25,red) UpdatePt(true,red) UpdateMt(0,9e9,1) repeat if math.deg(RefMt.CurrentAngle%math.rad(360)) >= 90 then UpdateLt(.25,amber) end if math.deg(RefMt.CurrentAngle%math.rad(360)) >= 90 then UpdatePt(true,amber) end if math.deg(RefMt.CurrentAngle%math.rad(360)) >= 270 then UpdateLt(.25,white) end if math.deg(RefMt.CurrentAngle%math.rad(360)) >= 270 then UpdatePt(true,white) end wait() until lt~=3 end end)
--[[Wheel Alignment]]
--[Don't physically apply alignment to wheels] --[Values are in degrees] Tune.FCamber = -0.5 Tune.RCamber = -0.5 Tune.FToe = 0 Tune.RToe = 0
--[=[ @param signal RBXScriptSignal @param fn (...: any) -> any @return RBXScriptConnection Connects the function to the signal, adds the connection to the Janitor, and then returns the connection. ```lua Janitor:Connect(workspace.ChildAdded, function(instance) print(instance.Name .. " added to workspace") end) ``` ]=]
function Janitor:Connect(signal, fn) return self:Add(signal:Connect(fn)) end
--------
local Handler = require(script.MainHandler) local HitboxClass = require(script.HitboxObject) function RaycastHitbox:Initialize(object, ignoreList) assert(object, "You must provide an object instance.") local newHitbox = Handler:check(object) if not newHitbox then newHitbox = HitboxClass:new() newHitbox:config(object, ignoreList) newHitbox:seekAttachments(RaycastHitbox.AttachmentName, RaycastHitbox.WarningMessage) newHitbox.debugMode = RaycastHitbox.DebugMode Handler:add(newHitbox) end return newHitbox end function RaycastHitbox:Deinitialize(object) Handler:remove(object) end function RaycastHitbox:GetHitbox(object) return Handler:check(object, RaycastHitbox.WarningMessage) end return RaycastHitbox
---
elseif sys.Code.Value == true and folder.KV.Value.Value ~= config.AllCode.Value then --- folder.Display.Value = folder.KV folder.CodePrivate.Value = "" huh.Parent.Display.SurfaceGui.TextLabel.TextTransparency = 0 --- err() wait(1) sys.Code.Value = false elseif folder.KV.Value.Value == "" and config.AllCodes.Value == false then usercodefalse()
--[=[ Returns true if the value is a ValueBase instance @param instance Instance @return boolean ]=]
function ValueBaseUtils.isValueBase(instance) return typeof(instance) == "Instance" and instance:IsA("ValueBase") end
--Mobile Controllability
if UserInputService.TouchEnabled then ContextActionService:BindActionToInputTypes('RidableHorse_Dismount', (function() Dismount() end), true, Enum.KeyCode.LeftControl) ContextActionService:SetTitle("RidableHorse_Dismount", "Dismount") end ServerControl.Changed:connect(function(Property) if Property == "Parent" and not ServerControl.Parent then ContextActionService:UnbindAction("RidableHorse_Dismount") Debris:AddItem(script, 1) end end)
-- Initialize resize tool
local ResizeTool = require(CoreTools:WaitForChild 'Resize') Core.AssignHotkey('X', Core.Support.Call(Core.EquipTool, ResizeTool)); Core.Dock.AddToolButton(Core.Assets.ResizeIcon, 'X', ResizeTool, 'ResizeInfo');
---------------------------------- ------------FUNCTIONS------------- ----------------------------------
function Receive(player, action, ...) local args = {...} if player == User and action == "play" then if not MODEL.IsActive.Value or Piano.On.Value then Connector:FireAllClients("play", User, args[1], Settings.SoundSource.Position, Settings.PianoSoundRange, Settings.PianoSounds, args[2], Settings.IsCustom) HighlightPianoKey((args[1] > 61 and 61) or (args[1] < 1 and 1) or args[1],args[3]) end elseif player == User and action == "abort" then Deactivate() if SeatWeld then SeatWeld:remove() end end end function Activate(player) Connector:FireClient(player, "activate", Settings.CameraCFrame, Settings.PianoSounds, true) User = player end function Deactivate() if User and User.Parent then Connector:FireClient(User, "deactivate") User.Character:SetPrimaryPartCFrame(Box.CFrame + Vector3.new(0, 5, 0)) end User = nil end
-- NintendoZERG
function Entered(p) if p:findFirstChild("leaderstats") == nil then stats = Instance.new("IntValue") stats.Parent = p stats.Name = "leaderstats" money = Instance.new("IntValue") money.Value = 0 -- How much money each player starts with. money.Name = "Money" money.Parent = stats ao = Instance.new("IntValue") ao.Value = 0 ao.Name = "AlreadyOwned" ao.Parent = p end end game.Players.PlayerAdded:connect(Entered) p = game.Players:GetChildren() for i = 1, #p do Entered(p[i]) end print("LinkedLeaderboard script version 5.00 loaded") stands = {} CTF_mode = false function handleKillCount(humanoid, player) local killer = getKillerOfHumanoidIfStillInGame(humanoid) if killer ~= nil then local stats = killer:findFirstChild("leaderstats") if stats ~= nil then local kills = stats:findFirstChild("KOs") if killer ~= player then kills.Value = kills.Value + 1 else kills.Value = kills.Value - 1 end end end end function onPlayerEntered(newPlayer) if CTF_mode == true then local stats = Instance.new("IntValue") stats.Name = "leaderstats" captures.Parent = stats -- VERY UGLY HACK -- Will this leak threads? -- Is the problem even what I think it is (player arrived before character)? while true do if newPlayer.Character ~= nil then break end wait(5) end stats.Parent = newPlayer else local stats = Instance.new("IntValue") stats.Name = "leaderstats" local kills = Instance.new("IntValue") kills.Name = "KOs" kills.Value = 0 kills.Parent = stats deaths.Parent = stats -- VERY UGLY HACK -- Will this leak threads? -- Is the problem even what I think it is (player arrived before character)? while true do if newPlayer.Character ~= nil then break end wait(5) end local humanoid = newPlayer.Character.Humanoid humanoid.Died:connect(function() onHumanoidDied(humanoid, newPlayer) end ) -- start to listen for new humanoid newPlayer.Changed:connect(function(property) onPlayerRespawn(property, newPlayer) end ) stats.Parent = newPlayer end end
-- Weighted selection -- 100 total weight
petModule.rarities = { ["Legendary"] = 5; -- 5% chance ["Rare"] = 15; -- 15% chance ["Uncommon"] = 30; -- 30% chance ["Common"] = 50; -- 50% chance } petModule.chooseRandomPet = function() local randomNumber = math.random(1,100) local counter = 0 for rarity, weight in pairs(petModule.rarities) do counter = counter + weight if randomNumber <= counter then local rarityTable = petModule.pets[rarity] local chosenPet = rarityTable[math.random(1,#rarityTable)] return chosenPet end end end return petModule
-- --
local Info = { -- These are constant values. Don't change them unless you know what you're doing. -- Services Players = Game:GetService 'Players', PathfindingService = Game:GetService 'PathfindingService', -- Advanced settings RecomputePathFrequency = 1, -- The monster will recompute its path this many times per second RespawnWaitTime = 5, -- How long to wait before the monster respawns JumpCheckFrequency = 1, -- How many times per second it will do a jump check } local Data = { -- These are variable values used internally by the script. Advanced users only. LastRecomputePath = 0, Recomputing = false, -- Reocmputing occurs async, meaning this script will still run while it's happening. This variable will prevent the script from running two recomputes at once. PathCoords = {}, IsDead = false, TimeOfDeath = 0, CurrentNode = nil, CurrentNodeIndex = 1, AutoRecompute = true, LastJumpCheck = 0, LastAttack = 0, BaseMonster = Self:Clone(), AttackTrack = nil, }
--- Source: https://web.archive.org/web/20131225070434/http://snippets.luacode.org/snippets/Deep_Comparison_of_Two_Values_3
function CompareTable(t1,t2,ignore_mt) local ty1 = type(t1) local ty2 = type(t2) if ty1 ~= ty2 then return false end --- Non-table types can be directly compared if ty1 ~= 'table' and ty2 ~= 'table' then return t1 == t2 end --- As well as tables which have the metamethod __eq local mt = getmetatable(t1) if not ignore_mt and mt and mt.__eq then return t1 == t2 end for k1,v1 in pairs(t1) do local v2 = t2[k1] if v2 == nil or not CompareTable(v1,v2) then return false end end for k2,v2 in pairs(t2) do local v1 = t1[k2] if v1 == nil or not CompareTable(v1,v2) then return false end end return true end
--[=[ Returns `true` if the given object is a Timer. ]=]
function Timer.Is(obj: any): boolean return type(obj) == "table" and getmetatable(obj) == Timer end function Timer:_startTimer() local t = self.TimeFunction local nextTick = t() + self.Interval self._runHandle = self.UpdateSignal:Connect(function() local now = t() if now >= nextTick then nextTick = now + self.Interval self.Tick:Fire() end end) end function Timer:_startTimerNoDrift() assert(self.Interval > 0, "Interval must be greater than 0 when AllowDrift is set to false") local t = self.TimeFunction local n = 1 local start = t() local nextTick = start + self.Interval self._runHandle = self.UpdateSignal:Connect(function() local now = t() while now >= nextTick do n += 1 nextTick = start + (self.Interval * n) self.Tick:Fire() end end) end
--Weld stuff here
car.DriveSeat.ChildAdded:connect(function(child) if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then child.C0=CFrame.new(0,1,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0)*CFrame.Angles(math.rad(13),0,0) child.C0=CFrame.Angles(-1.55,0,0) end end)
--Categorises a model based on the location of the start and end points of the path in the model
function RoomPackager:CategoriseModel(pathModel) if pathModel:FindFirstChild("EndParts") then return game.ReplicatedStorage.PathModules.Branch elseif pathModel.Start.Position.Y < pathModel.End.Position.Y - 5 then return game.ReplicatedStorage.PathModules.GoingUp elseif pathModel.Start.Position.Y > pathModel.End.Position.Y + 5 then return game.ReplicatedStorage.PathModules.GoingDown else return game.ReplicatedStorage.PathModules.SameHeight end end local function addBehavioursRecur(model, behaviourFolder) local children = model:GetChildren() for i = 1, #children do if children[i]:isA("BasePart") then behaviourFolder:Clone().Parent = children[i] else addBehavioursRecur(children[i], behaviourFolder) end end end RoomPackager.setUpBehaviours = function(roomModel) if roomModel:FindFirstChild("Behaviours") then addBehavioursRecur(roomModel, roomModel.Behaviours) return end local children = roomModel:GetChildren() for i = 1, #children do RoomPackager.setUpBehaviours(children[i]) end end local function processPart(roomModel, part, parts) if part.Parent == roomModel then return end if part.Name == "End" and roomModel:FindFirstChild("End") then local endsModel = Instance.new("Model") --Used for branching the path endsModel.Name = "EndParts" endsModel.Parent = roomModel part.Parent = endsModel roomModel:FindFirstChild("End").Parent = endsModel elseif part.Name == "End" and roomModel:FindFirstChild("EndParts") then part.Parent = roomModel:FindFirstChild("EndParts") elseif part.Name == "End" then part.Parent = roomModel else local topLevelParent = closestParentToWorkspace(part, roomModel) if topLevelParent ~= nil then if topLevelParent:isA("BasePart") then local connectedParts = topLevelParent:GetConnectedParts(true) for _, connectedPart in pairs(connectedParts) do if connectedPart.Name == "End" then table.insert(parts, connectedPart) else local conTopLevelParent = closestParentToWorkspace(connectedPart, roomModel) if conTopLevelParent and conTopLevelParent ~= topLevelParent then conTopLevelParent.Parent = roomModel end end end end topLevelParent.Parent = roomModel end end end function RoomPackager:PackageRoom(roomBasePlate) local roomModel = Instance.new("Model") roomModel.Name = "Path" roomModel.Parent = game.ReplicatedStorage.PathModules local regions = self:RegionsFromBasePlate(roomBasePlate) for i = 1, #regions do --Repeatedly finds 100 parts in the region until none are left while true do local parts = game.Workspace:FindPartsInRegion3(regions[i], nil, 100) if #parts == 0 then break end for _, part in pairs(parts) do processPart(roomModel, part, parts) end end end --Set-up model for use in the path (parts for locating the path are made transparent) roomBasePlate.Transparency = 1 roomBasePlate.Parent = roomModel roomModel:FindFirstChild("Start", true).Parent = roomModel roomModel:FindFirstChild("Start", true).Transparency = 1 if roomModel:FindFirstChild("EndParts") then local ends = roomModel:FindFirstChild("EndParts"):GetChildren() for i = 1, #ends do ends[i].Transparency = 1 end else roomModel.End.Transparency = 1 end roomModel.PrimaryPart = roomBasePlate roomModel.Parent = self:CategoriseModel(roomModel) RoomPackager.setUpBehaviours(roomModel) return roomModel end return RoomPackager
--[[Engine]]
--Torque Curve Tune.Horsepower = 180 -- [TORQUE CURVE VISUAL] Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf Tune.PeakRPM = 5500 -- Use sliders to manipulate values Tune.Redline = 6000 -- Copy and paste slider values into the respective tune values Tune.EqPoint = 5500 Tune.PeakSharpness = 7.5 Tune.CurveMult = 0.16 --Incline Compensation Tune.InclineComp = 1.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees) --Misc Tune.RevAccel = 150 -- RPM acceleration when clutch is off Tune.RevDecay = 75 -- RPM decay when clutch is off Tune.RevBounce = 500 -- RPM kickback from redline Tune.IdleThrottle = 3 -- Percent throttle at idle Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)