Slayer Tycoon (v1.3) Script | ROLL & RUN FIX

[ad_1]

Created by Fuu Dev

Features:

_G.rollStrength = 60
_G.runSpeed = 40

local debrisService = game:GetService("Debris")
local userInputService = game:GetService("UserInputService")
local contextActionService = game:GetService("ContextActionService")
local player = game.Players.LocalPlayer
local rollDebounce = true
local runDebounce = true
local runButtonLastPress = 1337

function roll()
   if rollDebounce then
       local character = player.Character or player.CharacterAdded:Wait()
       local humanoid = character:WaitForChild("Humanoid")
       local humanoidRoot = character:WaitForChild("HumanoidRootPart")
       local animator = humanoid:WaitForChild("Animator")
       local rollAnimation = script:WaitForChild("Animation")
       local rollSound = script:WaitForChild("Roll")
       local rollTrack = animator:LoadAnimation(rollAnimation)
       local bodyVelocity = Instance.new("BodyVelocity")
       
       rollDebounce = false
       bodyVelocity.MaxForce = Vector3.new(math.huge, 1000, math.huge)
    bodyVelocity.Velocity = (humanoidRoot.CFrame.lookVector * _G.rollStrength)
    bodyVelocity.Parent = humanoidRoot
    debrisService:AddItem(bodyVelocity, 0.5)
    rollTrack:Play()
    rollSound:Play()
    rollTrack.Stopped:wait()
    rollDebounce = true
   end
end

function getRunAnimation(character)
   local runAnimation = script:WaitForChild("RunAnim")
   local characterChildren = character:GetChildren()
   for index, part in ipairs(characterChildren) do
       if part:IsA("Tool") then
           if (part:FindFirstChild("IsBreath") or part.Name == "Dark Thunder Art" or part.Name == "Rooting Gun Art") then
               if (part.Name == "Sound Katanas" or part.Name == "Beast Katanas" or part.Name == "Rooting Gun Art") then
                   runAnimation = script:FindFirstChild("DualRunAnim")
               else
                   runAnimation = script:FindFirstChild("SlayerRunAnim")
               end
           else
               runAnimation = script:FindFirstChild("DemonRunAnim")
           end
       end
   end
   return(runAnimation)
end

function run()
   if runDebounce then
       local character = player.Character or player.CharacterAdded:Wait()
       local humanoid = character:WaitForChild("Humanoid")
       local humanoidRoot = character:WaitForChild("HumanoidRootPart")
       local runSound = script:FindFirstChild("Dash")
       local runAnimation = getRunAnimation(character)
       local animator = humanoid:WaitForChild("Animator")
       local track = animator:LoadAnimation(runAnimation)
       local particleClone = game.ReplicatedStorage.ModuleAssets:FindFirstChild("SprintParticle"):Clone()
       
       runDebounce = false
       track:Play()
       humanoid.WalkSpeed = _G.runSpeed
       particleClone.Parent = humanoidRoot
       particleClone.Enabled = true
       debrisService:AddItem(particleClone, 0.5)
       runSound:Play()
       wait(0.1)
       particleClone.Enabled = false
       while (humanoid.MoveDirection ~= Vector3.new(0, 0, 0)) do
           wait()
       end
       track:Stop()
       humanoid.WalkSpeed = 16
       runDebounce = true
   end
end

function replaceScript()
   local scripts = player.PlayerScripts
   local roll = scripts:FindFirstChild("Roll")
   local assets = roll:GetChildren()
   
   for index, asset in ipairs(assets) do
       asset.Parent = script
   end
   script.Name = "Roll"
   script.Parent = scripts
   contextActionService:UnbindAction("Roll")
   roll:Destroy()
end

function handleInput(userInput, gameProcessed)
   if not gameProcessed then
       if (userInput.KeyCode == Enum.KeyCode.Q) then
           spawn(roll)
       elseif (userInput.KeyCode == Enum.KeyCode.W) then
           if ((tick() - runButtonLastPress) <= 0.25) then
               spawn(run)
           end
           runButtonLastPress = tick()
       end
   end
end

replaceScript()
userInputService.InputBegan:Connect(handleInput)

ENJOY!

Warning: DO NOT DOWNLOAD anything from this page, you’re only here to copy the script!

[ad_2]

123movies 123movie thesoap2day soap 2 day 123movies movies123 123movies