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

How do I make a brick disappear when touched and reappear at a chosen time?

Asked by 6 years ago

When a player steps on the brick it disappears then after the selected time passes it becomes visible again.

3 answers

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

Try this script

function onTouched(hit)
    script.Parent.Transparency=1 -- Make sure the script is in the part you want to make disappear
    script.Parent.CanCollide = false

    wait(5) -- For this example, I will use 5 seconds change 5 to the number of seconds you want to wait

    script.Parent.Transparency=0
    script.Parent.CanCollide = true
end

script.Parent.Touched:connect(onTouched)
0
Im having a similar problem except i need an onclick script. Can you translate this script into onclick instead of ontouch please earlgrey2014 -4 — 6y
0
Earlgrey2014 I have the script I converted can you create a question so I can give the script to you? MasonTheCreeperYT3 74 — 6y
0
My part wont disappear can anyone help please? NostxIgic -3 — 5y
0
This code worked great for me. I also added wait(1) before setting Transparency to 1. That gives the player a chance to step on the part and keep moving like if they were crossing a bridge-like platform Papas_Pringles 0 — 5y
View all comments (2 more)
0
some ppl here doesnt know how to script, they only know to copy and paste kingslayer1385 15 — 3y
0
the script is in my answer, all u need to do is just change the (onTouch) => (onClick) if u didnt know this, u need to learn how to script instead of copy pasting kingslayer1385 15 — 3y
Ad
Log in to vote
0
Answered by 6 years ago

Thank you, my blocks are disappearing perfectly fine, but I have a problem specific to my game. The blocks are taking like 5+ seconds to respawn. How do I change that?

0
it is taking that long to respawn because it is set at wait 5 seconds which is the wait(5) if you want it to respawn faster just change it. MrBillyBobYT 0 — 5y
0
Wow I overlooked that, sorry. Papas_Pringles 0 — 5y
Log in to vote
0
Answered by 3 years ago
Edited 3 years ago
    function onTouched(hit)
        script.Parent.Transparency=1 -- Make sure the script is in the part you want to make disappear
        script.Parent.CanCollide = false

    wait(5) -- For this example, I will use 5 seconds change 5 to the number of seconds you want to wait

        script.Parent.Transparency=0
        script.Parent.CanCollide = true
    end

    script.Parent.Touched:connect(onClick)

Answer this question