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

Help with making a simple script? [RESOLVED via adark] [TY adark]

So I am trying to make this brick disappear at random intervals, but idk what to do, because I am a horrible scripter. Any help? Script thus far:

wait(math.random)
script.Parent.Transparency=1
wait(math.random)
script.Parent.Transparency=0

I am trying to make it to reappear randomly and repeat. Can someone help me?

1 answer

First, put this in an infinite while loop.

Next, choose what you want the minimum time to wait and the maximum time to wait between it vanishing and reappearing.

local maxTime = 2 --in seconds
local minTime = 0

while true do
	wait(math.random()*(maxTime-minTime)+minTime)
	script.Parent.Transparency = 1
	wait(math.random()*(maxTime-minTime)+minTime)
	script.Parent.Transparency = 0
end

2 comments

2

Doing this won't limit the wait time to integers:     wait(math.random()*(maxTime-minTime)+minTime)

0

Forgot about that bit. I'll edit it into my answer.

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