#I have a problem with my script can anyone help please
13 messages · Page 1 of 1 (latest)
The code is not working because you are using the math.floor() function incorrectly. The math.floor() function rounds a number down to the nearest integer. In your code, you are trying to use the math.floor() function to round a number down to the nearest multiple of 60. However, the math.floor() function does not have a parameter that allows you to specify the multiple to which you want to round the number.
To fix this problem, you can use the math.mod() function to find the remainder when a number is divided by 60. Then, you can subtract the remainder from the number to get the nearest multiple of 60. For example, if the number is 123, the remainder when it is divided by 60 is 3. So, the nearest multiple of 60 is 120.
So it doesn’t check after the stack passed it on the start of the script
Here is the fixed code:
rs = game.ReplicatedStorage
timeleft = rs.TimeLeft
minutes = rs.Minutes
seconds = rs.Seconds
timeleft.Value = 20
if timeleft.Value == 0 then
wait(5)
timeleft.Value = 20
end
for i = timeleft.Value, 0, -1 do
timeleft.Value = i
minutes.Value = math.floor(i / 60)
seconds.Value = math.fmod(i, 60)
wait(1)
end
That still doesn’t make the stack reach the if else when the timer reaches 0🤷♂️
oh yeah
bruh
wait
rs = game.ReplicatedStorage
timeleft = rs.TimeLeft
minutes = rs.Minutes
seconds = rs.Seconds
timeleft.Value = 20
for i = timeleft.Value, 0, -1 do
if timeleft.Value == 0 then
wait(5)
timeleft.Value = 20
end
timeleft.Value = i
minutes.Value = math.floor(timeleft.Value / 60)
seconds.Value = math.floot(timeleft.Value % 60)
wait(1)
end
;-;
i'm so good at coding ;-;
LMAO
rs = game.ReplicatedStorage
timeleft = rs.TimeLeft
minutes = rs.Minutes
seconds = rs.Seconds
while wait(5) do
timeleft.Value = 20
for i = timeleft.Value, 0, -1 do
timeleft.Value = i
minutes.Value = math.floor(timeleft.Value / 60)
seconds.Value = math.floor(timeleft.Value % 60)
wait(1)
end
end