player.Character.Head.OverHeadGUI.Frame
like that?
If you have parented the GUI on the head already, then yes.
But I want it to be automatic that you dont need to type your username
Do I need to use :FindFirstChild(“Head”)
Then parent the GUI after their character is loaded, using a game.Players.PlayerAdded event and then a player.CharacterLoaded event.
game:GetService('Players').PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local Head = Character:WaitForChild('Head');
-- Code...?
end)
end)
So it will be Character.Head
right
Thanks maybe it will be fixed I’m trying it in roblox studio
Since you want a tag above others’ heads, you can loop through all the Players in the service with :GetPlayers()
.
for _, Player in pairs(Players:GetPlayers()) do
local Head = Player.Character:FindFirstChild("Head")
if Head then
-- Test if head has tag or something?
-- then add a tag if it does not.
end
end
If someone dies the Character will reload without the GUI so its better to do it with events like I said before.
I believe it’d be better to use PlayerAdded
in your scenario.
@Itz_Louu’s code should work better for automatically adding tags unless you need to do something else with the tags or the heads after making them.
IDK if this is right
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local Head = character:WaitForChild("Head")
Head.OverHeadGui.Frame.IconHolder.Computer.Visible = true
end)
end)
Assuming the “OverheadGui” is already parented, it should work.
If not, you can Clone the Gui & Parent it to the Character’s Head.
But I already cloned it and I don’t want the gui get double
So it should work, no?
Check if the Gui is parented to the Character’s Head.
Its parented into the player head because when player join he will get the OverHeadGUI and I just only need a delay or way like 0.5 seconds
BTW which is better wait() or delay()?
Why don’t you just use WaitForChild?
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local Head = Character:WaitForChild("Head")
Head:WaitForChild('OverHeadGui').Frame.IconHolder.Computer.Visible = true
end)
end)
Yeah but I want to delay it for 0.5 seconds because I want to parent the OverHeadGUI to player head first