-
What do you want to achieve?
I own a restaurant group that is currently in construction. I created one of those over-head GUIs like in other roleplay games stating the player’s username and role in the group. -
What is the issue?
I am currently receiving no errors, but when a player resets the GUI is gone. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I searched far and wide, but I came across nothing compatible with my system.
This is the script at it’s current state (Note: it’s parent is Workspace):
local plrs = game:GetService("Players")
local group = 5513883
local function GiveTag(plr)
repeat wait(0.1) until plr.Character
local char = plr.Character
char:WaitForChild("Humanoid").DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
local tag = game:GetService("ReplicatedStorage"):WaitForChild("Tag"):Clone()
tag:WaitForChild("User").Text = plr.Name
tag:WaitForChild("Rank").Text = plr:GetRoleInGroup(group)
tag.Parent = char:WaitForChild("Head")
char.Humanoid.Died:Connect(function()
char:WaitForChild("Humanoid").DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
local tag = game:GetService("ReplicatedStorage"):WaitForChild("Tag"):Clone()
tag:WaitForChild("User").Text = plr.Name
tag:WaitForChild("Rank").Text = plr:GetRoleInGroup(group)
tag.Parent = char:WaitForChild("Head")
end)
end
wait()
plrs.PlayerAdded:Connect(function(plr)
pcall(function()
coroutine.wrap(GiveTag(plr))
end)
end)
I would appreciate if someone would explain to me what I did wrong, and help me fix my script.
Thanks in advance!