The error appears to be in line 10, any ideas?
local Player = script.Parent.Parent.Parent.Parent.Parent local oops = script.Parent.Parent.Parent.Oops local HBidder = workspace.HighestBidder.Value local HBid = workspace.HighestBid.Value print(Player) script.Parent.FocusLost:Connect(function() local Text = script.Parent.Text if tonumber(Text) then if tonumber(Text) > HBid then HBid = Text HBidder = Player end end end)
The error describes exactly what you're doing wrong.
tonumber(Text)
will return a number representation of Text
. HBid
, I'm assuming, is a string
. How can a number
be greater than a string
(without getting into certain technicalities)? It can't. A number
is a number
, and a string
is a string
. What I think you did was that you used a StringValue
for HBid
when you should've been using an IntValue
.
Additionally, I've noticed another mistake. You do:
local HBidder = workspace.HighestBidder.Value local HBid = workspace.HighestBid.Value
and then later on, you try changing their values by doing
HBid = Text HBidder = Player
That will not change their values. Initially, HBidder
and HBid
are not a reference to HighestBidder.Value and HighestBid.Value but rather string
s whose values are equal to their values. Whenever you want to change ValueBase
objects, you must refer to their object first and then assign a change to their Value
property, so it should be more like this:
local HBidder = workspace.HighestBidder local HBid = workspace.HighestBid -- later on in the script HBid.Value = Text HBidder.Value = Player
Same thing if you want to check the Value
. You must check HBidder.Value
rather than HBidder
and HBid.Value
rather than HBid
.