I've done this with leaderstats before and its easy that way.
I want to know how to do it without so its harder to exploit/change with exploits.
I've done this with leaderstats before and its easy that way.
I want to know how to do it without so its harder to exploit/change with exploits.
You should keep all the real values somewhere that the client cannot access them. I personally use ServerStorage. Then you can have a Changed event linked to those values and make the leaderboard display them. Here is an example:
game.Players.PlayerAdded:Connect(function(player)
local stats = Instance.new("Folder")
stats.Name = "leaderstats"
stats.Parent = player
local cash = Instance.new("IntValue")
cash.Name = "Cash"
cash.Parent = stats
local playerFolder = Instance.new("Folder")
playerFolder.Name = player.Name -- every time you need to access the players real money from a script you will need to find the folder with the players name in ServerStorage
playerFolder.Parent = ServerStorage
local serverCash = Instance.new("IntValue")
serverCash.Name = "ServerCash"
serverCash.Parent = playerFolder
serverCash.Changed:Connect(function()
-- whenever serverCash gets changed by you the leader board will now display that amount without it being vulnerable to attack
cash.Value = serverCash.Value
end)
end)
Note: You will have to remember to :Destroy() the folder when the player leaves. else server storage could quickly be filled up with folders. Hope this helps and have a great day scripting!
As In Stats I'm referring to Strength, Agility, Defense
I remember seeing something where you would have another two values and if the real values were different to the other two then it would change back. So basically say when a player earns 1 cash it updates the two different values and then the real values contain a script were if it notices a change it will update the real values.
Hope this helps.
This discussion is preserved as it was. New answers, comments, and votes are closed.
3 comments
server side exploits are rare to find so i suggest server sided not using the leaderboard in the top right
I will not write the script for you. I was just writing an example. We are scripting helpers. Not script builders. My example was a proof of concept. Just add more Instances and change their purposes to the script and you are good to go. Write it yourself.
if I helped you out please accept my answer. Otherwise comment how I can help you better.