Trying to learn how to use billboard guis to make team change, and other things

Hello! I am officially a new member, so I can finally start asking the questions.

I’ve been trying to find ways to learn how to use billboard guis to make team change scripts or ways to open doors, with no luck.

Does anyone have any suggestions on where I should be looking??

Thank you!

3 Likes

Billboards are really easy, they don’t even need a some sort of way of teaching them.
They are just 2D uis that follow your looking direction.
And to learn how to use them, just hop in to studio and start checking them out.
And here is a little headstart I guess it’s old but should do.

And really to learn any topic, just do some research by yourself to find good stuff and never stop learning

1 Like

Assuming you have prior familiarity and experience with scripting, you could look at the BillboardGui documentation page as a start. The Developer Hub has a lot of information you’ll need.

BillboardGuis aren’t something you learn how to use. How to apply them into your game is what you learn how to do. It’s like the difference between knowledge and wisdom.

You’re probably looking more for a ScreenGui in terms of a team changer. For a door opening mechanic, there’s a bit more involved. You’d definitely want to use the BillboardGui, but keep it static. Interactions can be handled via UserInputService or ContextActionService. Determining when to show the Gui and accept interactions can be done via checking position between the character and the door.

2 Likes

The wiki is a great place to look. BilboardGUIS are like SurfaceGUIs, but they are floating 2D-3D Images.

Heres some links to start:

https://developer.roblox.com/en-us/api-reference/class/BillboardGui
https://developer.roblox.com/en-us/articles/Intro-to-GUIs

1 Like

I see, how would I go about if I also wanted some doors to be opened lets say, by a certain team or group?

To find out if someone is in a group you can use the method :IsInGroup(groupId) on a player object. Furthermore, if you wish to find out what team a player is on you can use the property .Team which is also on a player object which I will provide in the example below.

Example:

game.Players.PlayerAdded:Connect(function(player) 
    print("Player is on team;", player.Team)
    if player:IsInGroup(groupId) then
         print(player.Name, "is in the group")
    end
end)
2 Likes

I’ve created something you can use and look at, this includes team only doors, and team switch. These aren’t the most efficent methods, but should be helpful in your case. Here is some videos of this in action;

Team Change;

Team Only Doors;

ServerSide of code;

local Replicated = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local Doors = game.Workspace.TeamDoors
--\\Main//
Replicated.TeamChange.OnServerEvent:Connect(function(plr,Team)
local plrFind = Players:FindFirstChild(plr.Name)
if plrFind then
  if plrFind.TeamColor ~= BrickColor.new(Team) then  --checks if player is not in the team already
    plrFind.TeamColor = BrickColor.new(Team)
  end
end
end)
--\\Doors Main//
--Prisoner
Doors.Prisoner.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
  local char = hit.Parent
  local FindPlayer = Players:GetPlayerFromCharacter(char)
  if FindPlayer then
    if FindPlayer.TeamColor == BrickColor.new("Bright orange") then --put the team color
      Doors.Prisoner.CanCollide = false
      wait(1)
      Doors.Prisoner.CanCollide = true
    end
  end
end
end)
--Police
Doors.Police.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
  local char = hit.Parent
  local FindPlayer = Players:GetPlayerFromCharacter(char)
  if FindPlayer then
    if FindPlayer.TeamColor == BrickColor.new("Lapis") then --again, put the team color
      Doors.Police.CanCollide = false
      wait(1)
      Doors.Police.CanCollide = true
    end
  end
end
end)

ClientSide of code

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
--\\Team Function//
function rt(Team)
  ReplicatedStorage.TeamChange:FireServer(Team)
end
--\\Police//
game.Workspace.TeamButtons.Police.SurfaceGui.TextButton.MouseButton1Click:Connect(function()
rt("Lapis") --Team color
end)
--\\Prisoner//
game.Workspace.TeamButtons.Prisoner.SurfaceGui.TextButton.MouseButton1Click:Connect(function()
rt("Bright orange")--Team color
end)
--Teams are optional, make sure to customize to how you wish! This is just an example.

What this should look like in Explorer;
image

And the file download;
TeamDoors_AndTeamChange_DevForum.rbxl (20.2 KB)

I hope this helped. If you have any questions or concerns let me know. Have a good day!

https://i.imgur.com/8Z7bHMv.png This is what I was mostly thinking about.

I don’t think I am going to spend time to make you a keybind system for doors. I gave you this file as an example of what you should be doing, basically the base to the building. I hope you found this helpful though!

Here’s one way to accomplish the result you’re looking for in that picture.
Create an anchored invisible “hitbox” that takes up the space of the door and surrounding area.
Use the BasePart.Touched event to detect when a player gets near the door.

local hitBox = --put the location of the hitbox here
hitbox.Touched:Connect(function(part)
    if part.Parent:FindFirstChild("Humanoid") then --Check if what touched the hitbox is a player
        local player = game.Players:GetPlayerFromCharacter(part.Parent)
        --check if the player is on the right team
        --notify the client to display a screenGUI showing the hotkey
    end
end)

if the player is part of the right group, then use a RemoteEvent to tell a LocalScript in the client to display a ScreenGUI that says to open the door by pressing the hotkey, like in the picture.
Then, to detect the keyboard input, use UserInputService.InputBegan as follows:

UserInputService.InputBegan:Connect(function(input, gameProcessed)
    if input.UserInputType == Enum.UserInputType.Keyboard and not gameProcessed then
       local keyPressed = input.KeyCode
           if keyPressed == Enum.KeyCode.E then --insert the key letter you want here
              --use a remoteEvent to notify the server to open the door
          end
    end
end)

If you’re unfamiliar with how to use RemoteEvents, I encourage you to read this:
https://developer.roblox.com/en-us/articles/Remote-Functions-and-Events