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

How to make a brick that will dissapear after 2 seconds AUTOMATICALLY?

Asked by 6 years ago
Edited 6 years ago

Well how would I make a script like that?

Is it editing this?

function onTouched() wait(2.0) script.Parent.Transparency = 1 script.Parent.CanCollide = false wait(5) script.Parent.Transparency = 0 script.Parent.CanCollide = true end

script.Parent.Touched:connect(onTouched)

I don't know,please help! I'm a Noob at Scripting!Don't hate!

(EDIT:)Just saying that I don't want it to Reappear!

0
Try saying "local function onTouched()" thesit123 509 — 6y

2 answers

Log in to vote
0
Answered by
Galicate 106
6 years ago
Edited 6 years ago

you can either make it invisible and impossible to collide with or you can simply delete it.

--Disappear
function onTouched()
script.Parent.Cancollide = false
script.Parent.Transparency = 1
end
script.Parent.Touched:connect(onTouched)
--Destroy
function onTouched()
script.Parent:Destroy()
end
script.Parent.Touched:connect(onTouched)
0
That works!I putted it with the script that @Aimarekin gived me! GruDru888 0 — 6y
Ad
Log in to vote
0
Answered by
Aimarekin 345 Moderation Voter
6 years ago

Write a script inside the block:

wait (2.0)
script.Parent.Destroy ()

This will AUTOMATICALLY delete it just after TWO SECONDS, so if you want to be deleted 2 seconds after something, you'll need to edit the script and get it into an event.

0
That works!I putted it with the script that @GalaxyFPS_Studios gived me! GruDru888 0 — 6y

Answer this question