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

Chakra Charge Error ? Charging a PowerBar

Asked by 7 years ago
Edited 7 years ago

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

Log in to vote
0
Answered by 6 years ago

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.

Ad

Answer this question