You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I am attempting to make my players have a title.
What is the issue? Include screenshots / videos if possible!
The player event is not firing. it prints out “past wait for child” but the “player added” does not print.
local overheadUI = game:GetService("ServerStorage"):WaitForChild("OverheadUI")
print("past wait for child")
game.Players.PlayerAdded:Connect(function(player)
print("player added")
player.CharacterAdded:Connect(function(char)
if player.UserId == 1242035307 then
local clone = overheadUI:Clone()
clone.Parent = workspace
clone.Adornee = char.Head
clone.Main.Label.Text = "Lead Programmer"
elseif player.UserId == 21835695 then
local clone = overheadUI:Clone()
clone.Parent = char.Head
clone.Main.Label.Text = "Group Owner"
elseif player.UserId == 303373309 then
local clone = overheadUI:Clone()
clone.Parent = char.Head
clone.Main.Label.Text = "Founder"
elseif player:GetRankInGroup(4946462) == 3 then
local clone = overheadUI:Clone()
clone.Parent = char.Head
clone.Main.Label.Text = "Tester"
end
end)
end)
ChatService.SpeakerAdded:Connect(function(speakerName)
local speaker = ChatService:GetSpeaker(speakerName)
local player = game.Players[speakerName]
if player.UserId == 1242035307 then
speaker:SetExtraData("Tags", {{TagText = "Lead Programmer", TagColor = Color3.fromRGB(0, 255, 0)}})
speaker:SetExtraData("ChatColor", Color3.fromRGB(0, 255, 0))
speaker:SetExtraData("NameColor", Color3.fromRGB(0, 255, 0))
elseif player.UserId == 21835695 then
speaker:SetExtraData("Tags", {{TagText = "Group Owner", TagColor = Color3.fromRGB(255, 255, 255)}})
elseif player.UserId == 303373309 then
speaker:SetExtraData("Tags", {{TagText = "Founder", TagColor = Color3.fromRGB(255, 255, 255)}})
elseif player:GetRankInGroup(4946462) == 3 then
speaker:SetExtraData("Tags", {{TagText = "Tester", TagColor = Color3.fromRGB(255, 255, 255)}})
end
end)```
1 Like
I think because you used WaitForChild before the PlayerAdded function remove the first line or put it somewhere else.
2 Likes
while that wont do anything as I said before it goes past it as the print statements prints out fine
Put
local overheadUI = game:GetService(“ServerStorage”):WaitForChild(“OverheadUI”)
after the playerAdded function
1Joeb
(joe)
August 10, 2020, 5:33pm
#7
Where is this script located, and what kind of script is it.
um, no that would work as I reference the overhead UI in the player added function and that wouldnt fix anything as it goes past the wait for child
its a script in server script service. I am familiar with client-server stuff so I know its not that kind of issue
Just put the reference UI after the game.Players.PlayerAdded function it will work
I am familiar with the player added event
Syclya
(zzz)
August 10, 2020, 5:38pm
#14
If this is a localscript, it is because the player is created before the localscript, which means the localscript will run after the player already got added.
um…no it wont, i reference the overhead UI inside the player added I cant really do that and it wont help as like I said 100 times to you it prints out the statement just fine after
its not a local script, I stated that above
nope, this is the only WFC call
jakebball2019:
clone.Parent = workspace
try changing that to
clone.Parent = game.Workspace
Syclya
(zzz)
August 10, 2020, 5:39pm
#19
You don’t even need WaitForChild, it will already exist on the server.
1 Like
Xo_doz
(Xo_doz)
August 10, 2020, 5:41pm
#20
That’s not the point. Instead of saying “that isn't going to work
”, actually help us and try things that are suggested and tell us if they don’t work. You don’t know what will work or not until it’s tried.
game.Players.PlayerAdded:Connect(function(player)
local overheadUI = game:GetService("ServerStorage"):WaitForChild("OverheadUI")
print("player added")
player.CharacterAdded:Connect(function(char)
1 Like
that wont help, if you read it carefully i clearly states its not even firing the event to begin with
I did all those things none of them work.
The reason it doesn’t work is because you put WaitForChild before the player added event.