generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Simple 20 line script not working. Whaaaaaaaaaaat?

Previous Thread :: Next Thread 
Lecturous is not online. 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 is not online. Lecturous
Joined: 17 Aug 2013
Total Posts: 1096
28 Jan 2015 09:54 PM
...
Report Abuse
LucasLua is not online. 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 is not online. Lecturous
Joined: 17 Aug 2013
Total Posts: 1096
28 Jan 2015 10:02 PM
Aw crap.
Report Abuse
Lecturous is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image