Hello Developers, I need some help with scripting this animation. I’m currently working on a new simulator game, and I’m using the script here in my game. But the script does not work, and I need some help.
THE SCRIPT
local player = game.Players.LocalPlayer
script.Parent.Activated:Connect(function()
if player.Debounce.Value == false then
game.ReplicatedStorage.RemoteEvents.Power:FireServer(script.Parent.Values)
local action = script.Parent.Parent.Humanoid:LoadAnnimation(script.Animation)
action:Play()
end
end)
The errors:
In the output section, it says that character IsaacUniverse_YT does not have humanoid or something. And im quite confused.
script.Parent.Activated:Connect(function()
if player.Debounce.Value == false then
game.ReplicatedStorage.RemoteEvents.Power:FireServer(script.Parent.Values)
Local char = player.Character
Local hum = char:WaitForChild("Humanoid")
Local animation = script.Animation
If hum then
Local action = hum:LoadAnimation(animation):Play()
end)
end)
script.Parent.Activated:Connect(function()
if player.Debounce.Value ~= true then
game.ReplicatedStorage.RemoteEvents.Power:FireServer(script.Parent.Values)
local humanoid = game.Players.LocalPlayer.Character:WaitForChild("Humanoid") -- Assuming it's a localscript
if humanoid then
local action = script.Parent.Parent.Humanoid:LoadAnimation(script.Animation)
action:Play()
end
end
end)