Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Chakra Charge Error ? Charging a PowerBar

I have a bar and I made a script for charging it but I don't get why everytime I die it says

17:33:53.017 - LoadAnimation requires the Humanoid object (Player1.Humanoid) to be a descendant of the game object

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local playerChar = Player.Character or Player.CharacterAdded:wait()
local playerHum = playerChar:WaitForChild("Humanoid")

local anim = Instance.new("Animation")
anim.AnimationId = 'rbxassetid://802123529'

repeat wait() until playerHum ~= nil
loadanim = playerHum:LoadAnimation(anim)


Mouse.KeyDown:connect(function(Key)
if Key == "c" then
local ef = script.ChakraEffe:Clone()
ef.Parent = playerChar.UpperTorso
ef.Name = "Effect"
loadanim:Play()
playerHum.WalkSpeed = 0
script.Charging.Value = false
script.Charging.Value = true
end
end)

Mouse.KeyUp:connect(function(Key)
if Key == "c" then
loadanim:Stop()
playerHum.WalkSpeed = 16
script.Charging.Value = false
playerChar.UpperTorso:FindFirstChild("Effect"):Destroy()
if playerChar.UpperTorso:FindFirstChild("Effect") then
playerChar.UpperTorso.Effect:Destroy()
end
end
end)

Any Solution ? I can't find the problem it's running good and then when I die it says that error on the top .

1 answer

You're not putting the script into StarterCharacterScripts. This script needs to be a localscript as well. Also, make sure that the animation that you are playing is a group animation or yours.

This discussion is preserved as it was. New answers, comments, and votes are closed.