Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why does only 1 player have their credits showing???[SOLVED]

function join(hit)
while true do wait()
local credits=script.Parent
PlayerCredits=hit.Credits.Value
credits.Text="Credits:"..PlayerCredits
end
end
game.Players.PlayerAdded:connect(join)

Basically, this script will only show the credits for one player. If there are 2 players, only one of the players has their Credits showing on their GUI.

4 comments

0

more details please? what is written makes it look like its working normally

0

When I test this in server mode with 2 players only 1 players has their credits showing, so say one player has 20 credits and the other also has 20 credits, only one of those players have their credits showing on the GUI

0

Is this in a local script?

0

Line 2 "while true do wait()", why do you ever expect it to leave that loop?

2 answers

game.Players.ChildAdded:connect(function(hit)
while true do wait()
local credits=script.Parent
local PlayerCredits=hit.Credits.Value
credits.Text="Credits:"..PlayerCredits
end
end)

This is a guess, not sure where the script is supposed to go.

1 comment

0

This would have the same outcome as PlayerAdded and ChildAdded are essentially the same thing, eitherway I solved my problem.

This discussion is preserved as it was. New answers, comments, and votes are closed.