ok I have a rocket that I want to come up out of the ground after two doors open upwards at the same time.
when opening they open up and out
then the rocket will start to raise up out of the ground.
I have been working on this code all day, trying different ways.
none of the ways would work.
path is in the code but here it is anyway
WorkSpace SiloControls SiloRaise(script that opens the doors) Light RaiseMissle SiloDoorOpen(button to open the doors) ClickDetector Bar LeverHandle Silo LeftDoor RightDoor
Ok I have changed this code based on recommendations, but it still seams to be broken.
I have reviewed the new code and I understand the changes all but (part, difference, by)
I am trying to learn new and easier ways to do this so please don't give a - score....
thanks for any help you can offer.
LeftDoor = script.Parent.Silo.LeftDoor
function moveY(part, difference, by)
--local up = (difference < 0 and -1 or 1) * (by or 0.5)
local up
if difference < 0 then
up = -(by or 0.5)
else
up = (by or 0.5)
end
for y = 0, difference, up do
part.CFrame = part.CFrame + Vector3.new(0, up, 0)
wait()
end
end
function moveZ(part, difference, by)
local Left
if difference < 0 then
Left = -(by or 0.1)
else
Left = (by or 0.1)
end
for y = 0, difference, Left do
part.CFrame = part.CFrame + Vector3.new(0, Left, 0)
wait()
end
end
function spinX(part, angle, by)
local spin = (angle < 0 and -1 or 1) * (by or 1) -- degrees
for t = 0, angle, spin do
part.CFrame = part.CFrame * CFrame.Angles( math.rad( spin ), 0, 0)
wait()
end
end
function On()
while script.Parent.ActivateButton.On.Value == false do
spinX(LeftDoor, 12 - 0, 1)
moveY(LeftDoor, 88.5 - 88.3, 0.2)
spinX(LeftDoor, 18 - 12, 1)
moveY(LeftDoor, 88.7 - 88.5, 0.2)
spinX(LeftDoor, 25 - 18, 1)
moveZ(LeftDoor, -204.4 - -204.5, .1)
moveY(LeftDoor, 88.8 - 88.7, 0.1)
spinX(LeftDoor, 28 - 25, 1)
moveZ(LeftDoor, -204.35 - -204.4, .05)
spinX(LeftDoor, 30 - 28, 1)
moveY(LeftDoor, 88.9 - 88.7, 0.1)
spinX(LeftDoor, 33 - 30, 1)
moveY(LeftDoor, 89 - 88.9, .1)
moveZ(LeftDoor, -204.3 - -204.35, .05)
spinX(LeftDoor, 37 - 33, 1)
moveY(LeftDoor, 89.1 - 89, .1)
moveZ(LeftDoor, -204.25 - -204.3, .05)
spinX(LeftDoor, 41 - 37, 1)
moveY(LeftDoor, 89.2 - 89.1, 0.1)
moveZ(LeftDoor, -204.2 - -204.25, .05)
spinX(LeftDoor, 45 - 41, 1)
moveZ(LeftDoor, -204.1 - -204.2, .05)
moveY(LeftDoor, 89.3 - 89.2, 0.1)
spinX(LeftDoor, 50 - 45, 1)
moveZ(LeftDoor, -204.05 - -204.2, .05)
spinX(LeftDoor, 53 - 50, 1)
moveY(LeftDoor, 89.4 - 89.3, .1)
moveZ(LeftDoor, -204 - -204.2, .05)
spinX(LeftDoor, 56 - 53, 1)
moveZ(LeftDoor, -203.95 - -204, .05)
spinX(LeftDoor, 59 - 56, 1)
moveY(LeftDoor, 89.5 - 89.4, .1)
moveZ(LeftDoor, -203.9 - -203.95, .05)
spinX(LeftDoor, 62 - 59, 1)
moveZ(LeftDoor, -203.85 - -203.9, .05)
spinX(LeftDoor, 65 - 62, 1)
moveZ(LeftDoor, -203.75 - -203.85, .05)
spinX(LeftDoor, 67 - 65, 1)
moveZ(LeftDoor, -203.7 - -203.75, .05)
spinX(LeftDoor, 68 - 67, 1)
moveY(LeftDoor, 89.55 - 89.4, .1)
moveZ(LeftDoor, -203.65 - -203.7, .05)
spinX(LeftDoor, 70 - 68, 1)
moveZ(LeftDoor, -203.6 - -203.65, .05)
spinX(LeftDoor, 72 - 70, 1)
moveZ(LeftDoor, -203.55 - -203.6, .05)
spinX(LeftDoor, 74 - 72, 1)
moveZ(LeftDoor, -203.5 - -203.55, .05)
spinX(LeftDoor, 76 - 74, 1)
moveZ(LeftDoor, -203.45 - -203.55, .05)
spinX(LeftDoor, 78 - 76, 1)
moveZ(LeftDoor, -203.4 - -203.45, .05)
spinX(LeftDoor, 79 - 78, 1)
moveZ(LeftDoor, -203.35 - -203.4, .05)
spinX(LeftDoor, 81 - 79, 1)
moveZ(LeftDoor, -203.3 - -203.35, .05)
spinX(LeftDoor, 83 - 81, 1)
moveZ(LeftDoor, -203.25 - -203.3, .05)
spinX(LeftDoor, 86 - 83, 1)
moveZ(LeftDoor, -203.2 - -203.25, .05)
spinX(LeftDoor, 88 - 86, 1)
moveZ(LeftDoor, -203.15 - -203.2, .05)
spinX(LeftDoor, 90 - 88, 1)
moveZ(LeftDoor, -203.1 - -203.15, .05)
end
end
script.Parent.SiloDoorOpen.LeverHandle.ClickDetector.Click:connect(On)

1 comment
why the heck would someone give me a -1 when i asked a simple question, they didnt even leave a comment.....this web site is for asking questions.... i know this wasnt the best script but i said that when i posted it. i want i refined one if somone can help an dnot be rude...