How do I make a model disappear and reappear using ClickDetector? This is what I did on the first script, then the second script
function click() script.Parent.Parent["Moving Office Chair"].Transparency = 0.8 script.Parent.Parent["Moving Office Chair"].CanCollide = false script.Parent.ClickDetector.MouseClick:connect(click)
function click() script.Parent.Parent["Moving Office Chair"].Transparency = 0 script.Parent.Parent["Moving Office Chair"].CanCollide = true script.Parent.ClickDetector.MouseClick:connect(click)
I'm guessing it's the problem where ["Moving Office Chair"] is. Also, this is a model, not a part.
If it's a model, you'd need to use the GetChildren method and I'd recommend using a 'for' loop.
visible = true script.Parent.ClickDetector.MouseClick:connect(function() if visible == true then for i,v in pairs(script.Parent.Parent["Moving Office Chair"]:GetChildren()) do v.Transparency = 0.8 -- 1 is for completely invisible v.CanCollide = false visible = false end elseif visible == false then for i,v in pairs(script.Parent.Parent["Moving Office Chair"]:GetChildren()) do v.Transparency = 0 v.CanCollide = true visible = true end end end)
Recurse through the descendants of the model and set each part to transparent. You will need to check if each descendant is a Part, WedgePart... before you try to set the transparency to avoid errors. Plese see this page for information about recursion.