I wanted to compare gui position to number and something went wrong

(I researched devforum about it but nothing helped)
I made an script that player can move a gui object and i wanted to put a gui height limit but something i did wrong i guess, where?

while true do
	if script.Parent.Position.Y.Scale < -0.083 then
		script.Parent.Position.Y.Scale = -0.083
	end 
	wait()
end

In my opinion, this is not the way to do this. Try using Gui Collisions instead

1 Like

Is there any errors? We need to know what went wrong to help. Did it error, did it just not work?

No, zero errors, its just not working

Have you tried just doing position.Y?

I did now but it wont work and shouldn’t tho, any other tip?

Ooh, I have an idea, have you tried putting a print in the while loop?
If it outputs then it’s running if not it’s something wrong with a different part of the script

I tested it and printing stops at “if” thing

Something id suggest is you put a print function that constantly prints the y scale position. Then, if the scale position actually does go below that and doesn’t work, then you might need to try something else

1 Like

I tried that and gui position is not changing when i move it, idk how lol

Can you record a video of whats wrong?

Is the gui going above the screen?

Again, I highly suggest you use GUI collisions. It makes these things way easier and simple

I recorded it before on main post but i can again:

Wow sorry I thought it was an image. Oops

What @ChickHenEn said is probably the solution, I’m not a gui person, I’m better a scripting. Sorry

1 Like

ill try this, this is (xd) pointless thank you guys for help and if you found whats wrong in this script you can notify me

I have an idea, can you show me the gui hierarchy?

Everythings fine in the gui i guess, i already used guicollisionservice to fix problem

1 Like