I need help on my currency script

Hello I’m trying to make a currency script In my game flopzone

The Issue is whenever I want it in the game on the leaderboard It doesn’t show up please help!

I cant find anything that can help me on youtube or the dev forum

Game.Players.PlayerAdded:Connect(function(player)
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = player

	local Cash = Instance.new("NumberValue")
	Cash.Name = "Tix"
	Cash.Value = 0
	Cash.Parent = 'leaderstats'
2 Likes

I am also curious if anyone know how to make a GUI that displays all of your money

1 Like

game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new(“Folder”)
leaderstats.Name = “leaderstats”
leaderstats.Parent = player

local Cash = Instance.new("NumberValue")
Cash.Name = "Tix"
Cash.Value = 0
Cash.Parent = leaderstats

end)

1 Like

Well you forgot to add a end at the end, and you capitalized Game. Try this:

game.Players.PlayerAdded:Connect(function(player)
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = player

	local Cash = Instance.new("NumberValue")
	Cash.Name = "Tix"
	Cash.Value = 0
	Cash.Parent = 'leaderstats'
end)

Now for a gui that changes you need a local script that is a child of a text label.

local player = game.Players.LocalPlayer
local Cash = player:WaitForChild("leaderstats"):WaitForChild("Tix")
local TextLabel = script.Parent

Cash.Changed:Connect(function()
       TextLabel.Text = "Tix: "..Cash.Value
end)
2 Likes

If you want it to display on gui add screen gui on starter gui and insert text label on screen gui and add local script to text label and type this.

local player = game.Players.LocalPlayer
while wait() do
script.Parent.Text = player.leaderstats.Tix.Value
end)

2 Likes

Cash.Changed:Connect(function()) --- typo ---

Instead of doing Cash.Changed, you should do Cash:GetPropertyChangedSignal("Value")
.Changed fires when any of the other properties change too.

1 Like

No its not working, i collected a coin and it did nothin

It makes a error at the end of the script

You need to connect it to a function

1 Like
local player = game.Players.LocalPlayer
local Cash = player:WaitForChild("leaderstats"):WaitForChild("Tix")
local TextLabel = script.Parent

function Cash:GetPropertyChangedSignal("Value")
TextLabel.Text = "Tix: "..Cash.Value
end)

Or

local player = game.Players.LocalPlayer
local Cash = player:WaitForChild("leaderstats"):WaitForChild("Tix")
local TextLabel = script.Parent function

Cash:GetPropertyChangedSignal("Value")
TextLabel.Text = "Tix: "..Cash.Value
end)

Or

local player = game.Players.LocalPlayer
local Cash = player:WaitForChild("leaderstats"):WaitForChild("Tix")
local TextLabel = script.Parent(function()

Cash:GetPropertyChangedSignal("Value")
TextLabel.Text = "Tix: "..Cash.Value
end)

none of them, do

local player = game.Players.LocalPlayer
local Cash = player:WaitForChild("leaderstats"):WaitForChild("Tix")
local TextLabel = script.Parent

Cash:GetPropertyChangedSignal("Value"):Connect(function()
TextLabel.Text = "Tix: "..Cash.Value
end)
1 Like