Hi, this is a script which is meant to duplicate a overhead gui, and set it to appear over every players head. I have tried many things and I cant find out why it doesnt work
game.Players.PlayerAdded:Connect(function(plr) plr.CharacterAdded:Connect(function(char) char.Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None local gui = game.ServerStorage.OverheadGui local clone = gui:Clone() clone.Parent = workspace clone.Adornee = char.Head local frame = clone.Frame local name = frame.PlrName name.Text = plr.Name print(plr.Name.." has joined - gui given!") while wait() do name.Text = plr.RpName.Value end end) end)
Here is the issue: when testing, the gui goes above my head which my name, but doesnt go above anyone elses head with theirs. I tried it in a 2 player test server in studio and it worked for both players. Help would be much appreciated, cheers.
It's probably because of CharacterAdded
event not working all the time. I recommend putting the script inside StarterCharacterScripts
inside StarterPlayer
.
-- Normal script inside StarterCharacterScript local Players = game:GetService("Players") local ServerStorage = game:GetService("ServerStorage") local character = script.Parent local humanoid = character:FindFirstChildWhichIsA("Humanoid") local player = Players:GetPlayerFromCharacter(character) humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None local gui = ServerStorage.OverheadGui local clone = gui:Clone() clone.Name = player.UserId clone.Parent = character.Head clone.Adornee = character.Head local frame = clone.Frame local name = frame.PlrName local rpName = player.RpName name.Text = (not rpName.Value:match("^%s*$")) and rpName.Value or player.Name print(player.Name.." has joined - gui given!") rpName:GetPropertyChangedSignal("Value"):Connect(function() name.Text = (not rpName.Value:match("^%s*$")) and rpName.Value or player.Name end)