Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

GUI positioning help?[Solved]

I just want to know what to do to make this actually move, I've pointed out where my confusion is.

while true do
	wait(1)
	Value = math.random(100,500)
	if script.Parent.Parent.Tool.Enabled == true then
	script.Parent.Position = (Value,Value) --Not sure how to format this
	end
end

Edit

while true do
	wait(1)
	Value = math.random(100,500)
	if script.Parent.Parent.Tool.Enabled == true then
	script.Parent.Position = UDim2.new(0,Value,0,Value)
	end
end

ANY Help is appreciated! Thanks!

4 comments

0

I haven't done what you're doing currently. Although, try this for line 5: script.Parent.Postiion = UDim2.new(Value,Value)

0

What are you trying to do? Continuously have this shift around your screen?

0

Not necessarily, but knowing how to get it to do that will make it easy to do what I want.

0

Nvm, im just an idiot lol, my hierarchy wasn't correct

2 answers

✓ Accepted answer

UDim2's are the way GUI's position themself on-screen. They take scales and offsets. Scales are values from 0 to 1 while offsets can be anything as it gets the actual pixel distance. Don't do what chill did and make the scale over 1, otherwise the GUI won't even be on the screen.

while wait(1)
    Value = math.random(100,500)
    if script.Parent.Parent.Tool.Enabled == true then
    script.Parent.Position = UDim2.new(0,Value,0,Value)
    end
end

You should use the UDim2 keyword, Just Like CFrame is used for moving Parts UDim2 is used for moving GUI's

script.Parent.Position =UDim2.new (Value, Value, Value, Value) -- Since there are 4 values in The Gui you have to input 4 values

4 comments

0

Thank you!

0

You are welcome

0

It's still not quite working.

0

because the Value is only one number not 2.

This discussion is preserved as it was. New answers, comments, and votes are closed.