#"UDim expected" IT IS A BLOXXIN UDIM.

1 messages · Page 1 of 1 (latest)

fossil idol
#

``Luau function onTouched(hit)
if not hit or not hit.Parent then return end
local human = hit.Parent:findFirstChild("Humanoid")
if human and human:IsA("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local Gui = player.PlayerGui["Healthbar"]
local width = Gui.Healthleft.Size.Width
Gui.Healthleft.Size = UDim2.new(0, 1, (width-20), 0)
local X = Gui.Healthleft.Position.X
local Y = Gui.Healthleft.Position.Y
Gui.Healthleft.Position = UDim2.new((X-10), 0, Y, 0)
if Gui.Healthleft.Size <=1 then
script.Parent.Scriptb.Enabled = true
end
wait(0.1)
script.Enabled = false
end
end

script.Parent.Touched:connect(onTouched)```

#

OH YEAH

#

AND I CHECKED THE DOCUMENTATION

#

local guiObject = script.Parent
guiObject.Size = UDim2.new(0, 300, 1, 0) -- 300 pixels wide; full height of parent
guiObject.Position = UDim2.new(0, 50, 0, 0) -- 50 pixels from the left

#

THAT'S IN IT

#

LIKE

#

THIS IS LITTERALLY HOW U DO IT

#

AND IF YOU'RE GONNA SQUACK AT THE NUMBERS, IK THEY'RE PROBABLY WRONG I'VE TRIED LIKE SIX DIFFERENT SETS OF NUMBERS

#

CHECKING WHERE THE OFFSET IS

#

JBVKLJCVNXZJCXVNXDMKLJFK

#

Gui.Healthleft.Size = UDim2.new({0, 780}, {0, (width-20)})

#

EVEN TRIED ADDING THE STUPID

#

SQUIGGLY BRACKETS

#

IN THE EXPLORER

#

NOPE

fringe jay
#

did you mean

UDim2.new(0, width-20, 0, 100)

glad bloom
# fossil idol ``Luau function onTouched(hit) if not hit or not hit.Parent then return end ...
        local width = Gui.Healthleft.Size.Width
        Gui.Healthleft.Size = UDim2.new(0, 1, (width-20), 0)```
Size.Width is a UDim not a number, so the error is complaining about UDim-number (invalid argument #2 to subtract operation, UDim expected got number): https://create.roblox.com/docs/reference/engine/datatypes/UDim2#Width
> Width
> UDim
> The X dimension scale and offset of the UDim2.
--> https://create.roblox.com/docs/reference/engine/datatypes/UDim#UDim-UDim

Represents a two-dimensional value where each dimension is composed of a
relative scale and an absolute offset.

Represents a one-dimensional value with two components, a relative scale and
an absolute offset.

glad bloom
#

you probably intended to write Size.Width.Scale

fossil idol
#

oh

fossil idol
#

that doesn't work either because the scale is just 0 all the time for no reason???

#

I think I'll have to outsource the number keeping to a value in the workspace.

glad bloom
#

maybe you meant offset instead?

#

idk i'm not the one making this thing, you are.

fossil idol
#

I know right?

#

It's terrible!

#

Who would put an idiot like me in charge of this?!

#

oh wait that was me

#

well I fixed that problem but now

#

I have new ones

#

which make even less sense?!

glad bloom
#

skill issue

fossil idol
#

I have prints and checks every step of the way

#

all of them are going through

#

it litterally says it's doing it

#

and it isn't

glad bloom
#

and i have a helicopter, doesn't mean i know how to drive it.

fossil idol
fossil idol
#

I mean hey give it to me I'll learn how to drive it

glad bloom
#

script.Enabled=false why

fossil idol
#

you have a helicopter?

glad bloom
#

what are you even trying to do

fossil idol
fossil idol
#

the health goes down

#

the script deletes

#

another lazer with a new script spawns in to hit you

#

that's how it shakes down

glad bloom
#

i assume this is numbervalue and you're trying to change the value with width = Gui.Value.Value; width -= 20?

fossil idol
glad bloom
#

okay so a numbervalue.Value is not a magic object

fossil idol
#

I don't think it is?

glad bloom
#

all you're doing is setting width to a value, then a different value. you're not changing the value contained in the numbervalue

fossil idol
#

It's a number

glad bloom
#

hence, not magic

fossil idol
#

ok I thought that

#

it was assigning that OBJECT, of the numbervalue to the variable

#

how do I do THAT?

#

can I just not have a variable?

glad bloom
#

width=numbervalue

#

width.Value=newvalue

fossil idol
#

...

#

Thanks

glad bloom
#

and not a single one of them is plugged into anything.

fossil idol
#

I mean if that's the case

#

I'm technically already dead

glad bloom
#

the lights are on but nobody's home ;p

#

its okay you're atleast making a start. this is the stuff every beginner has to learn before they can actually be called a scripter

fossil idol
#

I'm not a beginner I've just never had a reason to touch these... values before.

#

They disgust me

#

get me out of here

glad bloom
#

you're better off making these dum mistakes and learning from them than to give up and rely on chatgpt while never actually learning anything

#

some people make that mistake, and its far bigger than the ones you're making here ;p

fossil idol
#

I don't like using the AI, but also, when I have to do
Local A = game.workspace.thing.thingA
and go to like, F, the autosuggester is REALLY nice.

glad bloom
#

its only good for things you already know how to do

fossil idol
#

YES

#

IT WORKS THANK YOU

#

WWWW

#

THANKS BRUV

fossil idol
#

one more small issue

#

I need a bit of help with

#

for some reason when the game loads 4 attacks at once it lags

#

which isn't much of an issue

#

except the lag keeps your keys held down

#

so you just end up walking off the edge of the thing you're riding on

#

ncm

#

nvm

#

I will figure it out

#

ohhh

#

I just add wait()

#

and the lag dissapears

#

marvelous

flint python
#

@fossil idol what do u mean bloxxin udim?

pearl lynxBOT
#

studio** You are now Level 2! **studio

flint python
#

it maybe expectes udim2 or just udim. U may typed it wrong or smth

fossil idol
#

solved

fossil idol
flint python
#

Wha?