Hello! I am Ruben and I need help with scripting.
Basically I made a script so when the player presses the “R” key on their keyboard an animation will play. I tried doing this with a random animation I found on toolbox (it was a climbing animation), it worked. Then I tried with my own animation, now it doesn’t work, everything is the same, just different animation id.
The script is a LocalScript placed in StarterPlayerScripts:
local userInputService = game:GetService("UserInputService")
-- Front Roll
userInputService.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.R then
local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local animation = script.Front_Roll
local track = humanoid:LoadAnimation(animation)
track:Play()
end
end)
This is the script. ^^