How to script my Models to be Transparent and CanCollideable while still being able to reference specific children of that Model?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

How to script my Models to be Transparent and CanCollideable while still being able to reference specific children of that Model?

  1. What is the issue? Include screenshots / videos if possible!

How to script my Models to be Transparent and CanCollideable while still being able to reference specific children of that Model?

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I haven’t tried any solutions so far. I did look for solutions on the Developer Hub.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

-- This is an example Lua code block
local Model = game.Workspace.Model
local Children = Model:GetChildren()
for i = 1, #Children do
local Child = Children[i]
if Child:IsA("BasePart") then
Child.Transparency = 1
Child.CanCollide = false
end
end

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

1 Like

So, you want to be able to change the transparency and canCollide properties of a specific child of a model?

1 Like

Alright that makes more sense, I was a little confused for a minute. What you’d want to do is name the individual children (or the one(s) you’ll be changing) to something different than other children of the model. After that is done, replace your code with this:

local Model = game.Workspace.Model
local Children = Model:GetChildren()

for i = 1, #Children do
	local Child = Children[i]
	if Child:IsA("BasePart") then
		if Child.Name == name then --replace "name" with the name of the part you want to change
			Child.Transparency = 1
			Child.CanCollide = false
		end
	end
end
1 Like