ok so i want when they touch the part it dissappers then after it waits 20 it reappers?
Heres what i tried im not that good with scripting
while true do
onTouch()
part.Brick.Transperancy = 0
wait(20)
end
ok so i want when they touch the part it dissappers then after it waits 20 it reappers?
Heres what i tried im not that good with scripting
while true do
onTouch()
part.Brick.Transperancy = 0
wait(20)
end
You need to use the Touched event to detect when an object is touched! You also want to check if it's a player! One last thing, there is no need for a loop! Just use a debounce.
debounce = false
script.Parent.Touched:connect(function(hit) -- Goes directly into the part
if hit.Parent and game.Players:GetPlayerFromCharacter() and debounce == false then
debounce = true
script.Parent.Transparency = 1 -- 1 is invisible!
wait(20)
debounce = false
script.Parent.Transparency = 0
end
end)
You need to define a function.
function onTouch()
script.Parent:Destroy()
wait(20)
end
script.Parent.Touched:connect(onTouch)
also, use Destroy(). Transparency just makes it invisible.
Hope this helped.
-ds
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
He also wanted it to reappear, don't forget that!
Sorry.