I'm trying to make it so there's a sort of "Sleep bar" that gradually falls, and to regain it you have to sleep. The bar goes down, but it instantly goes all the way up, instead of slowly rising. Here's the snippet:
while script.Parent.Occupant ~= nil do repeat wait(.01) prog.Value = prog.Value + 0.000000000001 until prog.Value >= 0.5 end
Do this instead
if script.Parent.Occupant then for i = prog.Value, 5 do wait() prog.Value = tonumber('.' ..i) end end
that should work
You have a loop through a loop so I would get rid of one of those and make sure it is waiting longer because the way you have it set, it looks like it will fill pretty fast. I would do: local count = 0 while (there is somebody in the bed AND count <= 5) do wait() --To make sure the loop is slowed down count++ --Do something else end