How to send multiplier number to server

so i have a complicated system in the client where whenever a certain landmark is hit the multiplier adds by 0.1, but the problem here is every 20 seconds i need to send that multiplier to the server via a RemoteFunction and im worried about exploiters because im pretty sure they can change the multiplier and then a wrong multiplier value will get sent to the server,

how can i send it to the server without worrying about the fact players can alter the value,

heres the script:

--server script

local Multiplier = game.ReplicatedStorage.EventsFolder.RequestMultiplier:InvokeClient(plr)

print(Multiplier)

-- client script

local Multiplier = 1 -- this value changed afterward but the default value is 1

game.ReplicatedStorage.EventsFolder.RequestMultiplier.OnClientInvoke = function()
	return Multiplier
end

also, i tried making the multiplier in a script so its not a NumberValue, but the problem is that i heard some people on the dev forum say that exploiters can also edit scripts, so if they could then they can just simply change the multiplier value in the script, which is also a problem

any help will be appreciated

2 Likes

Exploiters cannot directly modify scripts. They can inject their own code into the client, or decompile scripts they can access and use them.

They can also delete any kind of anti-cheat you put on the client, meaning your system would need big changes to make it secure.

Try to:

  • Manage the multiplier on the server.
  • Fire a RemoteEvent/use another way to request a change - this should be checked and validated by the server to make sure it is a valid request.
  • Read from that value.
2 Likes

how can i do that? because everything on the multiplier needs to be in the client and can not be in the server

2 Likes

What is the multiplier? How is it used within your game? I need a little bit more information.

1 Like

its just an energy multiplier, for example the energy is 100, and every 20 seconds you add 1 or 2 to the energy, and the multiplier just makes it AddedValue*Multiplier

1 Like

You should be able to do that on the server just fine, you could make something to do it in a PlayerAdded subprogram:

local players = game:GetService("Players")

--inside the subprogram
while task.wait(20) do
    if not players:FindFirstChild(player.Name) then break end
    player.Energy.Value += (1 * player.Multiplier.Value) --these are instance values
2 Likes

good suggestion, but the problem is that the multiplier is in the client so any changes in the client the server cant see, my entire issue is that i dont know how to securly send the multiplier from the client to the server

(btw i need to go for 2-5 minutes and i will come back)

1 Like

Why make the multiplier on the client? It’s a big security floor. I would strongly suggest moving it to the server.

1 Like

i will try that, and i will probably just scrap the entire multiplier system because i want the energy to have a full value like for example 100, 110, 125, and not 100.5 or 125.9,

and with my current system i cant because it adds 1-2 every 20 seconds and 2x1.2 (for example) = 2.4, and not a full number and if i use math.ceil, then all the values of 1.1, 1.2, 1.3, 1.4 etc, will equal the same so the multiplier will be useless,

2 Likes

This is slightly off-topic but if you want to keep to integers then you can randomly round up or down depending on the multiplier.

1 Like

thanks for the suggestion, but as i said if i round up 1.4 it will be 2, and if i round up 1.2 it will also be 2, so there wont be a difference in multiplying the number with the multiplier if the multiplier is 1.2x ,1.5x ,1.6x, etc,

1 Like