local Ball = game.ServerStorage.Ball
local PhysicService = game:GetService("PhysicsService")
game.Players.PlayerAdded:Connect(function(plr)
local Clone = Ball:Clone()
Clone.Parent = workspace
Clone.Name = plr.Name.."sBall"
PhysicService:CreateCollisionGroup("Ownersball")
PhysicService:CreateCollisionGroup("WrongBall")
PhysicService:CollisionGroupSetCollidable("Ownersball", "WrongBall",false)
PhysicService:SetPartCollisionGroup(Clone, "Ownersball")
wait(4)
for _,v in pairs(workspace:GetChildren()) do
if v.Name == plr.Name then
while v.Humanoid.Health > 0 do
wait()
if v.Humanoid.Health == 0 then
Clone:Destroy()
end
end
end
end
Clone.Touched:Connect(function(player)
if not player.Name == plr.Name.."sBall" then
for _,v in pairs(game.Players:GetPlayers()) do
PhysicService:SetPartCollisionGroup(v,"NotTheirBall")
end
end
end)
end)
I'm trying to make anyone who isn't the balls owner walk through the ball if they try to push it. If they are the balls owner, then they're able to push it.
