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 » Scripting Helpers
Home Search
 

Re: My first Gui

Previous Thread :: Next Thread 
makerror is not online. makerror
Joined: 29 Aug 2011
Total Posts: 493
03 Jul 2013 04:30 AM
script.Parent.MouseButton1Click:connect(function()

button = script.Parent
frame = button.Parent
gui = button.Parent
playergui = gui.Parent
player = playergui.Parent

char = game.Workspace:FindFirstChild(player.Name)
if char ~= nil then
h = char:FindFirstChild("Humanoid")
h.Health = 0
end
end)

I made a text button in Gui's frame and a localscript in button. Tried to add reset function, but everytime I click nothing happens, no errors too, what wrong I did?
Everything is in starterGui

Can MouseButton1Click return player object, if I use argument?
Report Abuse
immithebest is not online. immithebest
Joined: 07 Mar 2012
Total Posts: 221
03 Jul 2013 08:02 AM
You want a reset gui? If it is then

function onButtonClicked()
script.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0
end

script.Parent.MouseButton1Click:connect(onButtonClicked)

Try for the reset gui. (If you want one.)
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
03 Jul 2013 08:04 AM
Simplest:

script.Parent.MouseButton1Down:connect(function()
if script.Parent.Parent.Parent.Parent then
script.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0
end
end)
Report Abuse
greatarchon999 is not online. greatarchon999
Joined: 09 Jun 2011
Total Posts: 772
03 Jul 2013 08:06 AM
==gui = frame.Parent==
NOT
==gui = button.Parent==
Report Abuse
ExtraTelamon is not online. ExtraTelamon
Joined: 26 Dec 2011
Total Posts: 4629
03 Jul 2013 08:34 AM
function onButtonClicked()
script.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0
end

script.Parent.MouseButton1Down:connect(onButtonClicked)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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