Well, as per the script below it should disable animation if value is false, but it doesn’t disable animation and I don’t know how to fix it.
local taken = script.Parent:FindFirstChild("Taken")
local char = script.Parent.Parent
script.Parent.Taken:GetPropertyChangedSignal("Value"):Connect(function()
local Anim = script.Parent:FindFirstChild("Animation")
local animloader = char.Humanoid:LoadAnimation(Anim)
if taken.Value == true then
taken.Value = true
animloader:Play()
elseif taken.Value == false then
taken.Value = false
animloader:Stop()
end
end)
I’m not sure if you meant to make it true after it being true, but that’s probably where the issue is.
I already tried but it doesn’t work so I have no idea how to fix it
Try referencing the loaded animation outside of the function.
local taken = script.Parent:FindFirstChild("Taken")
local char = script.Parent.Parent
local animloader = char:WaitForChild("Humanoid"):LoadAnimation(script.Parent.Animation)
script.Parent.Taken:GetPropertyChangedSignal("Value"):Connect(function()
if taken.Value == true then
taken.Value = true
animloader:Play()
elseif taken.Value == false then
taken.Value = false
animloader:Stop()
end
end)
1 Like
I tried it a minute before you commented and it worked, thanks anyway