Hello guys, I have a weird problem: I am trying to make a click detector shop. This is the full script:
local tool = game.ServerStorage.Pistol
local klone = tool:clone()
script.Parent.ClickDetector.MouseClick:connect(function(plr)
local Goldvalue = plr.leaderstats.Gold.Value
if Goldvalue >= 10000 then
Goldvalue = Goldvalue - 10000
if klone.Parent ~= plr.Backpack then
klone.Parent = plr.Backpack
else
print("Your backpack is full")
end
else
print("Not enough money")
end
end)
The important thing here is this:
if Goldvalue >= 10000 then
Because if I set it like this (>=) then if I have 0 Gold it says Not enough money.
If I have 10000 Gold it saysNot enough money and with over 10000 Gold it says also Not enough money
if Goldvalue <= 10000 then
When I rotate the symbol and I have 0 Gold it works. If I have 10000 Gold it works and with over 10000 Gold it works also. I don't understand why.
My problem problem now is that I don't get a wheapon when I have 10000 Gold or above.
Does anyone know why it is so weird?
Some Info:
-Gold is a Intvalue
-The script is a serverscript
-The leaderboard works correctly
-I tried to divide the <= and <= and == with if ... or ... then and elseif

5 comments
Change "connect" to "Connect", prefer using plr.leaderstats.Gold and then Goldvalue.Value.
the c on line 2 in "clone()" is supposed to bee "Clone()" that might be why.
ok, thanks! I try
It did not work, I tried to put before the if statement of goldvalue "print(Goldvalue)" and it said always 0, I think there I have a problem
My problem is that it is saying always Goldvalue = 0