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

It says that I can't compare the GUI Sizes?

Asked by 6 years ago

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
0
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... TheeDeathCaster 2368 — 6y
0
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. TheeDeathCaster 2368 — 6y
0
So can you fix it for me? magicguy78942 238 — 6y
0
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. TheeDeathCaster 2368 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

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 ;)

Ad

Answer this question