My Dash script stops working after someone dies. How can I fix this?
I was testing this with a frend in the game, and we learned that the script works fine, until you die/reset, then you can't use the dash feature. Here's the script, could anyone tell me if I did something wrong here?
01 | local player = script.Parent.Parent |
03 | local char = player.Character or player.CharacterAdded:Wait() |
04 | local uis = game:GetService( "UserInputService" ) |
05 | local hum = char:WaitForChild( "Humanoid" ) |
07 | local anim = Instance.new( "Animation" ) |
11 | local SOUN = script:WaitForChild( "DashSound" ) |
13 | uis.InputBegan:Connect( function (input, istyping) |
14 | if istyping then return end |
15 | if input.KeyCode = = Enum.KeyCode.E then |
23 | local bv = Instance.new( "BodyVelocity" , char:WaitForChild( "HumanoidRootPart" )) |
24 | bv.MaxForce = Vector 3. new( math.huge , math.huge , math.huge ) |
25 | bv.Velocity = char:WaitForChild( "HumanoidRootPart" ).CFrame.LookVector * 85 |
26 | local playanim = hum:LoadAnimation(anim) |