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: Cancollide = false on shot

Previous Thread :: Next Thread 
Secretiverobocop is not online. Secretiverobocop
Joined: 23 Apr 2011
Total Posts: 510
21 Jan 2012 04:23 PM
I'm making a fort. That features a brick that If you shoot it 10 times, the brick's cancollide will be false and the bricks Transparency = 1. Which will reveal a secret entrance into the base. This function is somewhat like a WIJ door which I have seen in fort indigo but without all the GUI's. Heres what I got but i fail epiclly at scripting on the spot.


if script.Parent.HasTouched ("Laser1", 10) then
script.Parent.CanCollide = false
script.Parent.Transparency = 1
wait(60)
script.Parent.CanCollide = true
script.Parent.Transparency = 1
end

dont make fun of me, I'm just a beginner and I have little scripting knowledge as of this subject
Report Abuse
DealerNextDoor is not online. DealerNextDoor
Joined: 20 Feb 2011
Total Posts: 32
21 Jan 2012 04:25 PM
`script.Parent.HasTouched` is not a valid member of Instance BaseClass. Meaning, `HasTouched()` isn't a real function...

TheNewScripter
Report Abuse
Secretiverobocop is not online. Secretiverobocop
Joined: 23 Apr 2011
Total Posts: 510
21 Jan 2012 04:30 PM
Yea, That was just one of my epic fails to script a function -.-
Report Abuse
Shobobo99 is not online. Shobobo99
Joined: 30 Dec 2008
Total Posts: 5754
21 Jan 2012 04:44 PM
You gave it a good shot!

local touchedTimes = 0
script.Parent.Touched:connect(function (hit)
if hit.Name == "Laser1" then -- if it is hit by a laser then,
touchedTimes = touchedTimes + 1 -- add 1
if touchedTimes == 10 then
script.Parent.CanCollide = false
script.Parent.Transparency = 1
wait(60)
touchedTimes = 0 -- reset
script.Parent.CanCollide = true
script.Parent.Transparency = 0
end
end
end)
Report Abuse
Secretiverobocop is not online. Secretiverobocop
Joined: 23 Apr 2011
Total Posts: 510
21 Jan 2012 04:57 PM
Thanks so much for your help!
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