Hey, I am having an issue with my script. It is supposed to give the player a stat whenever the animation that plays when they press C is currently playing, and when its not they stop getting currency. But whenever I run this script this error occurs,
Playing is not a valid member of AnimationTrack "Animation"
But I loaded the animation to the humanoid??? If anyone can help me it would mean a lot, the script is below.
local event = script.Parent
debounce = false
event.OnServerEvent:Connect(function(plr)
if debounce then return end
local Char = plr.Character
local Hum = Char:WaitForChild("Humanoid")
local HumRP = Char:WaitForChild("HumanoidRootPart")
local Chi = plr:WaitForChild("Stats"):WaitForChild("Chi")
debounce = true
local animation = Instance.new("Animation")
animation.AnimationId = 'rbxassetid://13216568439'
----------------------------------------------------------
local MeditateAnimation = Hum:LoadAnimation(animation)
MeditateAnimation:Play()
Hum:GetPropertyChangedSignal("MoveDirection"):Connect(function()
if Hum.MoveDirection.Magnitude > 0 then
MeditateAnimation:Stop()
end
end)
while MeditateAnimation.Playing do
Chi.Value = Chi.Value + 1
end
MeditateAnimation.Stopped:Wait()
wait(3)
debounce = false
end)