AgentL3r
|
  |
| Joined: 14 Jan 2013 |
| Total Posts: 1671 |
|
|
| 01 Nov 2014 10:49 AM |
Hello all.
I have this script which opens a door when clicked.
local cf = script.Parent.CFrame
function onClicked() if script.IsOpened.Value == false and script.IsOpening.Value == false then script.IsOpening.Value = true for i = 1,16 do script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0, 0, 0.18) * CFrame.fromEulerAnglesXYZ(0, 0.1, 0) wait(0.01) end script.IsOpening.Value = false script.IsOpened.Value = true elseif script.IsOpened.Value == true and script.IsOpening.Value == false then script.IsOpening.Value = true for i = 1,16 do script.Parent.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0, -0.1, 0) * CFrame.new(0, 0, -0.18) wait(0.01) end script.IsOpening.Value = false script.IsOpened.Value = false script.Parent.CFrame = cf script.CloseSound:Play() end end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
There are 2 problems.
1: I need it to open more then one part. (3 parts and 1 union including this) 2: It won't open all the way.
Can anyone help me fix the script. The door can be found here:
http://web.roblox.com/testing-item?id=184984625
Kind regards
AgentL3r
|
|
|
| Report Abuse |
|
|
AgentL3r
|
  |
| Joined: 14 Jan 2013 |
| Total Posts: 1671 |
|
| |
|
AgentL3r
|
  |
| Joined: 14 Jan 2013 |
| Total Posts: 1671 |
|
| |
|
AgentL3r
|
  |
| Joined: 14 Jan 2013 |
| Total Posts: 1671 |
|
| |
|
AgentL3r
|
  |
| Joined: 14 Jan 2013 |
| Total Posts: 1671 |
|
| |
|
AgentL3r
|
  |
| Joined: 14 Jan 2013 |
| Total Posts: 1671 |
|
| |
|
AgentL3r
|
  |
| Joined: 14 Jan 2013 |
| Total Posts: 1671 |
|
| |
|
powertool
|
  |
| Joined: 01 Feb 2008 |
| Total Posts: 3771 |
|
|
| 01 Nov 2014 02:12 PM |
1. Use another for loop to iterate through the parts to move 'em. 2. Adjust the amount of steps in your for loop.
1. Alternatively, GROUP all the parts of the door within the model, set a primary part, and move that with :SetPrimaryPartCFrame(). |
|
|
| Report Abuse |
|
|
AgentL3r
|
  |
| Joined: 14 Jan 2013 |
| Total Posts: 1671 |
|
|
| 01 Nov 2014 03:48 PM |
| How do I make another forloop for the other parts? |
|
|
| Report Abuse |
|
|
AgentL3r
|
  |
| Joined: 14 Jan 2013 |
| Total Posts: 1671 |
|
| |
|
AgentL3r
|
  |
| Joined: 14 Jan 2013 |
| Total Posts: 1671 |
|
| |
|
AgentL3r
|
  |
| Joined: 14 Jan 2013 |
| Total Posts: 1671 |
|
| |
|
SkiIlage
|
  |
| Joined: 25 Nov 2011 |
| Total Posts: 51 |
|
|
| 02 Nov 2014 05:43 AM |
coroutine?
They allow you to create a function that doesn't pause until it's finished, it just runs while the rest of the script runs. |
|
|
| Report Abuse |
|
|
AgentL3r
|
  |
| Joined: 14 Jan 2013 |
| Total Posts: 1671 |
|
| |
|
AgentL3r
|
  |
| Joined: 14 Jan 2013 |
| Total Posts: 1671 |
|
| |
|
AgentL3r
|
  |
| Joined: 14 Jan 2013 |
| Total Posts: 1671 |
|
| |
|
davisky2
|
  |
| Joined: 04 Mar 2012 |
| Total Posts: 4710 |
|
| |
|
davisky2
|
  |
| Joined: 04 Mar 2012 |
| Total Posts: 4710 |
|
| |
|
davisky2
|
  |
| Joined: 04 Mar 2012 |
| Total Posts: 4710 |
|
|
| 02 Nov 2014 12:43 PM |
bump vierzehn
Should i continue? |
|
|
| Report Abuse |
|
|
AgentL3r
|
  |
| Joined: 14 Jan 2013 |
| Total Posts: 1671 |
|
| |
|
AgentL3r
|
  |
| Joined: 14 Jan 2013 |
| Total Posts: 1671 |
|
| |
|
AgentL3r
|
  |
| Joined: 14 Jan 2013 |
| Total Posts: 1671 |
|
| |
|
|
| 03 Nov 2014 10:25 AM |
| You want the door to open with multiple parts? I have just such a door i made a while back, Let me see if i can fetch the script for you. |
|
|
| Report Abuse |
|
|
|
| 03 Nov 2014 10:32 AM |
| Long and painful was that process... I basically rotated and moved the main part of the door, and then used its cframe to offset and rotate the other pieces after. Its the hard way to go about it, but that was 4 years ago. Probably some better way to do it now, but thats what i got. my "Project" place has it in it, look at the script in the door, ill uncopylock it for you. |
|
|
| Report Abuse |
|
|
AgentL3r
|
  |
| Joined: 14 Jan 2013 |
| Total Posts: 1671 |
|
|
| 03 Nov 2014 11:44 AM |
That didn't work. I editied the script around and lets say it didn't turn out right.
Bump 17 |
|
|
| Report Abuse |
|
|