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!