|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
| |
|
|
| 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 |
|
|
|
| 26 Jan 2014 11:57 AM |
| And this happens if a bullet hits it? |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|