Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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.

1 comment

0

you could weld the parts together then turn off collision

2 answers

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

1 comment

0

I am a script boomer I don't understand what I have to do

Insert this into workspace

local part1 = workspace.Part1 --example
local part2 = workspace.Part2 --example

function touch(hit)
	if game.Players:GetPlayerFromCharacter(hit.Parent) then
		part1.CanCollide = false
	else
		part1.CanCollide = true
	end
end

function touch2(hit)
	if game.Players:GetPlayerFromCharacter(hit.Parent) then
		part2.CanCollide = false
	else
		part2.CanCollide = true
	end
end

part1.Touched:Connect(touch)
part2.Touched:Connect(touch2)

1 comment

0

It doesn't work for me. I changed the top "Workspace.Partnum" to "Workspace.PartName". Does that work or did I mess up?

This discussion is preserved as it was. New answers, comments, and votes are closed.