Non accurate leaderstat values

When i click it it always says 0 coins

local click = script.Parent

	local coins = plr:WaitForChild("leaderstats").Coins
	if coins.Value >= 100 then
		print(plr.Name.."bought an item")
		coins.Value -= 100
		local clone = game:GetService("ServerStorage").Tools:WaitForChild("Item"):Clone()
		clone.Parent = plr.Backpack

There’s not enough information here to assist you. Please read the guidelines for this category…

Where is it that you should have 100 coins?

Did you ever set Coins.Value to 100?

We can’t assist you with this little snippet.

Oh oops sorry

You need 100 coins or more to buy the item but whatever the value of the coins is it always prints 0 and doesnt work

Also some weird thing is when i tried making it give you coins when you clicked it for testing reasons the value went up?? Idk its confusing

The script I used to raise the value is a simple coins.Value += number and the value is correct when i check my leaderstats value

You didn’t execute the script locally, right?

Its a server script in a click detector

Yes, but you didn’t increase the coins locally, right? The server script only sees the coins as 0 if you did it locally.


Oh god im dum aaaa i was increasing it locally tysm

1 Like