Before I identify the problem, I do want to point out what I am trying to achieve- A hidden button that on touch makes a model (platform, in my case) appear and be able to be walked on, kind of like how the Roblox game-myth "Memories" works. I want this button to simply make it appear and to become unusable once the button has been activated, if that makes any sense. If I need to clarify anything, please let me know.
My current script:
bob = script.Parent.Parent.Part function onTouch(part) bob.Transparency = 0 bob.CanCollide = true end script.Parent.Touched:connect(onTouch)
The problem with it is that the script only allows me to spawn in individual parts and when I try to tell it to spawn in a model, it simply doesn't work.
Anyone know how to help?
Your problem is that Models cannot regulate transparency, nor set CanCollide to true/false. Instead of that, you should put this:
bob = script.Parent.Parent.Part function onTouch(part) for k,v in pairs(bob:GetChildren()) do v.Transparency = 0 v.CanCollide = true end end script.Parent.Touched:connect(onTouch)
This will get all parts in the Model, and turn their transparency to 0, and allow them to collide.
Hope it helps!