Hi what im trying to do is make a countdown to when the cube starts spinning
When i tried a fix i thought of it didnt work (probably because i wrote it in js lol)
This is the code i have
while wait(60) do
script.Text.Value = "Cube is spinning, avoid all calamities coming across your way."
wait(3)
script.Text.Value = "Cube is spinning."
for _ = 0, (40*4) * 3 do
wait()
script.Parent.PrimaryPart.CFrame = script.Parent.PrimaryPart.CFrame * CFrame.fromEulerAnglesXYZ(math.rad(0.1 ), math.rad(0.1 ), math.rad(0.1 ))
end
script.Text.Value = "Cube starts spinnin in 60 seconds"
end
Replace the while wait(60) do with while true do and run the countdown inside the loop instead.
while (true) do
script.Text.Value = "Cube is spinning, avoid all calamities coming across your way."
wait(3)
script.Text.Value = "Cube is spinning."
for _ = 0, (40*4) * 3 do
wait()
script.Parent.PrimaryPart.CFrame = script.Parent.PrimaryPart.CFrame * CFrame.fromEulerAnglesXYZ(math.rad(0.1 ), math.rad(0.1 ), math.rad(0.1 ))
end
for i = 60, 1, -1 do
script.Text.Value = "Cube starts spinning in "..i.." seconds."
wait(1)
end
end
Also, using a yielding function inside the condition of the while loop is a bad habit to learn. you can read about it here: