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

this script only eorks once and does not show the players money why?

Asked by 9 years ago

This script is supposed to show the amount of money they have from the leaderboard it does not work. Please help me.

while wait() do --makes it loop
    if (script.Parent.Parent.Parent.Parent.Name ~= "StarterGui") then 
        local player = script.Parent.Parent.Parent.Parent.Parent 
        if (player.Parent.Name == "Players") then
            if (player.Stats.Money ~= nil) then --change "Coins" to the secret leaderboard item
                script.Parent.Text = "" .. player.Stats.Money.Value.."$"--change "Coins" to the secret leaderboard item
            end
        end
    end
end

0
@duckyo011 I guess we can't help you because you clearly telling us not to mess with you code, "DON'T MESS WITH THIS!" ;) UserOnly20Characters 890 — 9y
0
Sorry that was for my friend sorry duckyo011 36 — 9y

2 answers

Log in to vote
0
Answered by 9 years ago

Why not use a local Script, It makes it so much easier to work with the client!

    local Player = game.Players.LocalPlayer
    local PlayerGui = Player:WaitForChild("leaderstats")-- This make sure the script wait for the leaderstats to be added before continue running the script so the script doesn't error in the future.
while wait(1) do
    if Player.leaderstats.Money.Value ~= nil then--If Money Value isn't nil or 0 then continue.
    script.Parent.Text = Player.Name.. " 's Cash: "..Player.leaderstats.Money.Value--Change script.Parent to the Money's Value.
    end
end
Ad
Log in to vote
1
Answered by 9 years ago

script.Parent.Text = player.Stats.Money.Value.."$" try useing this

Answer this question