Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Animation script not working?

Asked by 8 years ago

Hey i want to know what is the error in this script? Its supposed to play an animation when u press k, i tried both in studio, both in game to press the k button but no animation played. Maybe im typing in ID, wrong?

local player = game.Players.LocalPlayer
local char = game.Workspace:WaitForChild(player.Name)
local humanoid = char:WaitForChild("Humanoid")
local animation = Instance.new("Animation", player)
animation.AnimationId = "296883490" -- ex http.robloxblahblah
local animTrack = humanoid:LoadAnimation(animation)
local uis = game:GetSerice("UserInputService")
uis.InputBegan:connect(function(key)
    if key.KeyCode == Enum.KeyCode.K then
        animTrack:Stop()
        animTrack:Play()
    end 
end)

Answer this question