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

Not sure how to work with the UDim2 property here?

Asked by 8 years ago

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

Log in to vote
0
Answered by
yoshi8080 445 Moderation Voter
8 years ago
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)

0
I actually only want it to fire once, aside from that thanks for the detailed answer! ProgramsMan 100 — 8y
Ad
Log in to vote
1
Answered by 8 years ago

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)

Log in to vote
0
Answered by
rexbit 707 Moderation Voter
8 years ago

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

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

Answer this question