Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

Would a leaderstats Script be secure in Filtering Enabled?

Asked by 5 years ago

Normal Stats Script

This would be a normal leaderstats script:

--\\ Services
local players = game:GetService("Players")

players.PlayerAdded:Connect(function(player)
    local stats = Instance.new("Folder")
    stats.Name = "leaderstats"
    stats.Parent = player

    local randomValue = Instance.new("StringValue")
    randomValue.Name = "Random Value" 
    randomValue.Value = "oof"
    randomValue.Parent = stats
end)

What Is My Question?

I noticed, is this really the best way to make stats? Is there an even more secure(and probably optimized way). I am saying if there is a much more secure way to approach this because it doesn't even use any Remotes. I am just curious to see if there are any different (and probably better) approaches.

Thank you for helping me in advance

2 answers

Log in to vote
0
Answered by 5 years ago

you should make a folder in server storage call it stats then do this in your script you willalso have to change 2 values when changing the leaderstats and there can not be a wait() between the two lines also they should look like this player.leaderstats["Random Value"].Value = "Hi"

game.ServerStorage.Stats[player.Name]["Random Value"].Value = "Hi"

local players = game:GetService("Players")

players.PlayerAdded:Connect(function(player)
local Folder = Instance.new("Folder", game.ServerStorage.Stats)
Folder.Name = player.Name
    local stats = Instance.new("Folder", game.ServerStorage.Stats[player.Name])
    stats.Name = "leaderstats"


        local randomValue = Instance.new("StringValue", stats)--same thing as randomValue.Parent = stats
        randomValue.Name = "Random Value"
        randomValue.Value = "oof"

end)

while true do
wait()
for i,v in pairs(players:GetChildren()) do
if v.leaderstats["Random Value"].Value ~= game.ServerStorage.Stats[v.Name]["Random Value"] then
-- for this ill just kick them
kick(v, "Stop Hacking")
end
end
0
this may not work i didnt test it and it may glich mattchew1010 396 — 5y
0
Learn to indent your code! It makes reading it much easier oreoollie 649 — 5y
0
You should never parent a new Instance before changing its properties. It is a good optimizing technique to simply make the instance(without its parent), then, change its properties, finally, you should parent saSlol2436 716 — 5y
0
If I were to change my string value(randomValue) and make it an IntValue and name it to Level. The level would change. What would I do in that situation? saSlol2436 716 — 5y
View all comments (2 more)
0
the same thing just change the name an values mattchew1010 396 — 5y
0
I know that. But, what I mean is this: if the level would change its value after killing some mobs, what would I do in that situation? The value won't be consistent all the time saSlol2436 716 — 5y
Ad
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

This would be secure if you turned on FilteringEnabled, only if you don't make a RemoteEvent that lets the client change the folder. I don't recommend that you allow the client to change the folder, because then exploiters can just fire the remote and cheat. You could make add an extra argument for a password, but that doesn't really help much since exploiters can just listen for every time the remote is fired then copy and paste the arguments. If you really wanted the client to change the folder, then you can make a remote that does something specific that changes the folder. An example: Imagine your folder had a value inside called Knockouts. Making a remote for increasing the value wouldn't be secure at all, but making a remote that shoots a bullet at a position is very secure, because if an exploiter fired the remote, they would just be playing normally, just by using scripts.

Hope this helped!

PS: I don't really think there's a better way to do it.

Answer this question