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

The animation is not working and the points are not adding up in leaderstats! Can anyone help me?

Asked by 3 years ago
Edited 3 years ago
local tool = script.Parent.Parent

game.ReplicatedStorage.Eat.OnServerEvent:Connect(function()
    local char = script.Parent.Parent.Parent
    local plr = game.Players:GetPlayerFromCharacter(char)
    local animation = char.Humanoid:LoadAnimation(script.Parent.EatAnimation)
    animation:Play()
    plr.leaderstats.Fat.Value = plr.leaderstats.Fat.Value + 1
    wait(1)
end)

How would I fix this? The bug is that the animation will not play the error is.

ServerScriptService.EatScript:6: attempt to index nil with 'Humanoid'  -  Server  -  EatScript:6

Answer this question