A bit of context - my code is made so that when a intvalue in server storage is changed a huge event happens. However I have been finding that the code will not work unless the intvalue has already been changed and will not respond if the value is changed a second after. For example-
if game.ServerStorage.Folder.prep.Value == 1 then
game.ServerStorage.Folder.prep.Value = 0
if game.ServerStorage.Folder.prep.Value == 0 then
wait(5)
while true do
local origin = game.ReplicatedStorage.Face:Clone()
origin.Parent = game.Workspace.PArty.Sunflower
wait(0.05)
origin:Destroy()
end
The script above would work but it would stop if the first one waits for even one second. In conclusion my scripts only work if a value is changed before it starts its code. I would really appreciate it if someone could instruct or direct to function/code that could check for the value to change constantly. Thank you, any help/suggestions is appreciated.

2 comments
An error appears ,it says attempt to index field 'Value'(a number value)
delete the value