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

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

Asked by
Aezion 2
9 years ago

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?

Locked by 2eggnog, adark, and TofuBytes

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

1 answer

Log in to vote
2
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
9 years ago

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
Doing this won't limit the wait time to integers:     wait(math.random()*(maxTime-minTime)+minTime) 2eggnog 981 — 9y
0
Forgot about that bit. I'll edit it into my answer. adark 5487 — 9y
Ad