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: Can anybody tell me the problem with this script?

Previous Thread :: Next Thread 
JoeLuke001 is not online. JoeLuke001
Joined: 04 Oct 2008
Total Posts: 5861
01 Jan 2012 08:56 AM
Part=game.Workspace.Part

function onTouch()
game.Workspace.JoeLuke001.Humanoid.Health=0

end

Part.Touched:connect(onTouch)

It's expected to kill on touch, but it says that my character is no valid part of the Workspace.
Report Abuse
Finloe is not online. Finloe
Joined: 28 Dec 2011
Total Posts: 67
01 Jan 2012 08:58 AM
Humanoid.Health = 0

LOL i think spaces
Report Abuse
UFAIL2 is not online. UFAIL2
Joined: 14 Aug 2010
Total Posts: 6905
01 Jan 2012 08:59 AM
Finloe, you can assign a value without a space.
Report Abuse
Finloe is not online. Finloe
Joined: 28 Dec 2011
Total Posts: 67
01 Jan 2012 09:00 AM
...ive been adding spaces this entire time for no reason...

WHERE HAS MY LIFE GONE D:
Report Abuse
UFAIL2 is not online. UFAIL2
Joined: 14 Aug 2010
Total Posts: 6905
01 Jan 2012 09:01 AM
Part=game.Workspace.Part

function onTouch(hit)
if hit.Parent.Name == JoeLuke001 then
hit.Parent.Humanoid.Health=0
end
end

Part.Touched:connect(onTouch)
Report Abuse
JoeLuke001 is not online. JoeLuke001
Joined: 04 Oct 2008
Total Posts: 5861
01 Jan 2012 09:02 AM
Nope. It also says disconnected event because of exception.

I don't understand scripting to well because I'm still very new to it.
Report Abuse
JoeLuke001 is not online. JoeLuke001
Joined: 04 Oct 2008
Total Posts: 5861
01 Jan 2012 09:04 AM
@Ufail,

Still nothing.
Report Abuse
UFAIL2 is not online. UFAIL2
Joined: 14 Aug 2010
Total Posts: 6905
01 Jan 2012 09:04 AM
Opps.

Part=game.Workspace.Part

function onTouch(hit)
if hit.Parent.Name == "JoeLuke001" then
hit.Parent.Humanoid.Health=0
end
end

Part.Touched:connect(onTouch)
Report Abuse
Evanthepancake is not online. Evanthepancake
Joined: 15 Sep 2010
Total Posts: 3032
01 Jan 2012 09:05 AM
i thought you had to have more ends?
Report Abuse
JoeLuke001 is not online. JoeLuke001
Joined: 04 Oct 2008
Total Posts: 5861
01 Jan 2012 09:07 AM
@Ufail,

Still nothing.

Now nothing is in the Output when I touch the brick.
Report Abuse
UFAIL2 is not online. UFAIL2
Joined: 14 Aug 2010
Total Posts: 6905
01 Jan 2012 09:08 AM
@Evanthepancake

You add an end for every if, do, or function.
Report Abuse
UFAIL2 is not online. UFAIL2
Joined: 14 Aug 2010
Total Posts: 6905
01 Jan 2012 09:11 AM
Ugh, it's so simple, yet I can't figure it out.
Report Abuse
UFAIL2 is not online. UFAIL2
Joined: 14 Aug 2010
Total Posts: 6905
01 Jan 2012 09:17 AM
It should work, I even went and tested it.
Report Abuse
JoeLuke001 is not online. JoeLuke001
Joined: 04 Oct 2008
Total Posts: 5861
01 Jan 2012 09:20 AM
Oh. it does work.

It wasn't working in solo. Thanks, Ufail. :)
Report Abuse
JoeLuke001 is not online. JoeLuke001
Joined: 04 Oct 2008
Total Posts: 5861
01 Jan 2012 09:21 AM
But just a question.

Will it only kill me on touch or will it kill everybody?
Report Abuse
Phellem is not online. Phellem
Joined: 04 Aug 2011
Total Posts: 1984
01 Jan 2012 09:23 AM
local Part=game.Workspace.Part

Part.Touched:connect(function()
game.Workspace["JoeLuke001"].Humanoid.Health=0
end)
Report Abuse
UFAIL2 is not online. UFAIL2
Joined: 14 Aug 2010
Total Posts: 6905
01 Jan 2012 09:25 AM
You wouldn't need brackets around his name since there is no special characters in it.
Report Abuse
Phellem is not online. Phellem
Joined: 04 Aug 2011
Total Posts: 1984
01 Jan 2012 09:25 AM
@JoeLuke001

Only you.
If you want it to kill anyone that touched it, here:

local Part=game.Workspace.Part

Part.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
hit.Parent.Humanoid.Health=0
end)
Report Abuse
JoeLuke001 is not online. JoeLuke001
Joined: 04 Oct 2008
Total Posts: 5861
01 Jan 2012 09:27 AM
Thanks, phell. It's working in multiplayer now. :D
Report Abuse
Phellem is not online. Phellem
Joined: 04 Aug 2011
Total Posts: 1984
01 Jan 2012 09:28 AM
@UFAIL

The brackets replace :FindFirstChild()
Plus, his name have numbers.
Report Abuse
UFAIL2 is not online. UFAIL2
Joined: 14 Aug 2010
Total Posts: 6905
01 Jan 2012 09:31 AM
Mine worked, a number isn't a special character.
Report Abuse
Phellem is not online. Phellem
Joined: 04 Aug 2011
Total Posts: 1984
01 Jan 2012 09:33 AM
@UFAIL

Yes, because you did it differently.
I made it where when anything touch the part, Joe will die.

You made it so Joe would die if he touch it.
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