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: Smashable fence

Previous Thread :: Next Thread 
austint30 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. austint30
Joined: 20 Mar 2010
Total Posts: 1482
21 Mar 2014 03:31 PM
No, it is textured.
Report Abuse
austint30 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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
VerifiedName is not online. VerifiedName
Joined: 26 Jul 2009
Total Posts: 4534
21 Mar 2014 04:24 PM
@goul, you cant change the source of a script.

#nerdsunited
Report Abuse
Goulstem is not online. 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
VerifiedName is not online. VerifiedName
Joined: 26 Jul 2009
Total Posts: 4534
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
JonathanW123 is not online. JonathanW123
Joined: 04 Apr 2012
Total Posts: 5832
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 is not online. 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
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