austint30
|
  |
| Joined: 20 Mar 2010 |
| Total Posts: 1482 |
|
|
| 17 Mar 2014 07:23 PM |
I have a driving game that I am making. I want to make some objects smashable.
I am new to scripting so I have no idea how to do this. I want the brick to be anchored at the start, when a car hits it I want it to turn off the anchor so it will fall. 60 seconds later I want it to remove itself and respawn anchored exactly in its last position.
I want it to only work when a brick named "destroyer" hits it.
|
|
|
| Report Abuse |
|
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 17 Mar 2014 07:41 PM |
Make some sections of the fence models then put this script in each model
c = script.Parent:GetChildren() for i = 1,#c do Instance.new("Script",c[i]).Source = [[ script.Parent.Touched:connect(function(hit) if hit.Name == "destroyer" then script.Parent.Parent:BreakJoints() wait(10) for i,v in pairs(script.Parent.Parent:GetChildren()) do for i = 1,10,.1 do v.Transparency = i wait(.1) end end end end) ]] end
|
|
|
| Report Abuse |
|
|
austint30
|
  |
| Joined: 20 Mar 2010 |
| Total Posts: 1482 |
|
|
| 18 Mar 2014 04:54 PM |
| Sorry, but your script doesn't work. I put a script in the fence and renamed a brick on my car "destroyer" exactly. I hit the fence and it did not turn the anchor off. |
|
|
| Report Abuse |
|
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 18 Mar 2014 05:27 PM |
| Did you make the fence a model, and put that script directly inside that model? |
|
|
| Report Abuse |
|
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 18 Mar 2014 05:29 PM |
| Also, all the parts of the fence would have to be directly inside the model as well, no models inside the model or bricks inside of bricks, all direct children of the model for it to work. |
|
|
| Report Abuse |
|
|
Parloes
|
  |
| Joined: 04 Jan 2013 |
| Total Posts: 286 |
|
|
| 18 Mar 2014 05:30 PM |
Do onTouch if isA = "Part" then partTouched anchored = false
Somewhere over the lines of that. |
|
|
| Report Abuse |
|
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 18 Mar 2014 05:51 PM |
^Lol that's a lot simpler than what I was suggesting.. but you would have to put this script into every part of the fence..
script.Parent.Touched:connect(function(hit) if hit.Name == "destroyer" then script.Parent.Anchored = false end end)
But also this would make it so you couldn't CFrame any of the parts. |
|
|
| Report Abuse |
|
|
austint30
|
  |
| Joined: 20 Mar 2010 |
| Total Posts: 1482 |
|
|
| 18 Mar 2014 07:20 PM |
| The fence is a single brick that I put the script inside of. |
|
|
| Report Abuse |
|
|
austint30
|
  |
| Joined: 20 Mar 2010 |
| Total Posts: 1482 |
|
|
| 18 Mar 2014 07:23 PM |
@Parloes
I also want it to respawn 60 seconds after it is hit in the exact same area before the script was triggered. |
|
|
| Report Abuse |
|
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 18 Mar 2014 10:26 PM |
| How is a whole fence one brick? ._. Dem meshes bro? |
|
|
| Report Abuse |
|
|
austint30
|
  |
| Joined: 20 Mar 2010 |
| Total Posts: 1482 |
|
| |
|
austint30
|
  |
| Joined: 20 Mar 2010 |
| Total Posts: 1482 |
|
|
| 21 Mar 2014 03:32 PM |
| I am using tricks to keep the lag down, so I make the fence all one part and put a realistic fence texture on it. |
|
|
| Report Abuse |
|
|
GFXdylan
|
  |
| Joined: 09 Feb 2013 |
| Total Posts: 679 |
|
|
| 21 Mar 2014 03:49 PM |
| Buddy, 1 brick can't be smashed into otherbricks, only the brickcuttor of ozzypig can, but that's just magic. |
|
|
| Report Abuse |
|
|
austint30
|
  |
| Joined: 20 Mar 2010 |
| Total Posts: 1482 |
|
|
| 21 Mar 2014 03:52 PM |
| No, I want the brick to become UNANCHORED when it is hit by the car! Also respawn, anchored, in its exact previous postition. |
|
|
| Report Abuse |
|
|
GFXdylan
|
  |
| Joined: 09 Feb 2013 |
| Total Posts: 679 |
|
|
| 21 Mar 2014 03:55 PM |
So, if he rams it, he drives over it?
-- for the 60 seconds use wait(), for the regen use a regenscript |
|
|
| Report Abuse |
|
|
austint30
|
  |
| Joined: 20 Mar 2010 |
| Total Posts: 1482 |
|
|
| 21 Mar 2014 04:05 PM |
| I would also like for it to fall through the ground 3 seconds after it is hit. |
|
|
| Report Abuse |
|
|
GFXdylan
|
  |
| Joined: 09 Feb 2013 |
| Total Posts: 679 |
|
|
| 21 Mar 2014 04:22 PM |
Again, use WAIT and there are NO requests on this forum. so get get out. |
|
|
| Report Abuse |
|
|
|
| 21 Mar 2014 04:24 PM |
@goul, you cant change the source of a script.
#nerdsunited |
|
|
| Report Abuse |
|
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 21 Mar 2014 05:46 PM |
^Really?, type this into your command bar,
s = Instance.new("Script") s.Name = "VERIFIEDNAME" s.Source = [[
Told you so nub(jk)
]] |
|
|
| Report Abuse |
|
|
|
| 22 Mar 2014 10:03 AM |
*Sorry for bumping after a day, must prove I'm right :P*
Firstly, you didn't set the parent of that script. Secondly, that's command bar, commands bar has higher "level" than normal scripts, you can't edit the source of a script using another script (unless it's a plugin).
#nerdsunited |
|
|
| Report Abuse |
|
|
|
| 22 Mar 2014 10:12 AM |
| Make the fence uncopylocked but weld it to the other fence parts so it's glued, but if something contacts with it, it will smash. |
|
|
| Report Abuse |
|
|
austint30
|
  |
| Joined: 20 Mar 2010 |
| Total Posts: 1482 |
|
|
| 23 Mar 2014 04:05 PM |
| I tried splitting the fence up into 10 parts and grouped it and using Goulstem's script and still it did not work. |
|
|
| Report Abuse |
|
|