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 » Scripters
Home Search
 

Re: Breakable glass

Previous Thread :: Next Thread 
Reshiram110 is not online. Reshiram110
Joined: 26 Nov 2014
Total Posts: 2265
23 Aug 2015 12:19 PM
Hello.In a game I am developing,I was stumped in the middle of creating a map.I was adding windows into a frame.When I went to add a script to it,I realized I have no idea how to do this.I am trying to make the glass break (or "shatter") when it is shot or knifed (as seen in "Impulse Testing" by Rhyles).The current breakable glasses in the toolbox break when ANYTHING,including the player itself,touches the glass.Any help on how to make glass break ONLY when shot,knifed,or when an explosion happens near it?Thanks.
Report Abuse
sparker22 is not online. sparker22
Joined: 11 Mar 2010
Total Posts: 846
23 Aug 2015 12:22 PM
Modify the code as a function that you call when one of those actions occur. Pretty self explanatory.
Report Abuse
TwoRivers is not online. TwoRivers
Joined: 25 Aug 2011
Total Posts: 2821
23 Aug 2015 12:24 PM
He means modifying the gun handling / knife stabbing.
Report Abuse
Reshiram110 is not online. Reshiram110
Joined: 26 Nov 2014
Total Posts: 2265
23 Aug 2015 12:24 PM
How would I detect the collision,though?The bullet part,I know how to do.But an explosion detection?
Report Abuse
Aspected is not online. Aspected
Joined: 20 Feb 2015
Total Posts: 3
23 Aug 2015 12:25 PM
send me your code, i'll help you



while true do print("lol") end
Report Abuse
nicemike40 is not online. nicemike40
Joined: 19 Dec 2008
Total Posts: 1814
23 Aug 2015 12:27 PM
explosion.Hit:connect(function(part, distance)
--if part is a piece of glass and distance < n
--break it
--end
end)

~Upload code to codepad-dot-org with Lua syntax highlighting to preserve indentation and make it easier to read!~
Report Abuse
Reshiram110 is not online. Reshiram110
Joined: 26 Nov 2014
Total Posts: 2265
23 Aug 2015 12:28 PM
Here.

local Player=game.Players.LocalPlayer
local Glass = script.Parent
local DecalBack = Glass["BackD"]
local DecalFront = Glass["FrontD"]
local TextureId = Glass.Texture
local broken = false

function onTouched(part)
local h=game.Players:GetPlayerFromCharacter(part.Parent)
if h==nil then
if broken == false then
broken = true
--DecalBack.Texture = TextureId.Value
--DecalFront.Texture = TextureId.Value
elseif broken == true then
local items = script.Parent.Parent:GetChildren()
for i,k in pairs(items) do
if k.Name == "ShowUp" then
k.Anchored=false
k.Transparency = 0.6
k.CanCollide = true
Glass.Transparency=1
Glass.CanCollide=false
end
end

end
end
end



Glass.Touched:connect(onTouched)
Report Abuse
morashsPeasant is not online. morashsPeasant
Joined: 06 Jan 2011
Total Posts: 4944
23 Aug 2015 12:28 PM
waat explosion fires a hit event?
TIL

while true do the do
Report Abuse
TwoRivers is not online. TwoRivers
Joined: 25 Aug 2011
Total Posts: 2821
23 Aug 2015 12:29 PM
it's one of those events you don't realize exists until you happen to look on its wiki page
Report Abuse
Reshiram110 is not online. Reshiram110
Joined: 26 Nov 2014
Total Posts: 2265
23 Aug 2015 12:31 PM
@Aspected my code has been posted.
Report Abuse
morashsPeasant is not online. morashsPeasant
Joined: 06 Jan 2011
Total Posts: 4944
23 Aug 2015 12:32 PM
Chief?

while true do the do
Report Abuse
lego555444 is not online. lego555444
Joined: 21 Sep 2008
Total Posts: 1383
23 Aug 2015 12:32 PM
Auto Fragmentation, lol
Report Abuse
TwoRivers is not online. TwoRivers
Joined: 25 Aug 2011
Total Posts: 2821
23 Aug 2015 12:33 PM
thats meeeeeee
Report Abuse
Reshiram110 is not online. Reshiram110
Joined: 26 Nov 2014
Total Posts: 2265
23 Aug 2015 12:45 PM
Help?
Report Abuse
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
23 Aug 2015 12:47 PM
o
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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