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: Open/Close gate button script

Previous Thread :: Next Thread 
epicmaster7101 is not online. epicmaster7101
Joined: 26 Feb 2013
Total Posts: 1720
07 Sep 2013 11:40 AM
Okay, I'm making a fort for my Clan, and I've decided to make a gate but, because I can't script, I need help with something:
If you've been to a group's fort, there may have been a gate there. The way that gate usually works is that there are two buttons: red and green. The green button opens the gate, whereas the red closes it. I'm trying to make a gate like that, but I don't know how to. If anyone knows, please help!
Report Abuse
epicmaster7101 is not online. epicmaster7101
Joined: 26 Feb 2013
Total Posts: 1720
07 Sep 2013 11:44 AM
Any ideas?
Report Abuse
domb26 is not online. domb26
Joined: 10 Nov 2012
Total Posts: 24
07 Sep 2013 12:13 PM
some items from the catalog will do it. the links are:
http://www.roblox.com/FOB-Main-Gate-item?id=106284198
http://www.roblox.com/Elite-Desert-Attack-Squad-Base-gate-item?id=70315522
http://www.roblox.com/Military-Fence-Gate-item?id=44167284
Report Abuse
epicmaster7101 is not online. epicmaster7101
Joined: 26 Feb 2013
Total Posts: 1720
07 Sep 2013 12:13 PM
I know, but I don't want to use free models.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
07 Sep 2013 12:14 PM
local Open = true
local Part = game.Workspace.Model:GetChildren()

Button.ClickDetector.MouseClick:connect(function(p)
Open = not Open
for id,val in pairs(Part) do
val.CanCollide = open
val.Transparency = Open and 1 or 0
end
end)
Report Abuse
epicmaster7101 is not online. epicmaster7101
Joined: 26 Feb 2013
Total Posts: 1720
07 Sep 2013 12:15 PM
Ah, thanks. Do I insert that script in the model? (I'm new to scripting)
Report Abuse
your90 is not online. your90
Joined: 06 Mar 2011
Total Posts: 1380
07 Sep 2013 12:17 PM
Close:

function onClicked()
script.Parent.Transparency = 0 --Assuming the script is in the door.
script.Parent.CanCollide = true --^
wait(2)
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)

Open:

function onClicked()
script.Parent.Transparency = .5 --Assuming the script is in the door.
script.Parent.CanCollide = false --^
wait(2)
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
Report Abuse
epicmaster7101 is not online. epicmaster7101
Joined: 26 Feb 2013
Total Posts: 1720
07 Sep 2013 12:19 PM
Thank you. I will work on this now.
I'll post the link to the fort once I'm done ^_^
Report Abuse
your90 is not online. your90
Joined: 06 Mar 2011
Total Posts: 1380
07 Sep 2013 12:21 PM
^__^
Report Abuse
epicmaster7101 is not online. epicmaster7101
Joined: 26 Feb 2013
Total Posts: 1720
07 Sep 2013 02:52 PM
Wait, how do I ensure that those scripts open the correct gate? Do I need to insert another script into that gate?
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