i_Movie
|
  |
| Joined: 06 Apr 2014 |
| Total Posts: 11725 |
|
|
| 20 Jul 2016 06:26 PM |
local Door = workspace:FindFirstChild("LerpDoor")
local Pos = Vector3.new(-53.315, 24.37, -157.299) local Pos2 = Vector3.new(-53.315, 50.63, -157.299)
local EndPos = Vector3.new(-53.315, 50.63, -157.299) local EndPos2 = Vector3.new(-53.315, 24.37, -157.299)
MainEntrance.MouseButton1Down:connect(function() if MainEntrance.Text == "Closed" then MainEntrance.Text = "Open" C.Text = "Curtain: Open" MainEntrance.BackgroundColor3 = Color3.new(0,85,0) for ratio1 = 0,1,0.01 do local NewPos = Pos:lerp(EndPos, ratio1) Door.Position = NewPos wait() end elseif MainEntrance.Text == "Open" then MainEntrance.Text = "Closed" C.Text = "Curtain: Closed" MainEntrance.BackgroundColor3 = Color3.new(170,0,0) for ratio2 = 0,1,0.01 do local NewPos = Pos2:lerp(EndPos2, ratio2) Door.Position = NewPos wait() end end end)
12,014 |
|
|
| Report Abuse |
|
|
|
| 20 Jul 2016 06:50 PM |
| Is anything happening? Any errors? |
|
|
| Report Abuse |
|
|
i_Movie
|
  |
| Joined: 06 Apr 2014 |
| Total Posts: 11725 |
|
|
| 20 Jul 2016 06:52 PM |
Checked output, nothing.. :/
11,802 |
|
|
| Report Abuse |
|
|
|
| 20 Jul 2016 06:59 PM |
| Are the texts of your guis changing? |
|
|
| Report Abuse |
|
|
i_Movie
|
  |
| Joined: 06 Apr 2014 |
| Total Posts: 11725 |
|
| |
|
|
| 20 Jul 2016 07:14 PM |
Lol nevermind I know what's wrong. Just use this.
local Door = workspace:FindFirstChild("LerpDoor")
local Pos = Vector3.new(-53.315, 24.37, -157.299) local EndPos = Vector3.new(-53.315, 50.63, -157.299) local steps = 100 local dif = (Pos-EndPos)/steps Door.Position = pos
MainEntrance.MouseButton1Down:connect(function() if MainEntrance.Text == "Closed" then MainEntrance.Text = "Open" C.Text = "Curtain: Open" MainEntrance.BackgroundColor3 = Color3.new(0,85,0) for ratio1 = 0,1,(1/steps) do Door.CFrame = Door.CFrame * CFrame.new(-dif) wait() end elseif MainEntrance.Text == "Open" then MainEntrance.Text = "Closed" C.Text = "Curtain: Closed" MainEntrance.BackgroundColor3 = Color3.new(170,0,0) for ratio2 = 0,1,(1/steps) do Door.CFrame = Door.CFrame * CFrame.new(dif) wait() end end end)
|
|
|
| Report Abuse |
|
|
|
| 20 Jul 2016 07:15 PM |
Err did that backwards; this is better
local Door = workspace:FindFirstChild("LerpDoor")
local Pos = Vector3.new(-53.315, 24.37, -157.299) local EndPos = Vector3.new(-53.315, 50.63, -157.299) local steps = 100 local dif = (Pos-EndPos)/steps Door.Position = pos
MainEntrance.MouseButton1Down:connect(function() if MainEntrance.Text == "Closed" then MainEntrance.Text = "Open" C.Text = "Curtain: Open" MainEntrance.BackgroundColor3 = Color3.new(0,85,0) for ratio1 = 0,1,(1/steps) do Door.CFrame = Door.CFrame * CFrame.new(dif) wait() end elseif MainEntrance.Text == "Open" then MainEntrance.Text = "Closed" C.Text = "Curtain: Closed" MainEntrance.BackgroundColor3 = Color3.new(170,0,0) for ratio2 = 0,1,(1/steps) do Door.CFrame = Door.CFrame * CFrame.new(-dif) wait() end end end)
|
|
|
| Report Abuse |
|
|
i_Movie
|
  |
