Scripting Help; BillboardGui Positioning Offset

Hi, everyone! :wave:

I’m currently creating 3 different overhead badges for my game. One is for owning a gamepass, one is for owning a badge and one is for being a certain rank+ in my group. I’ve made the scripts for all of these badges so that they appear correctly, although I’m experiencing an issue which is described below. :exclamation:

The issue that I require some assistance with is changing the StudsOffset property of the badges depending on how many badges the player has, so that the badges don’t overlap each other. I need help creating a script that checks if the player has the badge(s), and then changes the StudsOffset appropriately so the badges aren’t overlapping each other. Note that I’m using Clone() to clone the badges to the player, not Enabled. Also, I know this isn’t the place to ask for scripts but I’ve searched widely for a long period of time looking for a solution to this and haven’t found it. If you need further information or scripts, let me know! :grinning_face_with_smiling_eyes:

Note that I already have the StudsOffset positions for the BillboardGuis, let me know if you require them!

Concluding, thank you all in advance for providing assistance with this, I appreciate it heaps! :heart:

Im assuming your using seperate BillboardGui’s for each one?

Yes, I am indeed! Thank you for responding.

Can you take a screenshot of the issue?

You can just change UDim2 values of the badge position if player has previous overhead badges.

For example:

game.Players.PlayerAdded:Connect(function(player) 
player.CharacterAdded:Connect(function(char) 
If player.VIP.Value == true and player.Badge.Value == false then
char.VIPGui.VIPBadge.Position = UDim2.new(startpos)
elseif player.VIP.Value == false and player.Badge.Value == true then
char.BadgeGUI.Badge.Position = UDim2.new(startpos) 
elseif player.VIP.Value == true and player.Badge.Value == true then
char.BadgeGUI.Badge.Position = UDim2.new(startpos) 
char.VIPGui.VIPBadge.Position = UDim2.new(advancedpos) 
       end
    end) 
end) 

As you can see, I have 3 different badge BillboardGuis that are cloned to players depending on different circumstances. As shown, only one of the BillboardGuis displays over the part. This is because they all have the same StudsOffset. I need to make a script that changes these BillboardGuis’ StudsOffset to different values so that they display without overlapping depending on how many badges the player has (the StudsOffset for the BillboardGuis will vary depending on how many badges the player should have).

Could you explain to me how to create an appropriate script that executes this? :grinning_face_with_smiling_eyes:

You should try to adapt them all to the same one. You could make the frame x amount high, then use a UIListLayout to added them in. That will make then go above each other.

I just edit my post check it out :wink:

But like It was mentioned before there are more BillboardGui’s so you cant really use UIListLayout in this case.

Hm, okay! I’ll try merging them all together in to one BillboardGui. Does this mean I don’t need a script that changes the StudsOffset of each badge? Also, a question, let’s say the player doesn’t own the badge in the middle of the two side badges, would there just be a random blank space in the middle or would it automatically change positions to fill up that space and stay centered?

Could you edit this so it check if the BillboardGui’s name exists rather than checking the value, or is this the same thing?

Just change the lines with value to this:

if char.BadgeGUI.Badge.Visible == true then
--your code

UIListLayout will automatically puts visible GuiObjects inside to position below the already visible GuiObject.

Hmm. As told, I’ve put all of the badges in to one BillboardGui. How would I configure this using the idea that @IEnforce_Lawz provided with UIListLayout?

image

First of all parent them to Frame.
And second insert UIListLayout to the frame that you will make with transparency 1 as a parent of these three badges.

Is what I’ve done in the image below correct?

Yes! But make sure that everything is in the scale and the frame is right above player’s head.

The frame is above the players head! Also, I want the badges going diagonally across from each other in a — direction, will this still work? I don’t want them being above each other in an | direction. :cry:

So you mean not like that: = but like: - -?
If yes you can change it to UIGridLayout but it is more “complicated” than the UIListLayout and in properties of the UIGridLayout you can change it if you want it like that :wink:.