Showing a Billboard GUI ONLY to a chosen pair of players

Hello there.

How would I make a billboard GUI that only shows on two players? Lets say they are duelling each other, I want only them to see each other’s health and stamina. Everyone else will just see them duelling normally. How would I do this?

I tried to use the PlayerToHideFrom property of BillBoardGui’s but I can’t fully understand it. Does it need the character of the player? Can it only be one player to choose to hide from?

Thanks in advance.

2 Likes

There is a BillboardGui property called PlayersToHideFrom. You should be able to make a table and add all spectating players into it. However, I haven’t used this myself so I can’t give you a step-by-step on how to use it. Alternatively you can do what @lachydachydoo2 said and run it on the client side. It’s just down to preference.

1 Like

im new to scripting but you might have to use localscripts to enable it to two players
maybe remotefunction/events (idk never really used them)

1 Like

Tried this, it doesn’t receive tables.

PlayerToHideFrom

1 Like

Oh right. Then I would go with enabling it on the client side. You can do this by sending a event to the players that are currently duelling, and enabling it for each of them.

1 Like

Uh… I don’t know. Good luck trying to find it!

2 Likes

I forgot to mention, there are more information that needs to be shared between the two players.

They also need to share which direction they are attacking. They need to update which direction they are aiming at. How do I send these information if I use client side?

Edit: If you are confused, search For Honor 1v1. They have a GUI or some sort on their bodies that tells the information above.

2 Likes

I’m assuming you already have an attack script, if so is it a server or local script? If server this should be quite simple. Every time the player attacks (activates the weapon) send it to the a handling script with the lookVector I believe. Then on the Handling Script make the corresponding changes. So I would send over the Direction, the damage, etc. Then on the handling script, I would make the changes. Hope this helps a little bit. Sorry I can’t guide you directly just a vague answer.

2 Likes

Hey man, I appreciate all the help.

I don’t have an attack script yet, but this is what i planned for it

Player1Attack(Direction,Damage) → Server(Pass info,check if hit) → Player2(Player1GUI updates,react)

Edit1: This is the original plan, but then if the whole server is duelling, I don’t want billboardGUI’s showing all over the place. I know this can be avoided with the Max Dist and all but I don’t want that.

Edit2: If I make a folder that holds all the current billboard GUIs, and then set all the GUIs’s visible property to false using a local script except the GUI’s that they are currently using, Do you think it would work?

1 Like

you can use RemoteFunctions or RemoteEvents. it could be much easier.

This is something that should be done on the client’s side. Servers handling GUI for players is questionable on its own. It only exists due to legacy compatibility and you’ll be heavily limited in further extending the system. Use remotes to send required data from the server and create the billboards on the client.

2 Likes

Yeah so handle this on the client. I hope that you are using the server to manage the teleport and what you would do is fire the remote the the two players, to enable the billboardGui. That should be the issue solved. An example of this would be:

-- Server Side
-- After 2 people have been teleported or chosen to fight
RemoteEvent:FireClient(player1, player2)
RemoteEvent:FireClient(player2, player1)
-- Not sure if you are able to fit that onto the remote maybe using table
RemoteEvent:FireClient({player1,  player2}, {player1, player2})  --?? Not sure if this works, but you may try it

-- Client Side
RemoteEvent.OnClientEvent:Connect(function(opponent)
   local BillboardGui = --ReplicatedStorage? BillboardGui:Clone()
   BillboardGui.Parent = opponent.Character.Head
   local BillboardGuiTwo = -- Define again
   BillboardGuiTwo.Parent = Players.LocalPlayer.Character.Head
end)

Of course this is really rough and you would want to improve this more, but hopefully you got the main idea.

2 Likes

I’m not sure, probably using a Localscript to copy the billboard to the workspace?

Thanks for all you guys help. I managed to do it clientside.