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 » Game Design
Home Search
 

Re: Scripting Help! Touch and Click door at the same time?

Previous Thread :: Next Thread 
EpicGammaDude is not online. EpicGammaDude
Joined: 13 Apr 2014
Total Posts: 6
21 Nov 2015 05:55 AM
Is there any way of making a door that you have to be touching the Door and Clicking a button at the same time to open the Door?

This is the code I currently have.

function tch(h)
if script.Parent.Parent.Button.ClickDetector.MouseClick:connect() then
script.Parent:CanCollide = false
wait(5)
script.Parent:CanCollide = true
end
end


script.Parent.Touched:connect(tch)
Report Abuse
UgOsMiLy is not online. UgOsMiLy
Joined: 15 Sep 2009
Total Posts: 2095
21 Nov 2015 06:29 AM
function tch(h)
script.Parent.Parent.Button.ClickDetector.MouseClick:connect(function(p)
script.Parent:CanCollide = false
wait(5)
script.Parent:CanCollide = true
end)
end

script.Parent.Touched:connect(tch)

(I think)
Report Abuse
EpicGammaDude is not online. EpicGammaDude
Joined: 13 Apr 2014
Total Posts: 6
21 Nov 2015 06:50 AM
Did not work :(

Oh yeah I replaced the :CanCollide with a .CanCollide (Error I made Lol)
Report Abuse
Metology is not online. Metology
Joined: 06 Oct 2014
Total Posts: 3255
21 Nov 2015 07:24 AM
U just said a function that hasn't even been recognized yet...
Report Abuse
EpicGammaDude is not online. EpicGammaDude
Joined: 13 Apr 2014
Total Posts: 6
21 Nov 2015 07:30 AM
Never seen a Function in a Function before.. But anyway, Help anyone?
Report Abuse
RoKjell is not online. RoKjell
Joined: 22 Nov 2012
Total Posts: 1205
21 Nov 2015 07:38 AM
I'm not giving the script but I'll explain how you can do this. That way you learn something by doing it yourself.

You can make touch (Touched) function which sets a certain value to true and another function that when you're not touching (TouchEnded)it anymore, it changes back to false. Then you use the click function which will check if it's true, and if it's true it will do what you want.



Error 666: Error not found.
Report Abuse
championbuilder is not online. championbuilder
Joined: 20 Jan 2009
Total Posts: 13544
21 Nov 2015 07:41 AM
Touching = false
for _,v in pairs(Character:GetTouchingParts()) do
Touching = true
end

Button.ClickDetector.MouseClick:connect(function()
if Touching then
print'Touching Door and Clicked Brick'
else
print'Character not touching door'
end
end)
Report Abuse
EpicGammaDude is not online. EpicGammaDude
Joined: 13 Apr 2014
Total Posts: 6
21 Nov 2015 08:09 AM
Thanks guys
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Game Design
   
 
   
  • 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