| Joined: 06 Apr 2014 |
| Total Posts: 11725 |
|
| |
|
i_Movie
|
  |
| Joined: 06 Apr 2014 |
| Total Posts: 11725 |
|
|
| 20 Jul 2016 07:55 PM |
Doesn't work.. :/ Still no output, should it be a serverscript or a localscript? Because here's the full script.
local Player = game.Players.LocalPlayer local PlayerGui = Player.PlayerGui local Gui = PlayerGui:WaitForChild("SurfaceGui") local ControlFrame = Gui:FindFirstChild("ControlFrame") local DoorHandler = ControlFrame:FindFirstChild("DoorHandler") local MainEntrance = DoorHandler:FindFirstChild("Curtain") local C = DoorHandler:FindFirstChild("C")
local Door = workspace:FindFirstChild("LerpDoor")
local Pos = Vector3.new(-53.315, 24.37, -157.299) local EndPos = Vector3.new(-53.315, 50.63, -157.299) local steps = 100 local dif = (Pos-EndPos)/steps Door.Position = pos
MainEntrance.MouseButton1Down:connect(function() if MainEntrance.Text == "Closed" then MainEntrance.Text = "Open" C.Text = "Curtain: Open" MainEntrance.BackgroundColor3 = Color3.new(0,85,0) for ratio1 = 0,1,(1/steps) do Door.CFrame = Door.CFrame * CFrame.new(dif) wait() end elseif MainEntrance.Text == "Open" then MainEntrance.Text = "Closed" C.Text = "Curtain: Closed" MainEntrance.BackgroundColor3 = Color3.new(170,0,0) for ratio2 = 0,1,(1/steps) do Door.CFrame = Door.CFrame * CFrame.new(-dif) wait() end end end)
11,783 |
|
|
| Report Abuse |
|
|
i_Movie
|
  |
| Joined: 06 Apr 2014 |
| Total Posts: 11725 |
|
| |
|
| |
|
i_Movie
|
  |
| Joined: 06 Apr 2014 |
| Total Posts: 11725 |
|
|
| 21 Jul 2016 12:31 AM |
Yes, should it not be?
11,873 |
|
|
| Report Abuse |
|
|
|
| 21 Jul 2016 12:38 AM |
The problem is you're trying to lerp a position, when you should be lerping a CFrame.
Heres the updated code(Be aware I did not run this through studio's IDE):
local Door = workspace:FindFirstChild("LerpDoor")
local Pos = CFrame.new(-53.315, 24.37, -157.299) local Pos2 = CFrame.new(-53.315, 50.63, -157.299)
local EndPos = CFrame.new(-53.315, 50.63, -157.299) local EndPos2 = CFrame.new(-53.315, 24.37, -157.299)
MainEntrance.MouseButton1Down:connect(function() if MainEntrance.Text == "Closed" then MainEntrance.Text = "Open" C.Text = "Curtain: Open" MainEntrance.BackgroundColor3 = Color3.new(0,85,0) for ratio1 = 0,1,0.01 do Door.CFrame = Door.CFrame:lerp(EndPos, ratio1) wait() end elseif MainEntrance.Text == "Open" then MainEntrance.Text = "Closed" C.Text = "Curtain: Closed" MainEntrance.BackgroundColor3 = Color3.new(170,0,0) for ratio2 = 0,1,0.01 do Door.CFrame = Door.CFrame:lerp(EndPos2, ratio2) wait() end end end)
You're gonna wanna make sure that the CFrame values are correct, because they're probably not.
--Your friendly neighborhood programmer-- |
|
|
| Report Abuse |
|
|
i_Movie
|
  |
| Joined: 06 Apr 2014 |
| Total Posts: 11725 |
|
|
| 21 Jul 2016 01:01 AM |
Oh, thanks! I'll test it
11,873 |
|
|
| Report Abuse |
|
|