Making A Client-Sided Snowball Collide with a Barrier

Hello there,

I am currently working on a project which involves a large amount of snowballs which are being dropped on every individual player’s client. I am currently trying to make a barrier to prevent the snowballs from exitting the player’s tycoon, but I am not sure how to do this since the snowballs are not on the server. I need the snowballs to collide, but the player not to collide.

Any suggestions would be greatly appreciated!

I have still not received a response to this topic, and am still having issues with this. If anyone is able to help, I would really appreciate it!

I believe you can use collision groups for this even if its only for the client.

Just create the collision groups on the server and assign each snowball to the collision group on the client.

How do you exactly assign parts to the collission group in a script?

local PhysicsService = game:GetService("PhysicsService")

local cubes = "Cubes"
local doors = "Doors"

-- Register two collision groups
PhysicsService:RegisterCollisionGroup(cubes)
PhysicsService:RegisterCollisionGroup(doors)

-- Set cubes to be non-collidable with other cubes
PhysicsService:CollisionGroupSetCollidable(cubes, cubes, false)
-- Set cubes to be non-collidable with doors
PhysicsService:CollisionGroupSetCollidable(cubes, doors, false)

-- Assign an object to each group
--Do this on client, do the above on server
workspace.Cube1.CollisionGroup = cubes
workspace.Door1.CollisionGroup = doors

It doesn’t seem like my scripts worked. I may be writing them wrong though.

Script: (Server)

local physics = game:GetService("PhysicsService")
physics:CreateCollisionGroup("Snowballs")
physics:CreateCollisionGroup("Barrier")

physics:CollisionGroupSetCollidable("Snowballs","Barrier",true)

for i,v in pairs(game.Workspace:GetDescendants()) do
	if v.Name == "Snowball Barrier" then
		physics:SetPartCollisionGroup(v,"Barrier")
	end
end

I added the following line to a localscript whenever the snowball is created, and no other lines other than defining physics obviously. Do I need to add something else?

					physics:SetPartCollisionGroup(newSnowball,"Snowballs")

newSnowball is a part, and Snowball Barriers are Unions. Not sure if that is an issue.

Does anyone know why the above isn’t working? I really need some help.

1 Like