so, what i'm trying to do is make a fun lil tag game but i can't figure out how to make a gui that says (it) over their head and when u touch another player it moves to their head, for better understanding
you got a (it) text over your head, i see a player, ima go over and tag him.. i tag him, the text goes from my head to his head.
Assuming the gui is in a player's character-
local Players = game:GetService("Players") local Gui = script.Parent local GuiOwner = Gui.Parent local Torso = GuiOwner.Torso wait(.5) -- Waits half a second so that the person can't tag back instantly. Torso.Touched:Connect(function(hit) -- Happens when the torso gets touched. if hit.Parent:FindFirstChild("Humanoid") then -- Checks if what the player touched has a humanoid. if Players:FindFirstChild(hit.Parent.Name) then -- Checks if it's a player. local NewGui = Gui:Clone() -- Clones the tag. NewGui.Parent = hit.Parent -- Parents the new tag to the touched player. NewGui.Adornee = hit.Parent.Head -- Puts the tag above the touched player's head. Gui:Destroy() -- Destroys the tag above the old player. end end end)
when i join game, the gui doesn't appear over my head, trying to get it where who ever joins game first is it lol.
local rs = game:GetService("ReplicatedStorage") local Players = game:GetService("Players") local Tagger = false local Gui = rs:WaitForChild("Gui") -- Or where ever you have the gui Players.PlayerAdded:Connect(function(plr) if Tagger == false then Tagger = true -- So it only happens for the first player repeat wait() until plr.Character.Head -- Waits until the player's character is spawned and the head is found. Gui.Parent = plr.Character Gui.Adornee = plr.Character.Head end end)
Haven't tested this out but it should work.