How can I make a part not have the cancolloid, but still not go inside another part?

  1. What do you want to achieve? So basically my water part has CanColloide false, but i don’t want it goes inside another part with CanColloide true, but the player can still go inside the part without the cancolloide. How do i do it?

I tried to make a script using collision groups, but it isn’t working (it’s a serverscript)

local PhysicsService = game:GetService("PhysicsService")

local drum = "Drum"
local water = "Water"

PhysicsService:RegisterCollisionGroup(water)
PhysicsService:RegisterCollisionGroup(drum)

local waterPart = workspace.Water
waterPart.CollisionGroup = water

local drumPart = workspace.WashingMashineClassic["Constarin Cestello"].Union
drumPart.CollisionGroup = drum

PhysicsService:CollisionGroupSetCollidable(water, drum, false)

Assign a collision group to player on character added event, make that group uncollidable with the water’s group, and collidable with the drum group.

1 Like
local PhysicsService = game:GetService("PhysicsService")

local water = "Water"
local chara = "Char"

PhysicsService:RegisterCollisionGroup(chara)

game.Players.PlayerAdded:Connect(function(plr)
	
	plr.CharacterAdded:Connect(function(char)
		
		plr.Team = game.Teams.Lobby
		
		for i,part in pairs(char:GetChildren()) do
			if part:IsA("BasePart") then
				
				part.CollisionGroup = chara
			end
		end
		
		
	end)
	
end)


PhysicsService:RegisterCollisionGroup(water)

local waterPart = workspace.Water
waterPart.CollisionGroup = water


PhysicsService:CollisionGroupSetCollidable(chara, water, false)

Ty for the answer
I treid to make this script, but it doesn’t work. What’s the error?

Is there any written error? Why doesn’t it work?

1 Like

as you can see, my character cannot enter into the part

Try using GetDescendants when the character gets added instead.

1 Like

It is not woring anyway

local PhysicsService = game:GetService("PhysicsService")

local water = "Water"
local chara = "Char"

PhysicsService:RegisterCollisionGroup(chara)

game.Players.PlayerAdded:Connect(function(plr)
	
	plr.CharacterAdded:Connect(function(char)
		
		plr.Team = game.Teams.Lobby
		
		for i,part in pairs(char:GetDescendants()) do
			if part:IsA("BasePart") then
				
				part.CollisionGroup = chara
			end
		end
		
		
	end)
	
end)


PhysicsService:RegisterCollisionGroup(water)

local waterPart = workspace.Water
waterPart.CollisionGroup = water


PhysicsService:CollisionGroupSetCollidable(chara, water, false)

Check if the parts are actually getting the collision group while playtesting, from properties I mean, and make sure it’s not giving you any error. It may be because right after character is added character parts aren’t completely loaded. Try using CharacterAppearanceLoaded instead of CharacterAdded.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.