Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make machine stop randomly at specific point of script?

Hello anyone reading this, so i have a machine that i want to randomly stop for a bit at a specific point of the script. how could i do that? I tried with the math.random giving a number but didn't know how to continue. And also i accept if this post gets removed since i don't know if it breaks the guidelines or not.

1 answer

✓ Accepted answer

Hi, you can make some thing like this using the math.random() like this:

while true do
	local Chance = math.random(1,10) -- This will make like a 10% percent (you can change it)

	if Chance == 1 then
		break -- Makes the loop break or stop
	end

	-- Do other stuff
end 

Hope this worked!

3 comments

0

That is exactly what i was trying to do except when i try to put end after the function break() it says to end it twice and when i do that the script expects eof but i can't delete the else under it or it will not work. I really don't know what to do about it

0

the break does not have to be like a function just break not break().

0

I forgot to tell i didn't actually use break() and that i got the code working

This discussion is preserved as it was. New answers, comments, and votes are closed.