if game.Loaded:Connect() while wait(1) do script.Parent.Value = script.Parent.Value - 1 end if script.Parent.Value == 0 then script.Disabled = true end
ok first of all, to add to your knowledge of scripting, you can increment or un increment using
script.Parent.Value += 1 --or script.Parent.Value -= 1
its easier, second, loook for any errors in your code and try your best to figure it out and only poste on this website as a last resort, many people here post without looking up the answer and its so painfully obvious that posting a question that has litteraly 600 results if oyu type the word is jsut annoying. anyway, i see a few problems here.
You have 2 if statments, and i only see 1 end.there should be another end after the last end so everything runs if the game is loaded.
Also, the if statement that checks to see if the value is 0 only runs one time, its not inside of any loop, so it wont work, you should put it inside the while loop so it checks the value and then adds 1 if its not 0, and if it is 0, then it disables the script, you can use elseif for that:
while wait(1) do--1 if script.Parent.Value == 0 then--2 script.Disabled = true elseif script.Parent.Value > 0 then script.Parent.Value = script.Parent.Value - 1 end---2// end--1//
So if im not mistaken, basically you forgot an end, and you placed the if in the wrong place, your code should be this:
if game.Loaded:Connect() --1 while wait(1) do --2 if script.Parent.Value <= 0 then --3 script.Disabled = true elseif script.Parent.Value > 0 then script.Parent.Value = script.Parent.Value - 1 end ---3// end --2// end --1//
btw i use --1, --1// as reminders (// means closed so i put it at the end of a function or loop) so i dont lose track of what end goes to what function, its easier to keep track of code, also i space out my code a lot to make it more readable, i suggest these things to speed up your coding and make it easier. i hope this is helpful