Mouse function problem

Delete all this.
Leaderstats must be at serverscriptservice. [not at local script.]

ok I put leaderstats into server script service

Is it showing at player list. check

yes I can see the leaderstats at player list

This should be a relatively similar script!

local NumberOfCoins = game.StarterGui.ScreenGui:WaitForChild("NumberOfCoins")
local NewText = 1

script.Parent.MouseButton1Click:Connect(function()
    NumberOfCoins.Text = tonumber(NewText)
end)

Let me know with any problems you encounter!

I’m back!
I didn’t have enough time.
After placed the leaderstats to ServerScriptService.
Go at the textlabel with local script.
and put that:

while wait() do
local plr = game.Players.LocalPlayer
script.Parent.Text = “Coins:”…plr:WaitForChild(“leaderstats”):FindFirstChild(“Coins”).Value – Checks the coins at leaderstats value. to change the text as the same value.
end


Create textbutton at the gui.
And add this localscript at it!

local plr = game.Players.LocalPlayer
local coins = plr:WaitForChild("leaderstats"):FindFirstChild("Coins")

script.Parent.MouseButton1Click:Connect(function()
         coins.Value = coins.Value + 1
end)


When player click at the button.
The text will be starting changing.

1 Like

thanks dude appreciate it :)))))))