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

How do I make a part collide with another part but not with players?

Asked by
Mycran 7
5 years ago

I have a part which upholds a moving part. Problem is if I turn the collisions on the part, the moving part just falls. Yet, if I turn the collisions on, people can just walk on it and skip the lobby. How do I make it so that players cannot walk on it yet the moving part doesn't fall? Anchoring the moving part means the moving part stays still, so that's not a solution.

0
you could weld the parts together then turn off collision jediplocoon 877 — 5y

2 answers

Log in to vote
0
Answered by 5 years ago

you would have to use the PhysicsService.. The service allows you to place Baseparts and models in a collision group, then you could set weather or not parts in a certain collision group can collide with parts in another collision group..

learn more about physics service here

0
I am a script boomer I don't understand what I have to do Mycran 7 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

Insert this into workspace

01local part1 = workspace.Part1 --example
02local part2 = workspace.Part2 --example
03 
04function touch(hit)
05    if game.Players:GetPlayerFromCharacter(hit.Parent) then
06        part1.CanCollide = false
07    else
08        part1.CanCollide = true
09    end
10end
11 
12function touch2(hit)
13    if game.Players:GetPlayerFromCharacter(hit.Parent) then
14        part2.CanCollide = false
15    else
View all 21 lines...
0
It doesn't work for me. I changed the top "Workspace.Partnum" to "Workspace.PartName". Does that work or did I mess up? Mycran 7 — 5y

Answer this question