Here's the line that It says attempt to compare two userdata values
if .Parent.Bars.Thirst.Amount.Size >= UDim2.new(0,0,0,0) then
local KillPlayer = game.Players.LocalPlayer.Character.Humanoid
Humanoid.Health = -1
end
Here's the line that It says attempt to compare two userdata values
if .Parent.Bars.Thirst.Amount.Size >= UDim2.new(0,0,0,0) then
local KillPlayer = game.Players.LocalPlayer.Character.Humanoid
Humanoid.Health = -1
end
Instead of comparing GUI sizes, I'm pretty sure you have a IntValue or NumberValue that stores how much thirst there is. Or if you don't already add a IntValue into Amount and do this;
local TA = script.Parent:WaitForChild('Bars').Thirst.Amount.IntValue --ThirstAmount
if TA.Value <= 0 then
local KillPlayer = game.Players.LocalPlayer.Character.Humanoid
KillPlayer.Health = 0 -- 0 Health kills player
end
If this helped then please accept answer ;)
This discussion is preserved as it was. New answers, comments, and votes are closed.
4 comments
You have to be very specific; there's two values to GUIs (such as Frames, TxtBttns, TxtLbls, etc.), which are the Y and X values, which serves two different purposes. Y works up-and-down, and X works left-to-right. They both come with values...
Known as the Offset and Scale values; Offset is a property to have the GUI support all devices, while Scale works in pixels, and will not support all devices. With these values, you can compare them to a specific number, but to note, you can't change them: you have to do it via the UDim2 function (in game), or going into studio to change them.
So can you fix it for me?
Well, all you need to do is, for how your script is, set up your script like this:
if Size.Y.Scale >= 0 then, but if you're trying to compare a different value, then you'll have to have it be compared by the X or Y values, depending on what you're trying to do.