Anything wrong with my currency script?

So, basically I’m working on this whole coin system, and if this script doesn’t work, it brakes the whole system.

Here’s the code:

local CurrentRubies = game.StarterGui.GemNExp.Gem:FindFirstChild("CurrentRubies")

game.Players.PlayerAdded:Connect(function(Player)
	local Coins = Instance.new("Folder", Player)
	Coins.Name = "Rubies"
	local Rubies = Instance.new("IntValue", Player)
	Rubies.Name = "Space Rubies"
	Rubies.Value = 100
	repeat
		wait(60)
		Rubies.Value = Rubies.Value + 10
	until
	Rubies.Value == 1000
end)

Thank you so much for reading.

1 Like

For the variable CurrentRubies you are trying to refrence a object in StarterGui, which would not work as the contents of StarterGui is replicated to PlayerGui.

Sorry for the slow response, the forums appear to be really slow for me.

mm. that makes sense. thank you.