game.Players.PlayerAdded:connect(function(plr)
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"
stats.Parent = plr
local clicks = Instance.new("IntValue", stats)
clicks.Name = "Clicks"
clicks.Value = 0
clicks.Parent = stats
local level = Instance.new("IntValue", stats)
level.Name = "Rank"
level.Value = 0
level.Parent = stats
end)
first script
function onClick()
--where I want to put my variable
end
script.Parent.MouseClick:connect(onClick)
second script . . I'm trying to make a clickable object thaat when you click it, the variable "clicks" goes up

1 comment
You can do what the people below suggested, or you can use _G (global variable). But using _G isn't that good and in this case there is no point of using it.