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
 

How can I make breakable glass?

Previous Thread :: Next Thread 
ruraltechdeck101 is not online. ruraltechdeck101
Joined: 24 Dec 2009
Total Posts: 3850
26 Jan 2014 11:35 AM
Say there's a brick that will act as a window, a player shoots it, how do I make the glass break into many smaller bricks?
Report Abuse
InternetGuy is not online. InternetGuy
Joined: 28 Apr 2010
Total Posts: 3385
26 Jan 2014 11:41 AM
I'll get you started

function break(part)
for i = 1, 4 do
p = Instance.new("Part", workspace)
p.BrickColor = part.BrickColor
p.Transparency = part.Transparency
p.Size = Vector3.new(part.Size.X/4,part.Size.Y/4,part.Size.Z/4)
p.CFrame = part.CFrame
part:Destroy()
end
end

break(workspace.glass)
Report Abuse
InternetGuy is not online. InternetGuy
Joined: 28 Apr 2010
Total Posts: 3385
26 Jan 2014 11:43 AM
My mistake!
Use this:

function breakTarget(part)
for i = 1, 4 do
p = Instance.new("Part", workspace)
p.BrickColor = part.BrickColor
p.Transparency = part.Transparency
p.Size = Vector3.new(part.Size.X/4,part.Size.Y/4,part.Size.Z/4)
p.CFrame = part.CFrame
part:Destroy()
end
end

breakTarget(workspace.glass)
Report Abuse
InternetGuy is not online. InternetGuy
Joined: 28 Apr 2010
Total Posts: 3385
26 Jan 2014 11:45 AM
Actually, this will work better:

function breakTarget(part)
for i = 1, 4 do
p = part:clone()
p.Parent = workspace
p.BrickColor = part.BrickColor
p.Transparency = part.Transparency
p.TopSurface = "Smooth"
p.BottomSurface = "Smooth"
p.Size = Vector3.new(part.Size.X/4,part.Size.Y/4,part.Size.Z/4)
p.CFrame = part.CFrame * CFrame.new(0,math.random(-2, 2), 0)
part:Destroy()
end
end

breakTarget(workspace.glass)
Report Abuse
ruraltechdeck101 is not online. ruraltechdeck101
Joined: 24 Dec 2009
Total Posts: 3850
26 Jan 2014 11:47 AM
Thanks
Report Abuse
InternetGuy is not online. InternetGuy
Joined: 28 Apr 2010
Total Posts: 3385
26 Jan 2014 11:53 AM
Hehe, this is even better:
function breakTarget(part)
for i = 1, 4 do
p = part:clone()
p.Parent = workspace
p.BrickColor = part.BrickColor
p.Transparency = part.Transparency
p.TopSurface = "Smooth"
p.BottomSurface = "Smooth"
p.Size = Vector3.new(part.Size.X/2 + math.random(1, 2),part.Size.Y/2 - math.random(1,2),part.Size.Z/2)
p.CFrame = part.CFrame * CFrame.new(0,math.random(-2, 2), 0) * CFrame.Angles(math.random(1, 180), math.random(1, 170), math.random(1, 180))
s = Instance.new("Part", workspace)
s.Transparency = part.Transparency
s.BrickColor = part.BrickColor
s.CFrame = part.CFrame * CFrame.new(0,math.random(-2, -1), 0)
s.TopSurface = "Smooth"
s.BottomSurface = "Smooth"
s.Size = Vector3.new(math.random(1,3) * part.Size.X / 18,math.random(1,3) * part.Size.Y / 18, 1)
part:Destroy()
end
end

breakTarget(workspace.glass)
Report Abuse
ruraltechdeck101 is not online. ruraltechdeck101
Joined: 24 Dec 2009
Total Posts: 3850
26 Jan 2014 11:57 AM
And this happens if a bullet hits it?
Report Abuse
GrandAwsome is not online. GrandAwsome
Joined: 12 Jul 2011
Total Posts: 326
26 Jan 2014 12:00 PM
Once the function is called the glass breaks, You have to figure out your own way to call the function. a _G statement would work.

Alt. of Jetta765214
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