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: door cancollide problem

Previous Thread :: Next Thread 
Dwayder is not online. Dwayder
Joined: 12 Jun 2015
Total Posts: 283
30 Apr 2016 08:45 AM
if script.Parent.Touched.Name == "Player1" then
script.Parent.CanCollide = false
end


what's wrong? when i say "touched", do i refer to the touched object or the thing that touches the object? Thanks
Report Abuse
RobuxLife is not online. RobuxLife
Joined: 19 Sep 2012
Total Posts: 13336
30 Apr 2016 08:47 AM
I tried this in studio and it works.

function touched(hit)
h = hit.Parent
if h.Name == ("Player1") then
script.Parent.CanCollide = false
end
end

script.Parent.Touched:connect(touched)


R$4,668 In america, you eat tickets. In soviet Russia, tickets, eat you!
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
30 Apr 2016 08:50 AM
You need to set up an event. That code will only run once, and error because that's not how it works.


script.Parent.Touched:connect(function(Hit)
if Hit.Parent.Name == "Player1" and script.Parent.CanCollide then -- Check the name and make sure it doesn't run more than once at a time.
script.Parent.CanCollide = false
wait(2) -- Door stays open for two seconds.
script.Parent.CanCollide = true
end
end)
Report Abuse
RobuxLife is not online. RobuxLife
Joined: 19 Sep 2012
Total Posts: 13336
30 Apr 2016 08:50 AM
Actually, use jared's if you want it to close again. Mine only works once :P.
Good luck!


R$4,668 In america, you eat tickets. In soviet Russia, tickets, eat you!
Report Abuse
Dwayder is not online. Dwayder
Joined: 12 Jun 2015
Total Posts: 283
30 Apr 2016 08:52 AM
thanks a lot guys!
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
30 Apr 2016 08:52 AM
At the top of my post I was talking about the original poster, but yeah, yours wouldn't close again.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
30 Apr 2016 08:52 AM
No problem, and good luck on your coding. :)
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