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
 

Need help with door script (Uses CFrame)

Previous Thread :: Next Thread 
Sharpthy is not online. Sharpthy
Joined: 18 Jan 2014
Total Posts: 57
14 Jun 2015 08:08 AM
My door script does not work. I don't know why. I need someone to help me, and once that is done, I also need to change the door opening speed!
Thanks for the help:

local DoorOpen = 0
--0 = Closed, 1 = Open.
local InUse = 0
--0 = Active, 1 = Still.

function onClicked()
if DoorOpen == 0 then
if InUse = 0 then
--Open the doors!
InUse = 1
DoorOpen = 1
Door.CFrame = CFrame.new(-141, 6.5, 120)
InUse = 0
else
--Close the doors!
InUse = 1
DoorOpen = 0
Door.CFrame = CFrame.new(-141,6.5, 152)
InUse = 0
end
end

model.button.ClickDetector.MouseClick:connect(onClicked)

--Open CFrame = -141, 6.5, 120
--Closed CFrame = -141, 6.5, 152
Report Abuse
Sharpthy is not online. Sharpthy
Joined: 18 Jan 2014
Total Posts: 57
14 Jun 2015 08:14 AM
File Structure:

Courtyard doors
|Courtyard door
|Button
|ClickDetector
|Script



Report Abuse
Sharpthy is not online. Sharpthy
Joined: 18 Jan 2014
Total Posts: 57
14 Jun 2015 09:33 AM
I've changed the script a bit:

door = script.parent.CourtyardDoor

local DoorOpen = 0
--0 = Closed, 1 = Open.
local InUse = 0
--0 = Active, 1 = Still.

function onClicked (mouse)
if DoorOpen == 0 then
if InUse == 0 then
--Open the doors!
print 'Door Opening'
InUse = 1
DoorOpen = 1
door.CFrame = CFrame.new(-141, 6.5, 120)
InUse = 0
print 'Door Opened'
else
--Close the doors!
print 'Door Closing'
InUse = 1
DoorOpen = 0
door.CFrame = CFrame.new(-141,6.5, 152)
InUse = 0
print 'Door Closed'
end
end
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

--Open CFrame = -141, 6.5, 120
--Closed CFrame = -141, 6.5, 152
Report Abuse
Sharpthy is not online. Sharpthy
Joined: 18 Jan 2014
Total Posts: 57
14 Jun 2015 11:17 AM
Bump
Report Abuse
iSpecializinq is not online. iSpecializinq
Joined: 31 May 2015
Total Posts: 2182
14 Jun 2015 11:52 AM
Bamp 2.0
Report Abuse
Sharpthy is not online. Sharpthy
Joined: 18 Jan 2014
Total Posts: 57
14 Jun 2015 01:05 PM
Needed to change .parent. to .Parent.
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