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: Help with onTouch Script.

Previous Thread :: Next Thread 
Johnnya101 is not online. Johnnya101
Joined: 30 Dec 2012
Total Posts: 5140
09 Feb 2015 07:49 AM
I am making this game where when you hit something with a car, it becomes unanchored. When Im testing this, its not making anything unanchored, or in the 2nd script, explode. The car is grouped, and so the bumper is in the grouped car. Is that whats making it not work?

Script 1
function onTouched(hit)
if hit.Parent.Name == "Bumper" then
local a = Instance.new("Explosion")
a.BlastPressure = 100 -- the pressure
a.BlastRadius = 10 --the radius
a.Position = script.Parent.Position
a.Parent = game.Workspace
end
end

Script 2
function onTouched(hit)
if hit.Parent.Name == "Bumper" then
script.Parent.Anchored = false
script.remove()
end
end
Report Abuse
QuestLog is not online. QuestLog
Joined: 21 Nov 2009
Total Posts: 74
09 Feb 2015 08:03 AM
You got a connect?

"PART TO BE TOUCHED".Touched:connect(OnTouched)
Report Abuse
Johnnya101 is not online. Johnnya101
Joined: 30 Dec 2012
Total Posts: 5140
09 Feb 2015 08:31 AM
Ok thanks, Ill see if that works.
Report Abuse
Johnnya101 is not online. Johnnya101
Joined: 30 Dec 2012
Total Posts: 5140
09 Feb 2015 08:34 AM
Not working, anyone else?
Report Abuse
Luminak is not online. Luminak
Joined: 27 May 2012
Total Posts: 2809
09 Feb 2015 08:43 AM
script.Parent.Touched:connect(function()
if hit.Parent.Name == "Bumper" then
local a = Instance.new("Explosion")
a.BlastPressure = 100 -- the pressure
a.BlastRadius = 10 --the radius
a.Position = script.Parent.Position
a.Parent = game.Workspace
end
put it inside block
Report Abuse
distalDigitPhalanx is not online. distalDigitPhalanx
Joined: 25 Jan 2015
Total Posts: 1509
09 Feb 2015 09:01 AM
See this script:
http://www.roblox.com/Car-that-shreks-walls-item?id=214359602
Report Abuse
Johnnya101 is not online. Johnnya101
Joined: 30 Dec 2012
Total Posts: 5140
09 Feb 2015 09:35 AM
Ok guys, I got it working! I followed your model scripts @above. Thanks everyone!
Report Abuse
Luminak is not online. Luminak
Joined: 27 May 2012
Total Posts: 2809
10 Feb 2015 08:48 AM
correction, Ok guys I got it working, from luminak who accually knows what scripting is and doesn't just try anything that makes no sense.
Report Abuse
DeviousDeviation is not online. DeviousDeviation
Joined: 28 Dec 2010
Total Posts: 9306
10 Feb 2015 09:15 AM
@Luminak

hit is undefined

⬡
Report Abuse
Egzekiel is not online. Egzekiel
Joined: 10 Jan 2011
Total Posts: 1079
10 Feb 2015 10:42 AM
If you do a normal function like
function onTouched(hit)
end
Then you got to connect it with
"part".Touched:connect(onTouched)
If you know you won't need to repeat the function the do an "Anonymous Function"
"part".Touched:connect(function(hit)
end)
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