Best way to do this is in a server side script so dont use local
Alright so first you can get player from finding leaderstats
start off like this
-Ok So first you gotta count how many parents you need to get to game from the script in startergui
local lead = script.Parent.Parent.Parent.Parent:WaitForChild("leaderstats")
local player = lead.Parent
local leaderstats = player:WaitForChild("leaderstats")
local clicks = leaderstats:WaitForChild("Clicks")
script.Parent.MouseButton1Click:Connect(function()
if clicks.Value >= 10 then
script.Parent.Parent.Click.GiveCoins1k:Destroy()
wait(.1)
script.Parent.Parent.Click.GiveCoins2k.Disabled = false
wait(.1)
script.Parent.Parent.Cost.Text = "Cost 2000"
wait(.1)
script.Parent:Destroy()
end
end)
Also for local `lead = script.Parent`` you need to adjust how many parents until you get the game
alright so I explained a lot next to the script and this is how you would do this locally but 1 thing would be taking the 10 clicks away when they click which you can do clicks.Value -= 10 after the then hope this helps accept if so
2 comments
Is this a localscript or ServerScript?
Use remoteEvents