Hi,
So I made a team and a part that puts players in that team when they touch it, but now my goal is to make that if the player is in that team their face and name show up on a part.
I’m not too sure how this is achieved. Any help is very much appreciated.
So far I have this:
local team = game.Teams:FindFirstChild("Caretaker")
local displayPart = script.Parent
local surfaceGui = displayPart:WaitForChild("SurfaceGui")
local imageLabel = surfaceGui:WaitForChild("ImageLabel")
local textLabel = surfaceGui:WaitForChild("TextLabel")
local function updateDisplay()
-- Find a player in the team
for _, player in ipairs(game.Players:GetPlayers()) do
if player.Team == team then
-- Set the image to player's face
imageLabel.Image = "rbxthumb://type=AvatarHeadShot&id=" .. player.UserId .. "&w=150&h=150"
-- Set the text to the player's name
textLabel.Text = player.Name
-- Update the visibility
imageLabel.Visible = true
textLabel.Visible = true
return
end
end
imageLabel.Visible = false
textLabel.Visible = false
end
-- Update the display every 1 sec
while true do
updateDisplay()
wait(1)
end