Hi everyon!, do you have any idea how to incorperate the SetPrimaryPartCFrame
into this script? I was previously using for just a union, but now I have multiple parts inside a model I need to move. Any help is appreciated.
local door1 = script.Parent.Parent:FindFirstChild("Door1")
local TweenService = game:GetService("TweenService")
local tweeninfo = TweenInfo.new(
3,
Enum.EasingStyle.Quart,
Enum.EasingDirection.Out,
0,
false,
0
)
local ClosedPos1 = door1
local OpenPos1 = {CFrame = ClosedPos1 * CFrame.new(0,0,4)}
local ClosePos1 = {CFrame = OpenPos1.CFrame * CFrame.new(0,0,-4)}
local OpenPos2 = {CFrame = ClosedPos1 * CFrame.new(0,0,-4)}
local ClosePos2 = {CFrame = OpenPos1.CFrame * CFrame.new(0,0,4)}
local Open1 = TweenService:Create(door1, tweeninfo, OpenPos1)
local Close1 = TweenService:Create(door1, tweeninfo, ClosePos1)
local Open2 = TweenService:Create(door1, tweeninfo, OpenPos2)
local Close2 = TweenService:Create(door1, tweeninfo, ClosePos2)
local toggle = false
local sound = script.Parent.Parent.Sound
local open = script.Parent.Parent.AirReleas
local shut = script.Parent.Parent.AirReleas
script.Parent.ClickDetector.MouseClick:Connect(function()
if toggle == false then
open:Play()
toggle = true
Open1:Play()
elseif toggle == true then
toggle = false
sound:Play()
sound.Ended:Wait()
Close1:Play()
wait(0.2)
shut:Play()
end
end)