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

[SOLVED ]How to have the cash value changed to then have it portrayed onto the Money GUI?

Asked by 6 years ago
Edited 6 years ago

--Script to have the value of the cash change (below)

game.Players.PlayerAdded:Connect(function() local stats = Instance.new("IntValue") stats.Name = "leaderstats"

local cash = Instance.new("IntValue")   
cash.Name = "Cash"
cash.Value = 0
cash.Parent = stats
stats.Parent = game.Players.LocalPlayer

end)

local cash = Instance.new("IntValue") local Money = game.StarterGui.MoneyGUI.Money

if cash.Value == 0 then cash.Value = cash.Value + 120 wait(.2) print("Worked") end

-- script to have the value shown onto the GUI ( below)

local player = game.Players.LocalPlayer local Cash = script.Parent:WaitForChild("Money")

while wait(1) do Cash.Text = player:WaitForChild("leaderstats"):WaitForChild("Cash").Value end

1 answer

Log in to vote
0
Answered by 6 years ago

Just change the stat variable to where the Money is located.

local player = game.Players.LocalPlayer
local stat = player.leaderstats:WaitForChild("Money")
while wait() do
    script.Parent.Text = stat.Value
end

Please accept my answer if this helped!

Ad

Answer this question