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

HP BillboardGUI on players?

Asked by 9 years ago

Well, recently, I've been trying to script something that involves putting a custom Health GUI on top of player's heads, that, and a bit of practice to learn how other GUI's work. Unless there's a better idea how to do this, i'll just do it in this manner because once the other players distance from the GUI, the GUI becomes invisible to them.

01function grabplayers(plr)
02    for i, player in ipairs (game.Players:GetPlayers()) do
03    local Playername = player.Name
04 
05    if player.Character and plr.PlayerGui:FindFirstChild(Playername)== nil then
06        local Billboard = Instance.new("BillboardGui",plr.PlayerGui)
07        Billboard.Name = player.Name       
08        Billboard.Adornee = player.Character.Head
09        local clonehpthing = player.PlayerGui.ScreenGui.HP:Clone()
10        clonehpthing.Parent = Billboard
11        clonehpthing.Position = UDim2.new(0,0,0,0)
12        clonehpthing.Size = UDim2.new(0,130,0,10)
13        clonehpthing.Health:Destroy()
14        clonehpthing.BorderSizePixel = 1
15        print ("It finally works")
View all 34 lines...

There's no errors in the output, but i think i wrote the script a bit wrong. Also, if there's anything missing (Specifications, etc) i'll add more details (That is, if I can and it's relatable to the problem.)

Oh yeah, and the script is in Workspace

EDIT: The GUI is there (As demonstrated by typing game.Players.Username.PlayerGui.OtherUser.Name) And the HP object is there too. However, when i write: game.Players.Username.PlayerGui.OtherUser.HP.Visible = true , nothing happens, and HP is clearly there, showing no errors in the command.

1 answer

Log in to vote
0
Answered by 9 years ago

I changed some of the things for the BillboardGUI, and now it's working with a few bugs. ( Like DistanceAppear not working at all...)

Ad

Answer this question