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

How i change the CanCollide property of 2 parts?

Asked by
Gigaset39 111
2 years ago
Edited 2 years ago

soo, i wanted to change the CanCollide property of one part trough a script,so i used:

      One = workspace.One
     One.CanCollide = false

but now, i added another Part next to One wich is basicaly an extension,so i tought i can Union them, but i cant find the Union button, anyway, when i run the game, just one of it ”works”,but i want to control both of them, so i put them both in a model called ONE and sayd:

       One =  workspace.ONE:GetChildren()
       One.CanCollide = false

But this doesent work at all, help?

2 answers

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

You can loop through the children of “ONE” and set their CanCollide property, like so:

for i, v in ipairs(workspace.ONE:GetChildren()) do
    v.CanCollide = false
end

for i, v in ipairs(workspace.TWO:GetChildren()) do
    v.CanCollide = false
end

for i, v in ipairs(workspace.THREE:GetChildren()) do
    v.CanCollide = false
end

--and so on

Check out this DevFourm post for an explanation of the loop used

0
Hi, im very very basic at LUA, so this doesent help me whit nothing, cause idk 100% what it does. Gigaset39 111 — 2y
0
I also got the *TWO* gropu and the *THREE* group, what i do whit them?? Gigaset39 111 — 2y
0
Edited, you can also choose to group all the groups together and loop through it using GetDescendants() instead SuperLittleAdmin 257 — 2y
Ad
Log in to vote
0
Answered by
enes223 327 Moderation Voter
2 years ago

hey you! have you ever heard of enes? if you are in trouble, better call enes!

Answer this question