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
 

Help!

Previous Thread :: Next Thread 
Vupa is not online. Vupa
Joined: 07 Dec 2009
Total Posts: 5637
11 Jul 2015 01:15 PM
I made a brick wall that gets destroyed when you hit it with a sledgehammer tool. I want to make it so the bricks only get destroyed if you swing at them. The script I have right now allows the bricks to be destroyed even if you walk up to it and touch it with the sledgehammer.
Heres what it looks like
Model
>Script
>Brick
>Brick
and so on.
the script is:
for i, v in next, workspace.Model:GetChildren() do
if v:IsA("BasePart") then
v.Touched:connect(function(hit)
if hit.Parent.Name == "Sledgehammer" then
v:Destroy()
end
end)
end
end

how would I edit it to only be destroyed when you swing the sledgehammer?

Report Abuse
ThaneTheCreator is not online. ThaneTheCreator
Joined: 08 Apr 2009
Total Posts: 2182
11 Jul 2015 01:29 PM
Insert a boolvalue into the sledgehammer part, and have it's value enabled when you swing, and disabled after you swing, then have the script detect if it's value is true to break the wall.

~who's awesome? you're awesome!
Report Abuse
Vupa is not online. Vupa
Joined: 07 Dec 2009
Total Posts: 5637
12 Jul 2015 01:43 PM
err. could you put that in more simple terms? sorry. lol.
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