Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Hey I need help on my MoneyGUI for the textlabel?

So I need my textLabel To say the amount of cash a person has aswell as that cash going up by 50 every minute My current script is:

local Cash = game:GetService("Players").LocalPlayer:WaitForChild("leaderstats").Cash
local textLabel = script.Parent.Frame.TextLabel

Cash.Changed:Connect(function()
    Cash.Value = 0
    wait(60)
    Cash.Value = Cash.Value + 50
    textLabel.Text = tostring(Cash.Value)
end)

1 comment

0

NNOw its local Cash = script.WaitForChild().leaderstats.Cash Cash.Changed:connect(function() script.Parent.Text = Cash.Value Cash.Value = 0 wait(60) Cash.Value = Cash.Value + 50 end)

1 answer

✓ Accepted answer

BIG Edit: After speaking with the person who asked the question, I reworked the answer. First of all, you need to create leaderstats, since you don't have one. Here's how you create it. Firstly, you need a server script in order to create the leaderstats.

--Server Script. Put this on ServerScriptService.
game.Players.PlayerAdded:Connect(function(plr) --plr is the parameter. New player, basically.
	local leaderstats = Instance.new("Folder")  --Folder can allow to cram IntValues, etc.
	leaderstats.Parent = plr  --leaderstats will be the child of plr
	leaderstats.Name = "leaderstats" --Name.

	local cash = Instance.new("IntValue")
	cash.Parent = leaderstats
	cash.Name = "Cash"
	
	cash.Value = 0
	
	while wait(60) do
		cash.Value = cash.Value + 50
	end
end)

Now I made the leaderstats. Now we need the GUI.

--LocalScript. Put this under ScreenGui
local textLabel = script.Parent.Frame.TextLabel
local cash = game.Players.LocalPlayer.leaderstats.Cash

cash.Changed:Connect(function()
	textLabel.Text = "Cash: "..cash.Value
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.