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: Touched event.

Previous Thread :: Next Thread 
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
03 Dec 2013 06:29 PM
Hi.... I don't really know how to detect a touch in m script, please help!
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
03 Dec 2013 06:33 PM
function swordUp()
script.Parent.GripForward = Vector3.new(-1,0,0)
script.Parent.GripRight = Vector3.new(0,1,0)
script.Parent.GripUp = Vector3.new(0,0,1)
end

function swordOut()
script.Parent.GripForward = Vector3.new(0,0,1)
script.Parent.GripRight = Vector3.new(0,-1,0)
script.Parent.GripUp = Vector3.new(-1,0,0)
end


local active = false
script.Parent.Activated:connect(function()
if active == true then return end
active = true
swordOut()
Wait(0.25)
swordUp()
active = false

end)

script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild ("Humanoid") then
h = hit.Parent:FindFirstChild ("Humanoid")
hit:TakeDamage(20)
end
end)
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
03 Dec 2013 06:45 PM
help? c:
please? D:
Report Abuse
Laedere is online. Laedere
Joined: 17 Jun 2013
Total Posts: 23601
03 Dec 2013 07:03 PM
function example()
part.Parent = Lighting
end
script.Parent.Touched:connect(example)
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
03 Dec 2013 07:07 PM
^ part is nil
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
03 Dec 2013 07:07 PM
I know how to use it liek that.... I just want to know how to apply it to this script so it hurts someone if they have a humanoid ( not just a random brick that happens to touch it)
Report Abuse
Laedere is online. Laedere
Joined: 17 Jun 2013
Total Posts: 23601
03 Dec 2013 07:07 PM
sorry, thought someone else posted the long script.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
03 Dec 2013 07:08 PM
function touch(partTouched)
if partTouched.Parent:FindFirstChild("Humanoid") then
partTouched.Parent.Humanoid:TakeDamage(10)
end
end

script.Parent.Touched:connect(touch)
Report Abuse
integrand is not online. integrand
Joined: 30 Nov 2013
Total Posts: 42
03 Dec 2013 07:10 PM
No, Cnt doesn't know what hes doing, use this:

function onTouch(hit) -- it HAS to be this
local h = hit.Parent:findFirstChild( [[ Humanoid ]] )-- brackets are better according to telamon
if h then
if hit.Parent:findFirstChild( [[ Humanoid ]] ).Health ~= 0 then
h.Health = h.Health - 10
end
end
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
03 Dec 2013 07:12 PM
how would i make it not hurt the person the person holding the Tool?
like this??

if hit.findFirstChild("Humanoid") and not Tool.Parent.Parent.Character.Humanoid then
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
03 Dec 2013 07:12 PM
inte, shut UP
No ones knows better than cnt.
I know more than you, idiot!
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
03 Dec 2013 07:14 PM
it does NOt have the be "hit" itcan be anything u want,
nub.
and u dont findFirstChild like this:

([[]])
u use a string
("")
Report Abuse
Laedere is online. Laedere
Joined: 17 Jun 2013
Total Posts: 23601
03 Dec 2013 07:14 PM
. . . .
Report Abuse
integrand is not online. integrand
Joined: 30 Nov 2013
Total Posts: 42
03 Dec 2013 07:14 PM
No, because I have a degree in the history of computational quantum neuroscience wiht physical chemistry, and that's a top Course 6 degree at MIT.... I have more education, intelligents knowedge, and personaltiy then you.
Report Abuse
integrand is not online. integrand
Joined: 30 Nov 2013
Total Posts: 42
03 Dec 2013 07:15 PM
No, go to LUA compiler and say :
print([[hello, world!]])
and it will work, i bet u a nickle.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
03 Dec 2013 07:15 PM
"No ones knows better than cnt."
That's wrong.
Report Abuse
Laedere is online. Laedere
Joined: 17 Jun 2013
Total Posts: 23601
03 Dec 2013 07:15 PM
then why are you on roblox when you can be doing other stuff

you're such an obvious troll
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
03 Dec 2013 07:16 PM
Then I'm a chicken with no head.
I you were so intelligents (LOL) then
you would know how to use it.
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
03 Dec 2013 07:17 PM
ok cnt, but I think your the best here on the forum, and inte, why did u say cnt didnt know what he was doing if he was doing it another way?!?!?!!?
Report Abuse
integrand is not online. integrand
Joined: 30 Nov 2013
Total Posts: 42
03 Dec 2013 07:17 PM
WHY IS EVERYONE SAYING I'M A TROLL!!!!!!!!!!!!!
I'm Not a troll. I just finished my Phd at MIT and Im in my dorm at Harvard becauseIm bored and I have no homework. thats why Im on Roblox. Also I grew up on Roblox, so please go away!!!!!!!!!
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
03 Dec 2013 07:17 PM
KEV, you actually can do:

blah:FindFirstChild([[...]])
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
03 Dec 2013 07:17 PM
intelligence and knowledge basically mean the same thing.
Report Abuse
Laedere is online. Laedere
Joined: 17 Jun 2013
Total Posts: 23601
03 Dec 2013 07:18 PM
knowledge is how much you know
intelligence is how smart you are
Report Abuse
integrand is not online. integrand
Joined: 30 Nov 2013
Total Posts: 42
03 Dec 2013 07:20 PM
It Isnt intelligence, it's intelligents.
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
03 Dec 2013 07:22 PM
Ok, that makes her an obvious troll, so anyways, ty gyus, /i'll try to put it into my script :D
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