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)
Torso.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if Players:FindFirstChild(hit.Parent.Name) then
local NewGui = Gui:Clone()
NewGui.Parent = hit.Parent
NewGui.Adornee = hit.Parent.Head
Gui:Destroy()
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")
Players.PlayerAdded:Connect(function(plr)
if Tagger == false then
Tagger = true
repeat
wait()
until plr.Character.Head
Gui.Parent = plr.Character
Gui.Adornee = plr.Character.Head
end
end)
Haven't tested this out but it should work.
5 comments
Do you need help with making the gui or the script that gives the gui to another player? or both
wouldn't the gui go into lighting or something? but the scripting part.
For the script, when the player with the gui touches another player (use .Touched), change the gui's adornee to the other player's head.
Use a BillboardGui and parent it to the player's character.
so like script.Parent = game.Player.LocalPlayer.Character.Head?