Lecturous
|
  |
| Joined: 17 Aug 2013 |
| Total Posts: 1096 |
|
|
| 28 Jan 2015 09:38 PM |
local frame = script.Parent local sword = frame.Swordsmith local heavy = frame.Heavy
game.Players.PlayerAdded:connect(function(plr) frame.Visible = true local class = plr:FindFirstChild('Class') local hum = plr.Character:FindFirstChild('Humanoid') if class and hum then sword.MouseButton1Down:connect(function() class.Value = 'Swordsmith' hum.Health = 0 end) heavy.MouseButton1Down:connect(function() class.Value = 'Heavy' hum.Health = 0 end) end end)
The script is a server script. The script is inside the frame. The buttons are inside the frame. Even the frame is not visible.
Whaaaaaaaaaaaat? |
|
|
| Report Abuse |
|
|
Lecturous
|
  |
| Joined: 17 Aug 2013 |
| Total Posts: 1096 |
|
| |
|
LucasLua
|
  |
| Joined: 18 Jun 2008 |
| Total Posts: 7386 |
|
|
| 28 Jan 2015 10:00 PM |
| Assuming you have it in StarterGui, you should already be in a player and so using PlayerAdded will not work. Simply get to the player through your hierarchy and you should be fine. |
|
|
| Report Abuse |
|
|
Lecturous
|
  |
| Joined: 17 Aug 2013 |
| Total Posts: 1096 |
|
| |
|
Lecturous
|
  |
| Joined: 17 Aug 2013 |
| Total Posts: 1096 |
|
|
| 28 Jan 2015 10:11 PM |
Alright. But now, I have encountered another problem. :S
I wanted to destroy the frame for the rest of the time while the player is in the server. That did not work out quite well. I'll also put in some code to give the players weapons when they click the button, but I can probably handle that.
How do I delete the GUI when the player is finished selecting their class? |
|
|
| Report Abuse |
|
|
LucasLua
|
  |
| Joined: 18 Jun 2008 |
| Total Posts: 7386 |
|
|
| 28 Jan 2015 10:24 PM |
| Have it start as invisible and come up have it appear after doing a check to see if a class has already been selected. |
|
|
| Report Abuse |
|
|