Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Whats wrong with my code? Buy price not working no matter how much i have?

Asked by 3 years ago
Edited by appxritixn 3 years ago

Code formatting fixed by phxntxsmic

game.ReplicatedStorage.Buy.OnServerEvent:Connect(function(pla, price, name)
--pla is the plr 
--price is the price of an object
--name is the name of an item, (Not important here)

print(pla.Parent.Name)
    local char = game.Workspace:FindFirstChild(pla.Name)
    local srtn = tostring(price)

    if pla.leaderstats.Points.Value >= srtn then
        print("works")
    else
        print("Nope")
    end
end)

This code should, Tell how much i have, if i have enough it should prink "works" and if i dont it should print "nope". But no matter how much i have it always prints "nope". whats wrong!! :D

0
what happened to your code formatting User#30567 0 — 3y
0
1. comparaison operators don't work with strings. that's literally it User#30567 0 — 3y
0
if you need more help dm me on discord (Loma#8374) User#30567 0 — 3y
0
You shouldn't have the client send the price of the object. COUNTYL1MITS 312 — 3y

Answer this question