112 lines
2.7 KiB
Lua
Raw Normal View History

2020-04-10 18:31:04 -05:00
swivler = script.Parent
2020-04-10 15:47:38 -05:00
2020-04-10 18:31:04 -05:00
function rotateMod(mod, center, rotation)
local parts = {}
2020-04-10 15:47:38 -05:00
local function scan(parent)
2020-04-10 18:31:04 -05:00
for _, obj in pairs(parent:GetChildren()) do
2020-04-10 15:47:38 -05:00
if (obj:IsA("BasePart")) then
2020-04-10 18:31:04 -05:00
table.insert(parts, obj)
2020-04-10 15:47:38 -05:00
end
scan(obj)
end
end
2020-04-10 18:31:04 -05:00
2020-04-10 15:47:38 -05:00
scan(mod)
2020-04-10 18:31:04 -05:00
for _, part in pairs(parts) do
part.CFrame = (center * rotation * (center:inverse() * part.CFrame))
2020-04-10 15:47:38 -05:00
end
end
function Right()
2020-04-10 18:31:04 -05:00
script.Parent.Left.Use.MaxActivationDistance = 0
script.Parent.Right.Use.MaxActivationDistance = 0
2020-04-10 15:47:38 -05:00
2020-04-10 18:31:04 -05:00
if script.Parent.Swivelspot.Value == 1 then
if script.Parent.Parent.ScreenA.Swivelspot.Value == 6 then
else
script.Parent.Base.Move:Play()
script.Parent.Swivelspot.Value = 6
local mod = swivler
local step = 1
for i = 0, 13.5, step do
rotateMod(mod, mod:GetModelCFrame(), CFrame.Angles(0, 0.075, 0))
wait()
end
end
2020-04-10 15:47:38 -05:00
2020-04-10 18:31:04 -05:00
else if script.Parent.Swivelspot.Value == 6 then
if script.Parent.Parent.ScreenA.Swivelspot.Value == 5 then
else
script.Parent.Base.Move:Play()
script.Parent.Swivelspot.Value = 5
local mod = swivler
local step = 1
for i = 0, 13.5, step do
rotateMod(mod, mod:GetModelCFrame(), CFrame.Angles(0, 0.075, 0))
wait()
end
end
2020-04-10 15:47:38 -05:00
2020-04-10 18:31:04 -05:00
else if script.Parent.Swivelspot.Value == 5 then
if script.Parent.Parent.ScreenA.Swivelspot.Value == 4 then
else
script.Parent.Base.Move:Play()
script.Parent.Swivelspot.Value = 4
local mod = swivler
local step = 1
for i = 0, 13.5, step do
rotateMod(mod, mod:GetModelCFrame(), CFrame.Angles(0, 0.075, 0))
wait()
end
end
2020-04-10 15:47:38 -05:00
2020-04-10 18:31:04 -05:00
else if script.Parent.Swivelspot.Value == 4 then
if script.Parent.Parent.ScreenA.Swivelspot.Value == 3 then
else
script.Parent.Base.Move:Play()
script.Parent.Swivelspot.Value = 3
local mod = swivler
local step = 1
for i = 0, 13.5, step do
rotateMod(mod, mod:GetModelCFrame(), CFrame.Angles(0, 0.075, 0))
wait()
end
end
2020-04-10 15:47:38 -05:00
2020-04-10 18:31:04 -05:00
else if script.Parent.Swivelspot.Value == 3 then
if script.Parent.Parent.ScreenA.Swivelspot.Value == 2 then
else
script.Parent.Base.Move:Play()
script.Parent.Swivelspot.Value = 2
local mod = swivler
local step = 1
for i = 0, 13.5, step do
rotateMod(mod, mod:GetModelCFrame(), CFrame.Angles(0, 0.075, 0))
wait()
end
end
2020-04-10 15:47:38 -05:00
2020-04-10 18:31:04 -05:00
else if script.Parent.Swivelspot.Value == 2 then
if script.Parent.Parent.ScreenA.Swivelspot.Value == 1 then
else
script.Parent.Base.Move:Play()
script.Parent.Swivelspot.Value = 1
local mod = swivler
local step = 1
for i = 0, 13.5, step do
rotateMod(mod, mod:GetModelCFrame(), CFrame.Angles(0, 0.075, 0))
wait()
end
end
end
end
end
end
end
end
script.Parent.Left.Use.MaxActivationDistance = 10
script.Parent.Right.Use.MaxActivationDistance = 10
2020-04-10 15:47:38 -05:00
end
script.Parent.Right.Use.MouseClick:connect(Right)