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
 

I have an error in this script, but can't find what it is

Previous Thread :: Next Thread 
Gybron is not online. Gybron
Joined: 02 Sep 2009
Total Posts: 1747
16 Aug 2014 07:49 AM
So, this script removes a morph called "Chest" from player character. But if you click it twice, it breaks, since it finds nothing to delete in the second click. How can I fix that? thank thee


wait(1)
player = game:GetService("Players").LocalPlayer
gui = script.Parent
button = gui.Button
button.MouseButton1Down:connect(function()
local found = player.Character:findFirstChild("Chest")

if found then
end
found:Destroy()
player.Character.Humanoid.MaxHealth = 100
wait(0.1)
end)
Report Abuse
Vinny0TheMinecrafter is not online. Vinny0TheMinecrafter
Joined: 12 May 2014
Total Posts: 54
16 Aug 2014 07:56 AM
can you give the output of the script
Report Abuse
Gybron is not online. Gybron
Joined: 02 Sep 2009
Total Posts: 1747
16 Aug 2014 08:04 AM
ROBLOX site somewhy errors when I copypasted output's stuff in here, so I had to take a gyazo pic

http://gyazo.com/ae85463c4a8d4882426637d9d9c61da0
Report Abuse
Vinny0TheMinecrafter is not online. Vinny0TheMinecrafter
Joined: 12 May 2014
Total Posts: 54
16 Aug 2014 08:14 AM
if the spot where it says found:Destroy
does that need a number try typing 1 then if not copy it then delete it so its still saved and then test it one last thing when you run a script and its gonna do something to you character i would play solo and it should work so try typing a number then if that doesn't work when you test it in play solo try deleting it and test it again

please try both ways
Report Abuse
Kodran is not online. Kodran
Joined: 15 Aug 2013
Total Posts: 5330
16 Aug 2014 08:17 AM
wait(1)
player = game:GetService("Players").LocalPlayer
gui = script.Parent
button = gui.Button
button.MouseButton1Down:connect(function()
local found = player.Character:FindFirstChild("Chest")
if found ~= nil then
found:Destroy()
player.Character.Humanoid.MaxHealth = 100
wait(0.1)
end
end)
Report Abuse
Gybron is not online. Gybron
Joined: 02 Sep 2009
Total Posts: 1747
16 Aug 2014 08:23 AM
Ok, thanks :P
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