So I am trying to make a script that swings a knife when you click. Because the knife will interact with other players on the server, I thought I'd make it a serverscript. So I wrote the script along with the variables I'll need for animating. Getting the humanoid works, but the script fails to print "yay" (which is a placeholder for Track:Play() ) Does anyone know why this is happening? What can I do to fix it?
local hum = nil
script.Parent.Equipped:Connect(function()
hum = script.Parent.Parent:WaitForChild("Humanoid")
print(hum)
end)
local anim = Instance.new("Animation")
anim.Name = "KnifeAnim1"
anim.AnimationId = "http://www.roblox.com/asset/?id=4657391308"
local Track = hum:LoadAnimation(anim)
local PlayingAnimations = hum:GetPlayingAnimationTracks() -- I'll use this later to stop the other tracks
script.Parent.Activated:Connect(function()
print("yay")
end)

4 comments
Thanks for telling me! I wouldn't have realized that since I'm new to animating through scripts.
Np :)
Upvoted ;D
Ty :>