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

Not sure how to work with the UDim2 property here?

for the most part this script is working well, but I'm not really sure how to work around the position of the head with the UDim2 property of the position of the guis, is there any way I can try to make sure it will move above the players head? I'm working with a billboard gui:

funbutton.MouseClick:connect(function()
	
	if bool == true then
		bool = false
		
		bord.Parent = playersChar.Head
		frame.Visible = true
		frame.Position = UDim2.new{0, 50},{0, 20}
		
		nametext.Text = player.Name
		frame.BackgroundColor = playersChar.Torso.BrickColor
		
	end
end)

3 answers

✓ Accepted answer
funbutton.MouseClick:connect(function()

    if bool == true then
        bool = false

        bord.Parent = playersChar.Head
        frame.Visible = true
        frame.Position = UDim2.new(0, 50,0, 20) -- The format for UDim2 is (a,b,c,d)
-- {a,b}{c,d} well put number wise

        nametext.Text = player.Name
        frame.BackgroundColor = playersChar.Torso.BrickColor.Color -- converts BrickColor to Color3 values with BrickColor.Color
	bool = true -- you forgot to make sure your debounce is set back
    end
end)

1 comment

0

I actually only want it to fire once, aside from that thanks for the detailed answer!

The UDim2.new constructor works as

UDim2.new(
  number ScaleX,
  number OffsetX,
  number ScaleY,
  number OffsetY
)

So {1,2}{3,4} literally becomes UDim2.new(1,2,3,4)

When operating with UDim2.new you use Parenthese instead of the curly brackets.

UDim2.new(0,50,0,20)

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