Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 2 years ago

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

Log in to vote
0
Answered by 2 years ago

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!

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 robloxplayer1555551 4 — 2y
0
the break does not have to be like a function just break not break(). fsadsafdsfsf 15 — 2y
0
I forgot to tell i didn't actually use break() and that i got the code working robloxplayer1555551 4 — 2y
Ad

Answer this question