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 » Scripters
Home Search
 

Re: Touched event not firing

Previous Thread :: Next Thread 
ByDefault is not online. ByDefault
Joined: 25 Jul 2014
Total Posts: 3197
29 Dec 2014 02:29 PM
script.Parent.Touched:connect(function(hit)
print(hit)
local e = Instance.new("Explosion", workspace)
e.Position = script.Parent.Position
end)

coroutine.wrap(function()
for i = 1,100 do
wait()
p.CFrame = p.CFrame * CFrame.new(4,0,0)
end
p:remove()
end)()

Why wont it fire? When it hits a part nothing gets printed
Report Abuse
iiEssence is not online. iiEssence
Joined: 18 Jun 2014
Total Posts: 3467
29 Dec 2014 02:33 PM
Is it a local script? cus it shouldnt be
Report Abuse
frommage is not online. frommage
Joined: 22 Apr 2014
Total Posts: 100
29 Dec 2014 02:52 PM
Workspace should be capitalized
Report Abuse
Absurdism is not online. Absurdism
Joined: 18 Jul 2013
Total Posts: 2568
29 Dec 2014 02:54 PM
workspace doesnt have to be capitalized if ur using it as a var
Report Abuse
frommage is not online. frommage
Joined: 22 Apr 2014
Total Posts: 100
29 Dec 2014 02:54 PM
he didn't define it as a variable tho
Report Abuse
Absurdism is not online. Absurdism
Joined: 18 Jul 2013
Total Posts: 2568
29 Dec 2014 02:55 PM
nope
go into command line and type Instance.new('Part', workspace)
trust me itll spawn
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
29 Dec 2014 02:57 PM
He meant that workspace and Workspace are both global variables that reference to game.Workspace
Report Abuse
ByDefault is not online. ByDefault
Joined: 25 Jul 2014
Total Posts: 3197
29 Dec 2014 05:58 PM
Nope, it's in a normal script
Report Abuse
TooKawaiiForSenpai is not online. TooKawaiiForSenpai
Joined: 03 Mar 2009
Total Posts: 3241
29 Dec 2014 05:59 PM
Workspace by its own is deprecated now.

If you're not going to use 'game.Workspace' then the proper use is 'workspace'
Report Abuse
AllianceScripter is not online. AllianceScripter
Joined: 02 Feb 2014
Total Posts: 318
29 Dec 2014 06:02 PM
dont add () at the end
Report Abuse
ByDefault is not online. ByDefault
Joined: 25 Jul 2014
Total Posts: 3197
29 Dec 2014 06:04 PM
It with the script.Parent.Touched part
Report Abuse
ByDefault is not online. ByDefault
Joined: 25 Jul 2014
Total Posts: 3197
29 Dec 2014 08:34 PM
Bump
Report Abuse
golfercab is not online. golfercab
Joined: 26 Sep 2011
Total Posts: 714
29 Dec 2014 08:38 PM
I think the print variable, ironically, is holding it up. Should be print(hit.Name), hit itself is an object, cant turn an object into a string unless you refer to its properties

also, check the output box, what does it say?
Report Abuse
ByDefault is not online. ByDefault
Joined: 25 Jul 2014
Total Posts: 3197
29 Dec 2014 08:41 PM
No, because I've tried it before and it worked and the explosion still doesn't happen. There are no errors in output either
Report Abuse
golfercab is not online. golfercab
Joined: 26 Sep 2011
Total Posts: 714
29 Dec 2014 08:59 PM
atleast change it to print(hit.Name) and check the output please
Report Abuse
ByDefault is not online. ByDefault
Joined: 25 Jul 2014
Total Posts: 3197
30 Dec 2014 12:24 PM
Ive changed it to print("Hi"), but it still wont print.
Report Abuse
ByDefault is not online. ByDefault
Joined: 25 Jul 2014
Total Posts: 3197
30 Dec 2014 12:28 PM
Bahumpy
Report Abuse
golfercab is not online. golfercab
Joined: 26 Sep 2011
Total Posts: 714
30 Dec 2014 05:14 PM
oh, weird, only thing i could think of that may be preventing it from firing is if there is a wait(some number) that is higher up in the script than the function that hasn't finished running holding up the script, or there is a WaitForChild(some child's name that doesnt even exist) doing the same thing
Report Abuse
golfercab is not online. golfercab
Joined: 26 Sep 2011
Total Posts: 714
30 Dec 2014 05:15 PM
or script.Parent is something that is not being touched
Report Abuse
Ryan5124KBCP is not online. Ryan5124KBCP
Joined: 28 Nov 2010
Total Posts: 261
30 Dec 2014 05:25 PM
Made it work, your welcome.

p = script.Parent

script.Parent.Touched:connect(function(hit)
local e = Instance.new("Explosion", workspace)
e.Position = script.Parent.Position
end)

coroutine.wrap(function()
for i = 1,100 do
wait()
p.CFrame = p.CFrame * CFrame.new(4,0,0)
end
p:remove()
end)
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
30 Dec 2014 05:27 PM
Ryan, you changed nothing but just created a reference.
It doesn't matter the coroutine part was broken (even though you made it not even called at all). The important part that is not working is the Touched listener.
Report Abuse
Ryan5124KBCP is not online. Ryan5124KBCP
Joined: 28 Nov 2010
Total Posts: 261
30 Dec 2014 05:27 PM
The explosion bit works though..
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
30 Dec 2014 05:30 PM
Exactly, the OP's script also worked for me. It's him doing something wrong.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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