Hi,
How can i fix this animation script? Script located at npc’s model
local anim = game.ReplicatedStorage.NPCAnim1
local humanoid = script.Parent.Humanoid
local Track = humanoid:LoadAnimation(anim1)
if script.Parent.BoolValue.Value == true then
Track.Looped = true
Track:Play()
end
if script.Parent.BoolValue.Value == false then
Track.Looped = false
Track:Stop()
end
If statments only check once. Meaning if the value was false at the start of the game, and it changed to true it wouldn’t detect that it changed to true. You can use .Changed with the value object to check whenever the Value has changed.
script.Parent BoolValue.Changed:Connect(function()
if script.Parent.BoolValue.Value == true then
Track.Looped = true
Track:Play()
end
if script.Parent.BoolValue.Value == false then
Track.Looped = false
Track:Stop()
end
end)