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: A simple script not working : /

Previous Thread :: Next Thread 
Xantar123 is not online. Xantar123
Joined: 03 Jan 2010
Total Posts: 470
11 Feb 2014 02:30 PM
I can see no problem with this script and yet for some reason it does not work.

function touch(h)
if h.name == "left leg" or h.name == "Right leg" then
print("RUN FOR YOUR LIFE!")
wait(5)
h:destroy()
end
end

script.parent.touched:connect(touch)

Whenever a humanoid leg touches this block I want it to print "RUN FOR YOUR LIFE!" And then the message to go away after 5 seconds....

Which that is not happening AT ALL.

I am new to scripting so I'm not really sure why this is not working.. Help anyone?
Report Abuse
YumERAGON is not online. YumERAGON
Joined: 18 Apr 2012
Total Posts: 3893
11 Feb 2014 02:31 PM
Destroy()*
Parent*
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
11 Feb 2014 02:31 PM
Capitals.

script.Parent.Touched:connect(touch)
Report Abuse
YumERAGON is not online. YumERAGON
Joined: 18 Apr 2012
Total Posts: 3893
11 Feb 2014 02:32 PM
And I don't think you can use or but you can use elseif
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
11 Feb 2014 02:35 PM
or works fine here.
he only forgot Right Leg.
and Left Leg.
so it wont work anyway.


Report Abuse
YumERAGON is not online. YumERAGON
Joined: 18 Apr 2012
Total Posts: 3893
11 Feb 2014 02:36 PM
Ok.

Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
11 Feb 2014 02:38 PM
U can use or..
Also

deb=false--debounce is very important
script.Parent.Touched:connect(function(thing)
if thing.Name == "Left Leg" and deb == false or thing.Name =="Right Leg" and deb == false then
deb=true
wait(5)
deb = false
thing:destroy()
end
end)
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
11 Feb 2014 02:40 PM
Oop,add that print"run for ur life!" Bit after deb = true
Report Abuse
Link5659 is not online. Link5659
Joined: 04 Jun 2012
Total Posts: 4525
11 Feb 2014 02:41 PM
function.touched(h)
if h.name == "left leg" or h.name == "Right leg" then
print("RUN FOR YOUR LIFE!")
wait(5)
h:destroy()
end
end
Report Abuse
Link5659 is not online. Link5659
Joined: 04 Jun 2012
Total Posts: 4525
11 Feb 2014 02:41 PM
WAIT DON'T USE MINE USE THE GUYS ABOVE MY POSTS
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
11 Feb 2014 02:43 PM
Link, not close :/

Deb = false

script.Parent.Touched:connect(Hit)
if (Hit.Parent.Humanoid) and (Deb == false) then
Deb = true
print("RUN FOR YOUR LIFE!")
wait(5)
Hit:Destroy()
end
end)
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
11 Feb 2014 02:44 PM
Nvm link, you were also a bit close.
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
11 Feb 2014 02:44 PM
Nvm link, you were also a bit close.

Now go out and rescue Zelda! D:
Report Abuse
Link5659 is not online. Link5659
Joined: 04 Jun 2012
Total Posts: 4525
11 Feb 2014 02:45 PM
@ABOVE ME PLEAES HELP ME BRO I POSTED TO MINE THAT YOU COULDN'T READ.



@Above me please help me bro I posted to mine that you couldn't read.
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
11 Feb 2014 09:59 PM
@vlek,i beat u to it /\_/\
but yeah,like vlek said(his is shorter)
Report Abuse
jmasterj10 is not online. jmasterj10
Joined: 19 Sep 2010
Total Posts: 735
12 Feb 2014 03:42 AM
script.Parent.Touched:connect(function(touch)
if touch.Name == "Right Leg" or "Left Leg" then
print "Better Run Little Boy/Girl"
wait(5)
touch:remove()
end
end)

--now the message will only work in studios. If you want an actual message do this:

script.Parent.Touched:connect(function(touch)
if touch.Name == "Right Leg" or "Left Leg" then
local msg = Instance.new("Message", workspace)
msg.Text = "Run for your life!"
wait(5)
msg:remove()
touch:remove()
end
end)
Report Abuse
GOLDC3PO is not online. GOLDC3PO
Joined: 31 May 2011
Total Posts: 509
12 Feb 2014 07:29 AM
function touch(h)
if h.name == "Left leg" or h.name == "Right leg" then
p= Instant.new("Message",game.Players[h.Parent.Name].Playergui)
p.Text = "Run for your lives!"
wait(5)
p:remove()
h:remove()
end
end

script.Parent.Touched:connect(touch)
Report Abuse
EcIiptic is not online. EcIiptic
Joined: 12 Aug 2009
Total Posts: 13737
12 Feb 2014 09:13 AM
Sorry to rain on your parade but...

You can't do Lua at all if you can't use proper capitalization.

It's pretty much 100% required.
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