script 1:
this one works great
local tweenservice = game.TweenService
local right = game.Workspace.carshopdoors.carshoprightdoor
local left = game.Workspace.carshopdoors.carshopleftdoor
local tweenstyle = TweenInfo.new(
1,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0,
false,
0
)
local leftdoorclose = {
CFrame = left.CFrame --just remember starting position.
}
local rightdoorclose = {
CFrame = right.CFrame
}
local leftdooropen = {
CFrame = (left.CFrame + Vector3.new(2.556,0,-5.254)) * CFrame.Angles(0,math.rad(90),0)
-- it is beter to use relative values, so you can make easy copies if you need to
}
local rightdooropen = {
CFrame = (right.CFrame + Vector3.new(5.579,0,2.521)) * CFrame.Angles(0,math.rad(-90),0)
}
local leftclose = tweenservice:Create(left,tweenstyle,leftdoorclose)
local rightclose = tweenservice:Create(right,tweenstyle,rightdoorclose)
local leftopen = tweenservice:Create(left,tweenstyle,leftdooropen)
local rightopen = tweenservice:Create(right,tweenstyle,rightdooropen)
local active = true
script.Parent.Touched:Connect(function(hit)
if active then
active = false
print("working out")
leftopen:Play()
rightopen:Play()
game.Workspace.carshopopenin.inside.Disabled = true
wait(2)
leftclose:Play()
rightclose:Play()
game.Workspace.carshopopenin.inside.Disabled = false
active = true
end
end)
script 2:
this one breaks no matter what i do, trying to reverse the first script aka make the doors go the other way
local tweenservice = game.TweenService
local right = game.Workspace.carshopdoors.carshoprightdoor
local left = game.Workspace.carshopdoors.carshopleftdoor
local tweenstyle = TweenInfo.new(
1,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0,
false,
0
)
local leftdoorclose = {
CFrame = left.CFrame --just remember starting position.
}
local rightdoorclose = {
CFrame = right.CFrame
}
local leftdooropen = {
CFrame = (left.CFrame + Vector3.new(-2.556,0,5.254)) * CFrame.Angles(0,math.rad(-90),0)
-- it is beter to use relative values, so you can make easy copies if you need to
}
local rightdooropen = {
CFrame = (right.CFrame + Vector3.new(-5.579,0,-2.521)) * CFrame.Angles(0,math.rad(90),0)
}
local leftclose = tweenservice:Create(left,tweenstyle,leftdoorclose)
local rightclose = tweenservice:Create(right,tweenstyle,rightdoorclose)
local leftopen = tweenservice:Create(left,tweenstyle,leftdooropen)
local rightopen = tweenservice:Create(right,tweenstyle,rightdooropen)
local active = true
script.Parent.Touched:Connect(function(hit)
if active then
active = false
print("working out")
leftopen:Play()
rightopen:Play()
--game.Workspace.carshopopenin.inside.Disabled = true
wait(2)
leftclose:Play()
rightclose:Play()
--game.Workspace.carshopopenin.inside.Disabled = false
active = true
end
end)
quick video of how it looks like https://imgur.com/a/9MeYajD

2 comments
Always nice to solve ye own problem :)
ye feels real good :)