For a hotbar system, is it better to make it client sided or server sided?

I have a custom hotbar system and I have the client tell the server when a key is pressed, then the server equips the tool based on what key was pressed. By doing this, it makes there be a small delay when you try to equip a tool but an exploiter cannot give themselves tools with this. Is it safe to make the client equip the tool using Humanoid:EquipTool() or should I continue to have the server equip the tool?

Hey, the player’s character’s network owner is the player itself. So the changes will be replicated to the server and all other clients. So using Humanoid:EquipTools() on the client is sufficient, you don’t need to do it on the server.

But, you will have to implement some kind of anti-exploit on the server that makes sure that the exploiter is not equipping the tools you don’t want it to.

To create an anti exploit for this, you can use .ChildAdded event on player’s character, because that’s where equipped tools end up. And do what ever you want to do with the exploiter when he equips the tools you don’t want him to equip.

3 Likes

Wdym, exploiters never could give themselves tools that replicate on the server unless theres an unsecure remote event. The worst that will happen is that they will play the equipped animation and control the physics of their own character which they already could have anyway.

Simple script, place it starter character to create a local part tool
local tool = Instance.new("Tool")
local part = Instance.new("Part")
part.Name = "Handle"
part.Parent = tool

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
tool.Parent = character

local function explode(point)
	local e = Instance.new("Explosion")
	e.DestroyJointRadiusPercent = 0 -- Make the explosion non-deadly 
	e.Position = point
	e.Parent = workspace
end

local function onActivated()
	-- Get the Humanoid that Activated the tool
	local human = tool.Parent.Humanoid
	-- Call explode with the current point the Humanoid is targetting
	explode(human.TargetPoint) 
end

tool.Activated:Connect(onActivated)