Hello
I am wondering why my game crashes for this code i have it to stop at 10 but when it reaches 10 it just lags then says “roblox cant respond” then will never load again
I don’t see anything wrong with this
Thank you
Hello
I am wondering why my game crashes for this code i have it to stop at 10 but when it reaches 10 it just lags then says “roblox cant respond” then will never load again
Thank you
if its a loop then its because there’s no wait.
You need to put wait() because is a loop and is looping every time the part…
How is this a loop? if
is a statement, if you look at the source code closely, it’s an if
statement, not a loop.
Also why are you encouraging wait()?
Is this the entirety of the code? If so, I see no reason it should crash.
If, however, this code is supposed to be part of a loop, I see the problem. On line 8, I think you’re trying to “end” the loop. In Lua, the “end” keyword is used to denote the end of a scope, that is, the portion of the code between the “then” keyword and the “end” keyword. Since there is no code there, nothing happens when x reaches 10.
What you might do instead is to add the keyword “break” if this is a loop, or “return” if it’s inside a function.
The code at line 8 would then look like this:
if x == 10 then break end
assuming from his statement how will x overcome 100
it should be a loop unless there’s another script editing that x out i don’t see the reason for it
yea you have to add wait when you’re looping or else that’ll crash you
you threw too many unnecessary words in there do this
local Count = 1
while wait() do
if Count >= 10 then break end
Count += 1
end
Or
local RunService = game:GetService("RunService")
RunService.Heartbeat:Wait()
If you need them to be more precise without stopping at server work ups.