Securing Code when sending to local(?)

How to secure the “code”

My game is very bad at protecting from exploiter.

Need help: is there a way to send a code without sending the code itself directly(see below) to make server verify?

Send Event

local BugEvent = game.ReplicatedStorage:WaitForChild("BugEvent")
local code = "11111111111111111111111"  --Example ID
script.Parent.ProximityPrompt.Triggered:Connect(function(player)
BugEvent:FireClient(player, 1, 2,2,2, code,30)
end)

Minigame side(Local)

BugEvent.OnClientEvent:Connect(function(WaitTime,MoveTime,Weight,MaxProgress,Bugtype,exp)
--Example
If success then
BugGive:FireServer(Bugtype, Weight, score,exp)
else
--you failed!
end
end)

MainServer

BugGive.OnServerEvent:Connect(function(player, bugCode, Weight, score, exp)
	local bugName = BugCodeTable[bugCode] --> check if bugCode match with server
        --Give player BugName
end)

Not sure if I ask the right question, you can ask me more!

1 Like

Decide to rewrite and move most of function into more server-side, I will mark this as solution if everything going well.

2 Likes

I’m kinda confused, but you can NEVER trust the client with anything.

yeah, I didn’t think of that after almost finish the system