scripthubzz

Scripter Role

Aug 4th, 2021
852
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local RS = game:GetService("ReplicatedStorage")
  2. local ServerRemote = RS:WaitForChild("RemoteEvents"):WaitForChild("Server")
  3.  
  4. -- || Configurations || --
  5.  
  6. local MaxEXPPerLevel = 1.8 -- || Amount multiplied of the max exp value per level up ||
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18. game.Players.PlayerAdded:Connect(function(player)
  19.     local RS = game:GetService("ReplicatedStorage")
  20.     local Trails = RS:WaitForChild("Trails")
  21.    
  22.    
  23.    
  24.     local Data = Instance.new("Folder", player)
  25.     Data.Name = "Data"
  26.    
  27.     local Level = Instance.new("IntValue", Data)
  28.     Level.Name = "Level"
  29.     Level.Value = 0
  30.    
  31.    
  32.     local Stamina  = Instance.new("IntValue", Data)
  33.     Stamina.Name = "Stamina"
  34.     Stamina.Value = 100
  35.    
  36.    
  37.     local IsRunning = Instance.new("BoolValue", Data)
  38.     IsRunning.Name = "IsRunning"
  39.     IsRunning.Value = false
  40.    
  41.     IsRunning.Changed:Connect(function(value)
  42.        
  43.         spawn(function()
  44.             while value == true do
  45.                 wait(3)
  46.                 Stamina.Value -= 10
  47.             end
  48.         end)
  49.        
  50.     end)
  51.    
  52.    
  53.     local MaxEXP = Instance.new("IntValue", Data)
  54.     MaxEXP.Name = "MaxEXP"
  55.     MaxEXP.Value = 100
  56.    
  57.     local EXP = Instance.new("IntValue", Data)
  58.     EXP.Name = "EXP"
  59.     EXP.Value = 0
  60.    
  61.     local MaxSpeed = Instance.new("IntValue", Data)
  62.     MaxSpeed.Name = "MaxSpeed"
  63.     MaxSpeed.Value = 60
  64.    
  65.     MaxEXP.Changed:Connect(function(MaxEXPnum)
  66.         if EXP >= MaxEXPnum then
  67.             MaxEXP.Value *= MaxEXPPerLevel
  68.             EXP.Value = 0
  69.         end
  70.     end)
  71.    
  72.    
  73.    
  74.    
  75.    
  76.    
  77.    
  78.    
  79.     player.CharacterAdded:Connect(function(char)
  80.         local HRP = char:WaitForChild("HumanoidRootPart")
  81.         local Head = char:WaitForChild("Head")
  82.        
  83.         local Running = Instance.new("Sound", HRP)
  84.         Running.Name = "Running"
  85.         Running.SoundId = "rbxassetid://4738483700"
  86.         Running.Volume = 6
  87.         Running.Looped = true
  88.        
  89.         local StartRun = Instance.new("Sound", HRP)
  90.         StartRun.Name = "StartRun"
  91.         StartRun.SoundId = "rbxassetid://558640653"
  92.         StartRun.Volume = 0.3
  93.         StartRun.RollOffMinDistance = 20
  94.        
  95.        
  96.         local AttachmentTop = Instance.new("Attachment", Head)
  97.         AttachmentTop.Position = Vector3.new(0, 0.265, 0.515)
  98.        
  99.         local AttachmentBottom = Instance.new("Attachment", Head)
  100.         AttachmentBottom.Position = Vector3.new(0, -2.440, 0.470)
  101.        
  102.        
  103.        
  104.        
  105.         local Trail1Clone = Trails:WaitForChild("Orange"):Clone()
  106.         Trail1Clone.Enabled = false
  107.         Trail1Clone.Parent = Head
  108.         Trail1Clone.Attachment0 = AttachmentTop
  109.         Trail1Clone.Attachment1 = AttachmentBottom
  110.        
  111.         local Trail2Clone = Trails:WaitForChild("Yellow"):Clone()
  112.         Trail2Clone.Enabled = false
  113.         Trail2Clone.Parent = Head
  114.         Trail2Clone.Attachment0 = AttachmentTop
  115.         Trail2Clone.Attachment1 = AttachmentBottom
  116.        
  117.        
  118.     end)
  119. end)
  120.  
  121.  
  122.  
  123.  
  124. ServerRemote.OnServerEvent:Connect(function(Player, task)
  125.     local Data = Player:WaitForChild("Data")
  126.    
  127.     local Character = Player.Character or Player.CharacterAdded:Wait()
  128.     local HRP = Character:WaitForChild("HumanoidRootPart")
  129.    
  130.     local Trail1 = Character:WaitForChild("Head"):WaitForChild("Orange")
  131.     local Trail2 = Character:WaitForChild("Head"):WaitForChild("Yellow")
  132.     local RunSound = HRP:WaitForChild("Running")
  133.     local startRunSound = HRP:WaitForChild("StartRun")
  134.     local DashEffect = RS:WaitForChild("VFX"):WaitForChild("DashEffect")
  135.    
  136.  
  137.     local turnOffSpeed = coroutine.create(function()
  138.         while wait() do
  139.             if Data:WaitForChild("Stamina").Value < 0 then
  140.                     Data:WaitForChild("IsRunning").Value = false
  141.                     Trail1.Enabled = false
  142.                     Trail2.Enabled = false
  143.                     local FOV = game:GetService("TweenService"):Create(workspace.CurrentCamera, TweenInfo.new(0.7, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {FieldOfView = 70})
  144.                     FOV:Play()
  145.  
  146.                     Character:WaitForChild("Humanoid").WalkSpeed = 16
  147.                
  148.                     RunSound:Stop()
  149.             end
  150.         end
  151.     end)
  152.    
  153.    
  154.    
  155.     if task == "BoostSpeed" and Data:WaitForChild("Stamina").Value < 0 then
  156.         Data:WaitForChild("IsRunning").Value = true
  157.        
  158.         Trail1.Enabled = true
  159.         Trail2.Enabled = true
  160.        
  161.          Character:WaitForChild("Humanoid").WalkSpeed = Data:WaitForChild("MaxSpeed").Value
  162.        
  163.         local DashClone = DashEffect:Clone()
  164.         DashClone.Parent = workspace
  165.         DashClone.CFrame = HRP.CFrame
  166.         local Orientation = Player.Character.Head.Orientation.Y
  167.         DashClone.Orientation = Vector3.new(90,Orientation,0)
  168.        
  169.         RunSound:Play()
  170.         startRunSound:Play()
  171.        
  172.         coroutine.resume(turnOffSpeed)
  173.         wait(0.7)
  174.         coroutine.yield()
  175.        
  176.        
  177.     elseif task == "BoostOff" then
  178.         Data:WaitForChild("IsRunning").Value = false
  179.         Trail1.Enabled = false
  180.         Trail2.Enabled = false
  181.        
  182.         RunSound:Stop()
  183.        
  184.         coroutine.yield()
  185.        
  186.  
  187.        
  188.  
  189.        
  190.     end
  191. end)
RAW Paste Data