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

How do I make a script that makes a brick disappear for 5 seconds once you touch it?

Asked by 9 years ago

I want to make a door for a place that disappears when you touch it, but comes back after 5 seconds.

0
May we see your attempt? M39a9am3R 3210 — 9y

4 answers

Log in to vote
0
Answered by
Hybric 271 Moderation Voter
9 years ago

Script must be inside door

function onTouched(part)
if part.Parent:findFirstChild("Humanoid") then
script.Disabled = true
script.Parent.Transparency = 1
script.Parent.CanCollide = false
wait(5)
script.Disabled = false
script.Parent.Transparency = 0
script.Parent.CanCollide = true
end
end


script.Parent.Touched:connect(onTouched)
0
Disabling the script would stop it from continuing anymore. TopDev 0 — 9y
Ad
Log in to vote
0
Answered by
TopDev 0
9 years ago
function onTouch(hit)
    if hit.Parent then
        if hit.Parent:FindFirstChild('Humanoid') then
            script.Parent.Transparency = 1
            script.Parent.CanCollide = false
            wait(5)
            script.Parent.Transparency = 0
            script.Parent.CanCollide = true
        end
    end
end
script.Parent.Touched:connect(onTouch)

Log in to vote
0
Answered by 9 years ago
function onTouched(part)
if part.Parent:findFirstChild("Humanoid") then
script.Parent.Transparency = 1
script.Parent.CanCollide = false --I would use Vector3.new() becuase it will slide away and not become invisible
wait(5)
script.Parent.Transparency = 0
script.Parent.CanCollide = true
end
end

script.Parent.Touched:connect(onTouched)

Vector3.new(98,878,90909) will make it look a bit better, Ether way its your door or whatever you are making.

Log in to vote
-2
Answered by 9 years ago
function onTouch(hit)
    if hit.Parent then
        if hit.Parent:FindFirstChild('Humanoid') then
            script.Parent.Transparency = 1
            wait(5)
        end
    end
end
script.Parent.Touched:connect(onTouch)

Answer this question