Basically what i'm doing is making 2 models, and each time I click one model goes transparent and the other appears, and vice versa. But I can't get it to work properly.
function onClicked()
open = false
if open == false
then game.Workspace.Model.Open.Properties.Transparency = 1
game.Workspace.Model.Open.Properties.CanCollide = false
game.Workspace.Model.Close.Properties.Transparency = 0
game.Workspace.Model.Close.Properties.Cancollide = true
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)

6 comments
It works, but I want it to share one click-detector instead of 2 seperate ones, how would I do that? I tried to do this.
TrunkOpened = false function onClicked() if not TrunkOpened then script.Parent.Parent.Parent.Close.Part1.Transparency = 1 script.Parent.Parent.Parent.Close.Part2.Transparency = 1 script.Parent.Parent.Parent.Close.Part1.CanCollide = false script.Parent.Parent.Parent.Close.Part2.CanCollide = false TrunkOpened = true elseif TrunkOpened then script.Parent.Parent.Parent.Open.Part1
I'm not the most advanced scripter, and I'm not entirely sure it's possible in this instance. You want a trunk in which transfers parts, and to do so you'd need a ClickDetector for each part used. One to open the trunk and another to close.
I've modified the script in my answer to your specifications. You should only need a clickdetector in the 'Open' part this time.
So they share one clicker?
Should do, the only ClickDetector should now be in the part "Open.", if this answers your question, please mark this as "answered."