I want to create a shop script that takes away the price I put on the weapon.
What is the issue? When I try make it check if the players Bucks are high enough to buy it, it gives the error. (“attempt to compare boolean and number”)
What solutions have you tried so far? I tried googling it but I don’t see anything similar to it.
The code:
local ImageButton = script.Parent.ImageButton
local Bucks = game.Players.LocalPlayer:WaitForChild("leaderstats").Bucks
ImageButton.MouseButton1Click:Connect(function()
local price = ImageButton:GetAttribute("Price")
if not Bucks.Value < price then --The error is here
Bucks.Value = Bucks.Value -price
else
print("Not enough bucks.")
end
end)
And also if you want to perform this change for everyone you need to use RemoteFunction/RemoteEvent to communicate with server because this will change the value only on the client side and not for server.