|
| 14 Jul 2014 09:31 PM |
any reason why?
i = Instance.new("Hint",workspace)
function joined() if game.Players.PlayerAdded then i.Text = player.Name wait(3) i:Remove() end end |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2014 09:34 PM |
i = Instance.new("Hint",workspace) function joined(player) i.Text = player.Name wait(3) i:Remove() end game.Players.PlayerAdded:connect(joined) The parameter in the joined function called "player" is the actual player that joined, game.Players.PlayerAdded:connect(joined) simply connects that event to the function you want it to execute.
|
|
|
| Report Abuse |
|
|
connor954
|
  |
| Joined: 24 Jul 2008 |
| Total Posts: 947 |
|
|
| 14 Jul 2014 09:37 PM |
Alot of reasons. Just keep practicing :)
i = Instance.new("Hint",game.Workspace)
function Joined(player) i.Text = (player.Name) wait(3) i.Destroy()--Remove sets parent to nil, Destroy actually destroys it end end
function Joined()--You have to call a function, remember that |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2014 09:38 PM |
No connection line Won't work the second time since you're deleting the hint
game.Players.PlayerAdded:connect(function(Player) Hint = Instance.new("Hint",Workspace) Hint.Text = Player.Name game:GetService("Debris"):AddItem(Hint,3) end) |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2014 09:39 PM |
| @Connor, You called the function that requires an object as a parameter and it's meant to be used on players. gg no re. |
|
|
| Report Abuse |
|
|
connor954
|
  |
| Joined: 24 Jul 2008 |
| Total Posts: 947 |
|
|
| 14 Jul 2014 09:39 PM |
OH lol i messed up. I only use game.Players.PlayerAdded:connect(function(player) so much, that i forgot how to do a regualar loop. Just use anonymous's. |
|
|
| Report Abuse |
|
|
connor954
|
  |
| Joined: 24 Jul 2008 |
| Total Posts: 947 |
|
|
| 14 Jul 2014 09:40 PM |
| Yeah. Stupid mistake. Im known for that. |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2014 09:41 PM |
That's not even how you call a function either. still gg no re. |
|
|
| Report Abuse |
|
|
connor954
|
  |
| Joined: 24 Jul 2008 |
| Total Posts: 947 |
|
|
| 14 Jul 2014 09:43 PM |
Here is how i do it.
game.Players.PlayerAdded:connect(function(player) local h = Instance.new("Hint") h.Parent = game.Workspace h.Text = (player.Name) wait(3) h.Parent = nil end) |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2014 09:45 PM |
You should destroy the object if you're never going to use it again. Use local variables if you're not going to use the debris. Your hints will get stuck if two players join 3 seconds apart. |
|
|
| Report Abuse |
|
|
connor954
|
  |
| Joined: 24 Jul 2008 |
| Total Posts: 947 |
|
|
| 14 Jul 2014 10:08 PM |
I didn't know about the "stuck thing", thanks for the info. ~ I mean that sincerely |
|
|
| Report Abuse |
|
|