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

How to locate stats that are not in leaderstats? (Edited) [closed]

Asked by 9 years ago

Ok so my shop is finally working yeah! But we have a problem with adding money to people, instead of it using leaderstats as a way (this is so hackers can't hack they stats) to change it uses a Folder in ServerScriptServices called Players and it adds new Folders with their Username with the stat inside but I have no idea how to locate that from a script so it can change. Here's the script I'm trying to change my leaderboard money with.

local time = 180

while true do
    wait(1)
    time = time - 1
    if (time <= 0) then
        time = 180
        players = game.Players:GetChildren()
        for i=1, #players do
            if (players[i]~=nil) then
                if (players[i]:findFirstChild("leaderstats")) then
                    if (players[i].leaderstats:findFirstChild("Credits")) then
                        if (players[i]:IsInGroup(234707)==true) then -- user IS in ERR
                            players[i].leaderstats.Credits.Value = players[i].leaderstats.Credits.Value + 50
                            if (players[i]:IsInGroup(234706)==true) then -- Guard
                                players[i].leaderstats.Credits.Value = players[i].leaderstats.Credits.Value + 30
                            end
                        else
                            players[i].leaderstats.Credits.Value = players[i].leaderstats.Credits.Value + 50
                        end
                    end
                end
            end
        end
    end
    playersa = game.Players:GetChildren()
    for i=1, #playersa do
        if (playersa[i]~=nil) then
            if (playersa[i]:findFirstChild("PlayerGui")) then
                if (playersa[i].PlayerGui:findFirstChild("PaydayGui")) then
                    playersa[i].PlayerGui.PaydayGui.Label.Text = "Next payday in: " .. tostring(time) .. " seconds"
                end
            end
        end
    end
end

0
Sorry, but this is really confusing. Break it up a little, and leave some code snippets for us to work off of. dyler3 1510 — 9y
0
I have Edited Anciteify 70 — 9y

Locked by Goulstem, NinjoOnline, and M39a9am3R

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

1 answer

Log in to vote
1
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
9 years ago

All you have to do is change the source of where you're editing the stats, silly. It's on lines 14,16,and 19

I edited some other stuff too for efficiency(;

local time = 180

while wait(1) do
    time = time - 1
    if (time <= 0) then
        time = 180
    end
    for i,v in pairs(game.Players:GetPlayers()) do
        --different source directory
        local plr = game.ServerScriptStorage.Players:FindFirstChild(v.Name)
        if plr then
            --edit--
            local gui = v.PlayerGui:FindFirstChild('PaydayGui')
            --edit--
            local creds = plr.Credits
            if gui then
                gui.Label.Text = 'Next payday in '..time..' seconds'
            end
            if plr:IsInGroup(234707) then
                creds.Value = creds.Value + 50
            elseif plr:IsInGroup(234706) then
                creds.Value = creds.Value + 30
            end
            creds.Value = creds.Value + 50
        end
    end
end
0
Thank you! Anciteify 70 — 9y
0
PlayerGui is trying to be found in the folder it self not in normal Players instact how I can I find it? Anciteify 70 — 9y
0
Oh my bad, since we're iterating through a table of all the players with a generic for loop then you can just use 'v' as the player and get the PlayerGui through there(: I'll edit my answer though. Goulstem 8144 — 9y
0
Thanks! Anciteify 70 — 9y
Ad