Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Button only spawning individual parts, not model?

Asked by 5 years ago

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?

0
model dont have transparent property so u have to iterate through all parts in model and change cancollide and transparecy property individually iiomqitzkinqnaenaexx 0 — 5y
0
What Im trying to do is have a model either already in workspace be set to transparency 0 and cancollide or something that does a similar job, if possible. TitaneumCat 24 — 5y

1 answer

Log in to vote
0
Answered by
Time_URSS 146
5 years ago

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!

0
What this script does it looks through all the parts in the model bob and sets their transparency to 0 and turns CanCollide off, and it happens when the player touches the part ScrubSadmir 200 — 5y
Ad

Answer this question