alright so I am currently working on a roulette commission and I have come across a problem. https://gyazo.com/3dcfb993f8c32e9a3bbe9b4c6277a2b0
This is not server-sided. This poses a huge problem due to exploiters. the acceleration/speed of how far it goes is calculated on the server side, but the server side determines a winner from the local side via. remote.
the problem:
exploiters.
exploits, lower fps, etc.
each roulette game creates 14 coins in an alternating pattern, with 14 as a diamond. each time it moves off-screen, it is teleported to the other side of the screen to simulate an infinite roll.
each coin is a separate imageLabel. How would I determine the winner without relying on local input?
I am not very good at math so I do not know if calculating the winner on the server is possible, as each coin has a different size due to screen differentations.
If how far it goes it calculated on the server side, can’t you also use that to calculate where it will land and therefore have everything server side?
On the server side, randomly select a coin and send that to the local side via remote. Then, make the roulette land on the coin that was selected. To make probabilities, you can do something like this
local Weights = {
["diamond"] = 1,
["robux"] = 6,
["tix"] = 7
}
function selectRandom()
local total = 0
for _,weight in pairs(Weights) do
total += weight
end
local rand = math.random(1, total)
local currWeight = 0
for coin,weight in pairs(Weights) do
currWeight += weight
if rand <= currWeight then
return coin
end
end
end
print(selectRandom() .. " has been selected")