Exploiters able to fling other players on a game I help to develop, collisions are off

Hey!

Exploiters are currently able to fling other players in a game I am helping to develop, the game already has collisions off.

I believe it has something to do with Network Ownership and accessories, though I’m not certain as I don’t have a copy of the exploit.

To fix this, I’ve developed the following script:

--// Character.lua
-- For collision protection.

-- Services
local Players = game:GetService("Players")
local PhysicsService = game:GetService("PhysicsService")
local Character = {}

-- Globals
local GroupName = "Players"
PhysicsService:RegisterCollisionGroup(GroupName)
PhysicsService:CollisionGroupSetCollidable(GroupName, GroupName, false)

function Character.SetNetworkOwnership(Part, Player)
	local AssignOwnership = function()
		Part:SetNetworkOwner(Player)
	end
	
	if not pcall(AssignOwnership) then
		repeat
			Part.Changed:Wait()
		until Part:IsDescendantOf(workspace)
		Part:SetNetworkOwner(Player)
	end
end

function Character.HandleCharacter(CharacterModel : Model, Player : Player)
	for _, v in CharacterModel:GetDescendants() do 
		if v:IsA("BasePart") then
			v.CollisionGroup = GroupName
			Character.SetNetworkOwnership(v, Player)
		end
	end
	
	CharacterModel.DescendantAdded:Connect(function(Descendant)
		if Descendant:IsA("BasePart") then
			Descendant.CollisionGroup = GroupName
			Character.SetNetworkOwnership(Descendant, Player)
		end
	end)
end

function Character.PlayerAdded(Client : Player)
	local InitialCharacter : Model = Client.Character or Client.CharacterAdded:Wait()
	Character.HandleCharacter(InitialCharacter, Client)
	Client.CharacterAdded:Connect(Character.HandleCharacter)
end

return Character

Is there anything I should be doing differently? Have I missed something?
Just checking since I can’t test this fully whilst not having the exploit.

Thank you!

Applying Network Ownership to the player means they are able to control the physics on the client. (or at least phsycis are handled on their end)

Try setting the Ownership to nil, so only the Server has a say on how the physics are calculated.

Otherwise, try CollisionGroups and disable said CollisionGroup on itself.

2 Likes

Don’t set ownership to nil. It feels horrible for the player’s end
Instead, try finding a way to detect how fast they’re spinning and/or using collision groups

1 Like