Okay, what the hell I did miss?
I’m trying to get this switch handle working with tween but it won’t tween
Script
local SwitchHandle = script.Parent
local ClickDetector = SwitchHandle:WaitForChild("Block"):WaitForChild("ClickDetector")
local TweenService = game:GetService("TweenService")
local isPowerOn = SwitchHandle:WaitForChild("isPowerOn")
local Handle = SwitchHandle:WaitForChild("Handle")
local ToGo = SwitchHandle:WaitForChild("ToGo")
local A1 = ToGo:WaitForChild("A1")
local A2 = ToGo:WaitForChild("A2")
local function tweenHandle(bool : boolean)
if bool == true then
TweenService:Create(Handle.PrimaryPart, TweenInfo.new(1), {CFrame = A1.CFrame}):Play()
else
TweenService:Create(Handle.PrimaryPart, TweenInfo.new(1), {CFrame = A2.CFrame}):Play()
end
end
local function turnBlackWireBool(bool : boolean)
if bool == true then
for _, part in (SwitchHandle:WaitForChild("BlackWire"):GetChildren()) do
part.BrickColor = BrickColor.new("Storm blue")
end
else
for _, part in (SwitchHandle:WaitForChild("BlackWire"):GetChildren()) do
part.BrickColor = BrickColor.new("Black")
end
end
end
local function turnBoolPower(bool : boolean)
if bool == true then
tweenHandle(true)
turnBlackWireBool(true)
else
tweenHandle(false)
turnBlackWireBool(false)
end
end
turnBoolPower(isPowerOn.Value)
isPowerOn.Changed:Connect(function(value)
turnBoolPower(value)
end)
ClickDetector.MouseClick:Connect(function()
isPowerOn.Value = not isPowerOn.Value
end)
Video and Image: