The error is Players.Player1.PlayerGui.EggSellGui.MainFrame.ShopFrame.BuggyEgg.LocalScript:29: attempt to compare boolean with number
the error is: if player:WaitForChild("leaderstats"):WaitForChild("GrassTokens").Value == player:WaitForChild("leaderstats"):WaitForChild("GrassTokens").Value <= 30 then
My script is:
local button = script.Parent
local cost = 30
local egg = script.Parent.Parent.Parent:WaitForChild("EggImage")
local choice1 = script.Parent.Parent.Parent:WaitForChild("Choice1")
local choice2 = script.Parent.Parent.Parent:WaitForChild("Choice2")
local choice3 = script.Parent.Parent.Parent:WaitForChild("Choice3")
local costlabel = script.Parent.Parent.Parent:WaitForChild("Cost")
local player = game.Players.LocalPlayer
local hatchingmoment = script.Parent.Parent.Parent.Parent:WaitForChild("HatchingMoment")
local hatchedimage = script.Parent.Parent.Parent.Parent.HatchingMoment:WaitForChild("HatchedImage")
button.MouseEnter:connect(function()
egg.Image = "http://www.roblox.com/asset/?id=6811340"
choice1.Image = "http://www.roblox.com/asset/?id=711466052"
choice2.Image = "http://www.roblox.com/asset/?id=711466415"
choice3.Image = "http://www.roblox.com/asset/?id=142257783"
costlabel.Text = "Cost: 30 Grass Element Tokens"
end)
button.MouseLeave:connect(function()
egg.Image = ""
choice1.Image = ""
choice2.Image = ""
choice3.Image = ""
costlabel.Text = ""
end)
button.MouseButton1Down:connect(function()
if player:WaitForChild("leaderstats"):WaitForChild("GrassTokens").Value == player:WaitForChild("leaderstats"):WaitForChild("GrassTokens").Value <= 30 then
player:WaitForChild("leaderstats"):WaitForChild("GrassTokens").Value = player:WaitForChild("leaderstats"):WaitForChild("GrassTokens").Value - cost
local randomlychoose = math.random(1,20)
if randomlychoose == 1 or randomlychoose == 2 or randomlychoose == 3 or randomlychoose == 4 or randomlychoose == 5 or randomlychoose == 6 or randomlychoose == 7 or randomlychoose == 8 or randomlychoose == 9 or randomlychoose == 10 or randomlychoose == 11 or randomlychoose == 12 or randomlychoose == 13 or randomlychoose == 14 or randomlychoose == 15 then
hatchingmoment.Visible = true
wait(10)
hatchedimage.Image = "http://www.roblox.com/asset/?id=711466052"
if randomlychoose == 16 or randomlychoose == 17 or randomlychoose == 18 or randomlychoose == 19 then
hatchingmoment.Visible = true
wait(10)
hatchedimage.Image = "http://www.roblox.com/asset/?id=711466415"
end
end
end
end)
error is on if player:WaitForChild("leaderstats"):WaitForChild("GrassTokens").Value == player:WaitForChild("leaderstats"):WaitForChild("GrassTokens").Value <= 30 then
Please help fix

2 comments
Edited to fix code formatting
The error is self-explanatory you are using <= with a boolean value ie true <= which is not valid.