Simple script isnt working

idk i didnt sleep for a long time so i even cant do a simple script,
the script is adding value, but when it is < 29 it doesnt decrease and fire event

while true do
	script.Parent.Value = script.Parent.Value + 1
	print(script.Parent.Value)
	wait (1)
end

if script.Parent.Value < 29 then
	script.Parent.Value = 0
	script.Parent.Parent.LEVELUP:Fire()
end

You need to put the If statement inside the while loop. The script you have written will keep on increasing the value forever but the if statement is never run.

	if script.Parent.Value < 29 then
		script.Parent.Value = 0
		script.Parent.Parent.LEVELUP:Fire()
	end
	script.Parent.Value = script.Parent.Value + 1
	print(script.Parent.Value)
	wait (1)
end
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.