Power leaver works and controls bluelights
This commit is contained in:
parent
a9314132c2
commit
0e8ac880de
File diff suppressed because it is too large
Load Diff
@ -17,7 +17,7 @@ function toBits(num)
|
||||
return t
|
||||
end
|
||||
|
||||
for i, part in pairs(script.Parent:GetChildren()) do
|
||||
for _, part in pairs(script.Parent:GetChildren()) do
|
||||
if part.Name == string.match(part.Name, '^Bit.*$') then
|
||||
bits[tonumber(string.match(part.Name, '%d'))] = part
|
||||
end
|
||||
|
@ -1,41 +0,0 @@
|
||||
function onClicked()
|
||||
|
||||
wait(0.05)
|
||||
|
||||
if script.Parent.Main.Pulled.Value == true then
|
||||
|
||||
script.Parent.LED1.Material = Enum.Material.SmoothPlastic
|
||||
wait(0.05)
|
||||
script.Parent.LED2.Material = Enum.Material.SmoothPlastic
|
||||
wait(0.05)
|
||||
script.Parent.LED3.Material = Enum.Material.SmoothPlastic
|
||||
wait(0.05)
|
||||
script.Parent.LED4.Material = Enum.Material.SmoothPlastic
|
||||
wait(0.05)
|
||||
script.Parent.LED5.Material = Enum.Material.SmoothPlastic
|
||||
wait(0.05)
|
||||
script.Parent.LED6.Material = Enum.Material.SmoothPlastic
|
||||
wait(0.05)
|
||||
script.Parent.LED7.Material = Enum.Material.SmoothPlastic
|
||||
wait(0.05)
|
||||
|
||||
else
|
||||
|
||||
script.Parent.LED7.Material = Enum.Material.Neon
|
||||
wait(0.05)
|
||||
script.Parent.LED6.Material = Enum.Material.Neon
|
||||
wait(0.05)
|
||||
script.Parent.LED5.Material = Enum.Material.Neon
|
||||
wait(0.05)
|
||||
script.Parent.LED4.Material = Enum.Material.Neon
|
||||
wait(0.05)
|
||||
script.Parent.LED3.Material = Enum.Material.Neon
|
||||
wait(0.05)
|
||||
script.Parent.LED2.Material = Enum.Material.Neon
|
||||
wait(0.05)
|
||||
script.Parent.LED1.Material = Enum.Material.Neon
|
||||
wait(0.05)
|
||||
end
|
||||
end
|
||||
|
||||
script.Parent.Main.Use.MouseClick:connect(onClicked)
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"ignoreUnknownInstances": true
|
||||
}
|
@ -1,47 +1,47 @@
|
||||
lever = script.Parent
|
||||
local TweenService = game:GetService("TweenService")
|
||||
local isTardisPowered = script["Data Link"].Value.isTardisPowered
|
||||
local timeout = false
|
||||
|
||||
function rotateMod(mod, center, rotation)
|
||||
local parts = {}
|
||||
local function scan(parent)
|
||||
for _, obj in pairs(parent:GetChildren()) do
|
||||
if (obj:IsA("BasePart")) then
|
||||
table.insert(parts, obj)
|
||||
local tweeningInfo = TweenInfo.new(.7, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0)
|
||||
local properties = { CFrame = CFrame.new(-1.5023663, 7.0893445, 58.3542709, 0.984808147, -3.66869699e-08, -0.173646823, -0.0577740073, 0.943029344, -0.327655584, 0.163754016, 0.332710117, 0.928702831); }
|
||||
local activate = TweenService:Create(script.Parent.Main, tweeningInfo, properties)
|
||||
|
||||
tweeningInfo = TweenInfo.new(.7, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0)
|
||||
properties = { CFrame = CFrame.new(-1.50233305, 7.0893302, 58.3543015, -0.342019916, 1.12122891e-07, -0.939692736, -0.312644899, 0.943029344, 0.113793463, 0.886157751, 0.332709789, -0.32253474); }
|
||||
local deactivate = TweenService:Create(script.Parent.Main, tweeningInfo, properties)
|
||||
|
||||
local leds = {}
|
||||
for _, part in pairs(script.Parent.Parent:GetChildren()) do
|
||||
if part.Name == string.match(part.Name, '^LED.*$') then
|
||||
print(part.Name)
|
||||
leds[tonumber(string.match(part.Name, '%d'))] = part
|
||||
end
|
||||
end
|
||||
|
||||
local used = function()
|
||||
if timeout == false then
|
||||
timeout = true
|
||||
if isTardisPowered.Value == true then
|
||||
deactivate:Play()
|
||||
isTardisPowered.Value = false
|
||||
|
||||
for i = 1, 7, 1 do
|
||||
leds[i].Material = Enum.Material.SmoothPlastic
|
||||
wait(.1)
|
||||
end
|
||||
scan(obj)
|
||||
end
|
||||
end
|
||||
|
||||
scan(mod)
|
||||
for _, part in pairs(parts) do
|
||||
part.CFrame = (center * rotation * (center:inverse() * part.CFrame))
|
||||
else
|
||||
activate:Play()
|
||||
isTardisPowered.Value = true
|
||||
|
||||
for i = 7, 1, -1 do
|
||||
leds[i].Material = Enum.Material.Neon
|
||||
wait(.1)
|
||||
end
|
||||
end
|
||||
wait(7)
|
||||
timeout = false
|
||||
end
|
||||
end
|
||||
|
||||
function Used()
|
||||
|
||||
if script.Parent.Pulled.Value == false then
|
||||
script.Parent.Pulled.Value = true
|
||||
script.Parent.Leverage.Sound1:Play()
|
||||
local mod = lever
|
||||
local step = 1
|
||||
for i = 0, 8, step do
|
||||
rotateMod(mod, mod:GetModelCFrame(), CFrame.Angles(0, -0.2, 0))
|
||||
wait()
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
script.Parent.Pulled.Value = false
|
||||
script.Parent.Leverage.Sound2:Play()
|
||||
local mod = lever
|
||||
local step = 1
|
||||
for i = 0, 8, step do
|
||||
rotateMod(mod, mod:GetModelCFrame(), CFrame.Angles(0, 0.2, 0))
|
||||
wait()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
script.Parent.Use.MouseClick:connect(Used)
|
||||
|
||||
|
||||
script.Parent.Use.MouseClick:Connect(used)
|
||||
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"ignoreUnknownInstances": true
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
local dataLink = script["Data Link"].Value
|
||||
|
||||
local lights = {}
|
||||
for _, child in pairs(script.Parent:GetChildren()) do
|
||||
if child.Name == "Light" then
|
||||
table.insert(lights, child)
|
||||
end
|
||||
end
|
||||
|
||||
local connect = function(powered)
|
||||
if powered then
|
||||
for _, light in pairs(lights) do
|
||||
light.Material = Enum.Material.Neon
|
||||
end
|
||||
else
|
||||
for _, light in pairs(lights) do
|
||||
light.Material = Enum.Material.SmoothPlastic
|
||||
end
|
||||
end
|
||||
end
|
||||
dataLink.isTardisPowered.Changed:Connect(connect)
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"className": "Model",
|
||||
"ignoreUnknownInstances": true
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"className": "Model",
|
||||
"ignoreUnknownInstances": true
|
||||
"ignoreUnknownInstances": false
|
||||
}
|
@ -1,4 +1,3 @@
|
||||
local parts = {}
|
||||
local ammount = table.getn(script.Parent:GetDescendants())
|
||||
local serverReady = game.ReplicatedStorage.Events.ServerReady
|
||||
print(ammount)
|
||||
|
Loading…
x
Reference in New Issue
Block a user