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: Why won't this simple script work?

Previous Thread :: Next Thread 
Zerio920 is not online. Zerio920
Joined: 06 Apr 2012
Total Posts: 3311
11 Sep 2013 09:25 PM
function onTouch(obj)
script.Parent.Parent.Anchored = false
script.Parent.Parent.CanCollide = false
game.Workspace.house.Anchored = false
game.Workspace.Peeps.Anchored = false
game.Workspace.Peeps.CanCollide = false
local explosion = Instance.new('Explosion', Workspace)
explosion.Position = Vector3.new(-17, 1050, -116)
explosion.BlastPressure = 100
explosion.BlastRadius = 1000
end
script.Parent.Touched:connect(onTouch)

No part of the script is working... could it be something with the function?
Report Abuse
rblxxx is not online. rblxxx
Joined: 15 Jan 2013
Total Posts: 626
11 Sep 2013 09:27 PM
function onTouch(obj)
script.Parent.Parent.Anchored = false
script.Parent.Parent.CanCollide = false
game.Workspace.house.Anchored = false
game.Workspace.Peeps.Anchored = false
game.Workspace.Peeps.CanCollide = false
local explosion = Instance.new("Explosion", Workspace)--This is the line that was changed.
explosion.Position = Vector3.new(-17, 1050, -116)
explosion.BlastPressure = 100
explosion.BlastRadius = 1000
end
script.Parent.Touched:connect(onTouch)
Report Abuse
janthran is not online. janthran
Joined: 15 May 2009
Total Posts: 17429
11 Sep 2013 09:27 PM
Um.. What's the object tree look like?
Model>Part>Script?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
11 Sep 2013 09:31 PM
^ you batch too much
Report Abuse
Zerio920 is not online. Zerio920
Joined: 06 Apr 2012
Total Posts: 3311
11 Sep 2013 09:34 PM
@rblxxx - It still isn't working...

Maybe it's the fact that the script's supposed to activate once one block touches another one, instead of when a player touches it?
Report Abuse
Zerio920 is not online. Zerio920
Joined: 06 Apr 2012
Total Posts: 3311
11 Sep 2013 09:35 PM
When I run the script, a touchinterest appears in the brick, and when it touches the other brick, it disappears, but nothing happens.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
11 Sep 2013 09:35 PM
No, because something is wrong with your hierarchy.
Report Abuse
rblxxx is not online. rblxxx
Joined: 15 Jan 2013
Total Posts: 626
11 Sep 2013 09:35 PM
Maybe, try this:

function onTouched(hit)
script.Parent.Parent.Anchored = false
script.Parent.Parent.CanCollide = false
game.Workspace.house.Anchored = false
game.Workspace.Peeps.Anchored = false
game.Workspace.Peeps.CanCollide = false
local explosion = Instance.new("Explosion", Workspace)--This is the line that was changed.
explosion.Position = Vector3.new(-17, 1050, -116)
explosion.BlastPressure = 100
explosion.BlastRadius = 1000
end
script.Parent.Touched:connect(onTouched)
Report Abuse
rblxxx is not online. rblxxx
Joined: 15 Jan 2013
Total Posts: 626
11 Sep 2013 09:36 PM
when it says "This is the line that was changed" that line was not changed btw.
Report Abuse
Zerio920 is not online. Zerio920
Joined: 06 Apr 2012
Total Posts: 3311
11 Sep 2013 09:42 PM
@Rblxxx - Same thing happens. The brick touches the other brick, nothing happens at all.

@cntkillme - Explain please? I'm not good with this stuff, so you'll have to bear with me please.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
11 Sep 2013 09:43 PM
"game.Workspace.house.Anchored = false
game.Workspace.Peeps.Anchored = false"

I'm assuming house and Peeps are not parts, but models.
Report Abuse
Zerio920 is not online. Zerio920
Joined: 06 Apr 2012
Total Posts: 3311
11 Sep 2013 09:48 PM
Yeah... you assume correct. How should I fix this?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
11 Sep 2013 09:48 PM
For loop.

Example:

model = Game.Workspace.Model
for i = 1, #model do
model[i].Blah = Blah
end
Report Abuse
Zerio920 is not online. Zerio920
Joined: 06 Apr 2012
Total Posts: 3311
11 Sep 2013 09:53 PM
What do I put for "Blah", and where in the script should I insert this? Also, what does it do?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
11 Sep 2013 09:54 PM
Blah being CanCollide or whatever property you may want.

model[i] is the part inside the model.
Report Abuse
Zerio920 is not online. Zerio920
Joined: 06 Apr 2012
Total Posts: 3311
11 Sep 2013 10:17 PM
So like this?

function onTouched(hit)
script.Parent.Parent.Anchored = false
script.Parent.Parent.CanCollide = false
model = Game.Workspace.house
for i = 1, #model do
model[i].Anchored = False
end
game.Workspace.Peeps.Anchored = false
game.Workspace.Peeps.CanCollide = false
local explosion = Instance.new("Explosion", Workspace)
explosion.Position = Vector3.new(-17, 1050, -116)
explosion.BlastPressure = 100
explosion.BlastRadius = 1000
end
script.Parent.Touched:connect(onTouched)
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
11 Sep 2013 10:19 PM
false*
And yeah, also, if Peeps is a model, you should do the same with it.
Report Abuse
laughablehaha is not online. laughablehaha
Joined: 19 Apr 2012
Total Posts: 2495
12 Sep 2013 06:13 AM
Note: CanCollide Bricks can't be activated with the "Touched" event.

--Blame John
Report Abuse
Vrakner is not online. Vrakner
Joined: 19 Feb 2013
Total Posts: 323
12 Sep 2013 06:16 AM
Yes they can...
Report Abuse
DragonODeath is not online. DragonODeath
Joined: 02 May 2011
Total Posts: 1252
12 Sep 2013 06:25 AM
Yeah, they can...I died touching a non collidable lava brick. lal.
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