Hey there! I am having a bit of a problem. You see, I have this tool that I need to play an animation when it is activated, but it doesnt seem to work. I asked the roblox “assistant”, but I feel as if it isnt 100% the best all the time.
script.Parent.Activated:Connect(function(player)
local hum = player.Character:WaitForChild("Humanoid")
local anim = hum:LoadAnimation(script:FindFirstChildOfClass("Animation"))
anim:Play()
end)
Maybe it’s because you put an argument in the Activated function, that function does not need the player argument there.
You could get the player in different ways, maybe try this:
local player= script.Parent.Parent.Parent
script.Parent.Activated:Connect(function()
print(player.Name)
local hum = player.Character:WaitForChild("Humanoid")
local anim = hum:LoadAnimation(script:FindFirstChildOfClass("Animation"))
anim:Play()
end)