Trying to make sure the user it not further than a set distance for a proxy prompt to prevent far grab type of exploits and it seems to not be working.
20:18:20.466 96.91646575927734 - Server - Bagpickup:5 20:18:20.467 [!] Potential Cheater. Far Grab type cheat detected. Kicking: thatguybarny1324 | 180983817 - Server - Bagpickup:8
Structure of object and its children:
Ignore the part instance just chilling there. It hovers above the bag a little to make accessing the prompt easier.
Server Script Code:
(LOCAL SCRIPT IS NOT IMPORTANT JUST DOES A NOTIFICATION TO THE CLIENT WHO PICKED UP THE BAG. DOES NOT DO ANY KIND OF IMPORTANT HANDLING.)
script.Parent.ProximityPrompt.Triggered:Connect(function(player) -- Focus here local dist: number = player.Character:FindFirstChild("Torso").CFrame.Position.Magnitude print(dist) if dist > 10 then print("[!] Potential Cheater. Far Grab type cheat detected. Kicking: "..player.Name.." | "..player.UserId) player:Kick("Far Grab type cheat detected. Kicking: "..player.Name.." | "..player.UserId.."\nIf you believe this to be an mistake please open a ticket in our support discord.") end -- Focus above. Ignore below. --======================================================== -- main stuff after checks local UUID: string = script.Parent:GetAttribute("UUID") if UUID == nil then player:Kick("U32 | Disconnected.") end local char = player.Character local bags = char:FindFirstChild("Bag") local bagPart = Instance.new("Part", bags) -- used to store bag data on the player local bagPartVal = Instance.new("IntValue", bagPart) -- used to store the value on the player if bagPart.Parent ~= bags then bagPart.Parent = bags elseif bagPartVal.Parent ~= bagPart then bagPartVal.Parent = bagPart end bagPartVal.Value = script.Parent.Amount.Value bagPart.CanCollide = false bagPart.Anchored = true bagPart.Transparency = 1 bagPart.Name = UUID end)
Knowing some people will go below and look at the rest of the code.
- Why is there a UUID Check? A: Exploiters can clone the bag from replicated storage. The reason why is to catch exploiters off guard and easily ban them.
- Why is the cash an IntValue instance and not an attribute? I was not bothered by making both attributes and also makes some exploiters looking through dirs to see that and try to pick the bag up.