Dash script not working

i was trying out some dash scripts and came across this one, though it doesnt seem to be working (theres an animation inserted already but ill make my own once i know it works.


local plr = game.Players.LocalPlayer
local Char = plr.Character or plr.CharacterAdded:Wait()
local UserInputService = game:GetService("UserInputService")

local Tapped = false
local Time = 0.3 

UserInputService.InputBegan:Connect(function(Input, GameStuff)
   if GameStuff then return end
   if Input.Keycode == Enum.KeyCode.W then 
           if not Tapped then
                   Tapped = true
                   wait(Time)
                   Tapped = false
                else
                  Char.HumanoidRootPart.Velocity = Char.HumanoidRootPart.CFrame.lookVector*400 
                  local Animation = Player.Character:FindFirstChild("Humanoid"):LoadAnimation(script.TĂȘnAnimationmĐáș·t) 
                  Animation:Play() 
          end
     end
 end)

Is this in a local script or server script?

1 Like

why not just make this a Character script and recode it to work for it being in a character model in workspace?

@ImTheBuildGuy local.
@ezekieltem because i dont want a npc to dash but all players joining the game need to be able to dash

As this is clearly a client-sided script, you’ve to send a message to a server-script so the animation actualy plays for every player.

1 Like

can you insert the script? i dont understand really well

Just do research on:

  • Server and Client,
  • Remove Events and Remove Functions

i cant really script? can you tell me what to do with the script? i thought this would work

Here:

if Input.Keycode == Enum.KeyCode.W then

Keycode is typed wrong, c must be UpperCase, like this:

if Input.KeyCode == Enum.KeyCode.W then

These are the most annoying errors to find :sweat_smile:

2 Likes

Starter Character dups anything in it and puts it in the new players character and it is under starter player so only players will have it

so what does this mean? does the script change or location of script

It means that as soon as a character from a player spawns, the script will be put inside it. If you want the script to fire everytime a character spawns, put it inside StarterCharacterScripts, but if you want to fire it once a player joins the game, put it on StarterPlayerScripts.

I recommend putting it inside StarterCharacterScripts too, because you have assigned the character variable at the beggining of the code, and if your char dies and respawns the variable wont change (which will result in an error when it calls char again), unless you code it so when a character spawns it resets the char variable, which is just extra coding in my opinion.

1 Like

it still doesnt work? should i try changing locations its currently in starterpack

Well, I copied and pasted it like this and it worked:

local plr = game.Players.LocalPlayer
local Char = plr.Character or plr.CharacterAdded:Wait()
local UserInputService = game:GetService(“UserInputService”)

local Tapped = false
local Time = 0.3

UserInputService.InputBegan:Connect(function(Input, GameStuff)
if GameStuff then return end
print(Input)
if Input.KeyCode == Enum.KeyCode.W then
if not Tapped then
Tapped = true
wait(Time)
Tapped = false
else
Char.HumanoidRootPart.Velocity = Char.HumanoidRootPart.CFrame.lookVector*400
–local Animation = Player.Character:FindFirstChild(“Humanoid”):LoadAnimation(script.TĂȘnAnimationmĐáș·t)
–Animation:Play()
end
end
end)

Maybe the animation part gives errors? I turned it off because i didn’t have animations to play.

Yes it was the animation part. The “Player” variable used when playing animation isn’t even set, there is a plr variable instead, so just change Player.Character with plr.Character or Char and it will work.
Here is my test with a golf animation I made:

Ok in the explorer there will be StarterPlayer. In that there will be StarterCharacter put it in StarterCharacter

Okay so, I entered my custom animation Asset ID in the animation thing inside the script (in script I have a animation part thingy) so what are ur locations?

It’s inside the script, but that animation name you used contain some weird letters (TĂȘnAnimationmĐáș·t) that i think roblox didn’t understand. So put a simpler name on the animation and change the name on the script code also.

1 Like

I’ll change it to the real animation parts name hopefully it works

Animations replicate to all players from the client already. Using remotes to play the animation on the server would just make it less smooth and/or delayed for the player.

2 Likes