I have two separate scripts and one of them creates a new value called 'gold'. I need to make it so when someone clicks a text button they get gold. But I can't figure out how to link the two scripts together to use the gold value in another script.
The script that creates the gold value:
local function onPlayerJoin(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local gold = Instance.new("IntValue")
gold.Name = "Gold"
gold.Value = 0
gold.Parent = leaderstats
end
game.Players.PlayerAdded:Connect(onPlayerJoin)
The script that is meant to give gold:
game.StarterGui.ScreenGui.Frame.TextButton.MouseButton1Click:Connect(function(player)
gold.Value = gold.Value + 1
end)
