I tried doing it without the loop, but then it only did it once, I’m not sure why. So I tried the while true do, but now it will constantly play, any help is greatly appreciated!
while true do
if player.leaderstats.Stage.Value + 1 then
task.wait(0.4)
stagecounter.Parent.Sound:Play()
end
end
I saw that connecting a value to .Changed only passes through the new number that changed… Not an old and new value… ;-;
You can still use .Changed, but you’d need to keep track of the previous value somewhere, this is bad practice but this would be the example with the previous value being stored as a global in the script.
local previousValue = player.leaderstats.Stage.Value
player.leaderstats.Stage.Changed:Connect(function(newValue)
if newValue > previousValue then
stagecounter.Parent.Sound:Play()
end
end)