So I made a script with a clickdetector, where when an invisible part is clicked, it becomes visible. However, I’m having trouble with how to get the part to go back to being invisible when clicked again.
local clickDetector = script.Parent:WaitForChild("ClickDetector")
local door = game.Workspace["door"]
clickDetector.MouseClick:Connect(function()
door.Transparency = 0
task.wait(0.1)
end)
local ClickDetector = script.Parent:WaitForChild("ClickDetector")
local Door = workspace.door
local Open = false
ClickDetector.MouseClick:Connect(function()
if Open == false then
Open = true
Door.Transparency = 1
else
Open = false
Door.Transparency = 0
end
end)