|
| 02 Jan 2016 04:38 PM |
I need to know what my problem is so I can progress in lua scripting. Heres the code with no errors in the output.
if game.Players.NumPlayers~=0 then print("More than 0") game.Players.PlayerAdded:connect(function(player) local gui=Instance.new("ScreenGui", game:WaitForChild("StarterGui")) local label=Instance.new("TextLabel", gui) label.Position=UDim2.new(0,450,0,-50) label.Size=UDim2.new(0,400,0,50) label:TweenPosition(UDim2.new(0,450,0,0), "Out", "Bounce", 2) label.BackgroundColor3=Color3.new(200,255,0) label.TextScaled=true label.TextColor3=Color3.new(0,0,0) label.Text=player.Name.."has joined!" wait(3) label:Destroy() end) end |
|
|
| Report Abuse |
|
|
| |
|
|
| 02 Jan 2016 05:12 PM |
local gui=Instance.new("ScreenGui", game:WaitForChild("StarterGui"))
The Legend of Heroes Sen no Kiseki |
|
|
| Report Abuse |
|
|
Netakra
|
  |
| Joined: 02 Dec 2015 |
| Total Posts: 606 |
|
|
| 02 Jan 2016 05:13 PM |
The issue is that this is in a regular script in workspace I believe, so it checks if the number of players is more than 0 right when the server is loading up, so before the player even enters the game. That way, it will not run the game.Players.PlayerAdded() event.
Try doing the playerAdded function first and deleting the number of players check, it's not needed. |
|
|
| Report Abuse |
|
|
Netakra
|
  |
| Joined: 02 Dec 2015 |
| Total Posts: 606 |
|
|
| 02 Jan 2016 05:15 PM |
Are you just trying to make it display a gui saying that a player has joined?
Just make the gui and once it's all set up, insert it w/ a for loop into all the player's PlayerGuis and then remove it after 3 seconds via for loop again.
|Netakra| |
|
|
| Report Abuse |
|
|