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 7 years ago
Edited 7 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"

1local cash = Instance.new("IntValue")  
2cash.Name = "Cash"
3cash.Value = 0
4cash.Parent = stats
5stats.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 7 years ago

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

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

Please accept my answer if this helped!

Ad

Answer this question