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)
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.
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:
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.
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.