Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make a GUI over a certain users head?

Asked by
Zyphx 0
10 years ago

I'm a complete noob at scripting, and I aspire to learn. I want to know, How I can make a GUI over a CERTAIN users head? I am going to make a Hunger Games Group, and during the Arena I want a GUI over the users head saying What District they are ( "District 10" , "District 3". ) How would I script that, ONLY have that GUI over a certain persons head.******

2 answers

Log in to vote
0
Answered by
TopDev 0
10 years ago

Here you go!

player = game.Players.Player1



local b = Instance.new("BillboardGui", player.Character.Head)
b.Size =UDim2.new(6,0,2,0) 
b.StudsOffset = Vector3.new(0,3,0)
local text = Instance.new("TextLabel",b) 
text.Size = UDim2.new(1,0,1,0) 
text.BackgroundTransparency = 1
text.Text = "Test" -- Change the text here!
text.FontSize = "Size36"
text.Font = "Legacy"
Ad
Log in to vote
0
Answered by 10 years ago

I think this is what you want. I also added in a way to change the color of the rank.

game.Workspace.ChildAdded:connect(function(obj)     
    if (obj:IsA("Hat")) then                                
        wait(1)                                             
        if (obj.Parent == game.Workspace) then
            obj:Destroy()
        end
    end
end)


groupid = 0 --Your group id goes here
game.Players.PlayerAdded:connect(onPlayerRespawned)
function onPlayerRespawned(newPlayer)
wait(1)
if newPlayer:IsInGroup(groupid) then
guigroup=Instance.new("BillboardGui")
guigroup.Parent=newPlayer.Character.Head
guigroup.Adornee=newPlayer.Character.Head
guigroup.Size=UDim2.new(4,0,2,0)
guigroup.StudsOffset=Vector3.new(0,2.5,0)
textgroup=Instance.new("TextLabel")
textgroup.Size=UDim2.new(1,0,1,0)
textgroup.BackgroundTransparency = 1
textgroup.TextColor3 = Color3.new(255/255, 255/255, 255/255)
textgroup.TextStrokeTransparency = 0
textgroup.TextTransparency = 0
textgroup.FontSize = 'Size24' 
UnrefinedRank = newPlayer:GetRankInGroup(groupid)
UnrefinedColor = newPlayer:GetRankInGroup(groupid)
Person = newPlayer.Name

if UnrefinedRank and UnrefinedColor == 255 then --Rank Level goes here, You can find it by clicking group admin then clicking permissions
UnrefinedRank = "RANK NAME HERE"
textgroup.TextColor3 = Color3.new(255/255, 255/255, 255/255) --This uses rgb color codes, only change the first 255 so it would like anything like 29/255, 155/255, 90/255
end

textgroup.Text = ('  ' .. UnrefinedRank .. " ")
textgroup.Parent=guigroup
end
end

function onPlayerEntered(newPlayer)
newPlayer.Changed:connect(function (property) 
if (property == "Character") then
onPlayerRespawned(newPlayer)
end
end)
end

game.Players.PlayerAdded:connect(onPlayerEntered)

Answer this question