Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Text and Servers?

Asked by 7 years ago
game.Players.PlayerAdded:connect(function(player)

    local hint=game.StarterGui.PlayerAdded.Hint
    hint.Text=player.Name.." has joined the game."
    wait(3)
    hint.Text=nil
end)


game.Players.PlayerRemoving:connect(function(player)
    local hint=game.StarterGui.PlayerAdded.Hint
    hint.Text=player.Name.." has left the game."
    wait(3)
    hint.Text=nil
end)

This is a normal script in serverscriptservice. The hint isnt actually a hint it is a textlabel. So the problem is that when the script runs it says the player has joined the game and the text just stays there. And when someone else joins the text should be replaced to the new person who has joined the game but it just stays there

0
You have made the mistake of using StarterGui. https://scriptinghelpers.org/blog/common-mistakes#PlayerGui User#5423 17 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

Hi! Your issue is using StarterGui. Your fixed script is here:

game.Players.PlayerAdded:connect(function(player)

for i,v in pairs(game.Players:GetChildren()) do
    local hint= v.PlayerGui.PlayerAdded.Hint
    hint.Text= player.Name.." has joined the game."
    wait(3)
    hint.Text= nil
end
end)


game.Players.PlayerRemoving:connect(function(player)
for a,b in pairs(game.Players:GetChildren()) do
    local hint=b.PlayerGui.PlayerAdded.Hint
    hint.Text=player.Name.." has left the game."
    wait(3)
    hint.Text=nil
end
end)

Ad

Answer this question