The title explains it allready, How to make a LocalScript change the properties of all of the model’s childs?
Lets make it more clear.
- I’m making that when you press the button, all parts stored underneath a model would be set to transparency = 1.
- I don’t know how I would make that, I’ve tried different ways but none work.
- Model: InvisibleWalls
- Parts under “InvisibleWalls”: Part
I only need the part that makes the children chnage transparency.
You can loop through the model’s objects with a generic for loop.
local model: Model
for _,v: BasePart in ipairs(model:GetDescendants()) do
if v:IsA("BasePart") then
v.Transparency = 1
If you want to change a part’s property locally, you won’t be able to do that if the localscript is parented to the part since local script only works if it’s in starterplayer or startergui so what you can do is create a localscript in the starterplayerscript folder and do something like
local Wall = wall
local Button = button
if Hit.Parent:FindFirstChild("Humanoid") then
wall.Transparency = 1
script is not accurate.
I might not be good in scripting but try this:-
I think its MouseButton1Click or something else
local Model = game.Workspace.Model -- Put Model Path
local Button = game.Workspace.Button -- Put Button Path Here
for i, v in pairs(Model:GetChildren()) do
v.Transperency = 1
its under a ImageButton charrrrrrrr
ofc its mouse button 1 click if it is a gui button
What do you mean with
The ‘: Model’ in ‘model: Model’ is typechecking. It basically tells Roblox Studio what type a variable is. It’s optional, but definitely helps a lot as it autocompletes specific functions and properties found in that type (e.g. :PivotTo(), PrimaryPart, etc).
I alr found it out, thanks, it works!