How can i make it so when i click a block a different block disappears and i can walk through it
Thanks, Coopcal2
How can i make it so when i click a block a different block disappears and i can walk through it
Thanks, Coopcal2
Assuming that you want to click a block with a click detector First
-Add a click detector to the part that youd like to click and and name it "Button"
-Name the part youd like to go transparent "Door"
After that you can use this (Add this script to the inside of a model including the button and the door.)
--Variables
local Button = script.Parent.Button.ClickDetector
local Door = script.Parent.Door
local TransparencyVar = .6
local DoorOpeningTime = 5
--Transparency can but set inside of the event but for simplicitys sake we'll have a variable for it. Transparency can be from 0 to 1, 1 being completely transparent, 0 being not at all transparent.
--The same goes for DoorOpeningTime, but the number is in seconds of how long youd like to wait.
Button.MouseClick:Connect(function()
Door.Transparency = TransparencyVar
--Uses the Transparency variable we defined earlier
Door.CanCollide = false
wait(DoorOpeningTime)
--Uses the Delay we set earlier of 5 seconds.
Door.Transparency = 0
Door.CanCollide = true
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
DO i add the script to both the door and button?