강좌모음

머리에 이름, 팀, 역할 표시하기 #2 - 줌에 따라 확대/축소

작성자
nobakee
작성일
2022-08-15 17:23
조회
457

머리에 이름, 팀, 역할을 함께 표시해주는 스크립트입니다

print("Overhead Display v1.1")
-- GUIDE
-- move this script file under 'ServerScriptService' folder in Explorer
-- move 'OverheadDisplay' GUI under 'ServerStorage' folder in Explorer
-- you can change GROUP_ID 42 what you want 
-- If you have any bug or question, please contact me - nobakee 


local overheadDisplay = game:GetService("ServerStorage"):WaitForChild("OverheadDisplay")
local GROUP_ID = 42 -- change your groupID

local function addLabel(player)

    player.CharacterAdded:Connect(function(character)

        local playerDisplay = overheadDisplay:Clone()

        playerDisplay.NameTextLabel.Text = player.name
        
        if player.Team then
            local TeamString = player.Team.Name
            playerDisplay.TeamTextLabel.Text = TeamString
        end
        

        local RoleString = player:GetRoleInGroup(GROUP_ID)
        playerDisplay.RoleTextLabel.Text = RoleString


        playerDisplay.Parent = game.workspace:waitForChild(player.Name).Head
        character.Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
    end)


end

game.Players.PlayerAdded:Connect(addLabel)
전체 0