Объект слишком сильно опускается
Немного программирую в Roblox Studio на языке Lua, и столкнулся с проблемой. У меня есть 2 скрипта: 1 скрипт поднимает объект на 1000 единиц по координате Y вверх. А второй должен его возвращать, т.е. отнимать от позиции объекта (1000 по Y) ещё 1000, и должно получиться так, что объект вернулся в первоначальную позицию. 1-ый скрипт, который поднимает, работает стабильно. А который опускает - нет. Когда объект опускается, он уходит под пол и его координаты по Y -975. Помогите пожалуйста найти в чём ошибка! Вот 2 скрипта
1-ый скрипт:
local TweenService = game:GetService("TweenService")
local object = workspace.Entry
local FL = object.jaderni_uskorL.Cylinder
local FR = object.jaderni_uskorR.Cylinder
local ZL = object.jaderni_uskorZL.Cylinder
local ZR = object.jaderni_uskorZR.Cylinder
local WallB = object.Union
local WallL = object.WallL
local WallR = object.WallR
local Krysh = object.Krysh
local Floor = object.Floor
local Chair = object.PlasticChair.Seat
local Chair1 = object.PlasticChair1.Seat
local ChairL = object.PlasticChair
local ChairR = object.PlasticChair1
local endOffset = Vector3.new(0, 1000, 0)
local tweenInfo = TweenInfo.new(
12,
Enum.EasingStyle.Quad,
Enum.EasingDirection.Out,
0,
false,
0
)
local tweenPosition = TweenService:Create(object, tweenInfo, {Position = object.Position + endOffset})
local FRTweenPosition = TweenService:Create(FR, tweenInfo, {Position = FR.Position + endOffset})
local FLTweenPosition = TweenService:Create(FL, tweenInfo, {Position = FL.Position + endOffset})
local ZRTweenPosition = TweenService:Create(ZR, tweenInfo, {Position = ZR.Position + endOffset})
local ZLTweenPosition = TweenService:Create(ZL, tweenInfo, {Position = ZL.Position + endOffset})
local WallLTweenPosition = TweenService:Create(WallL, tweenInfo, {Position = WallL.Position + endOffset})
local WallRTweenPosition = TweenService:Create(WallR, tweenInfo, {Position = WallR.Position + endOffset})
local FloorTweenPosition = TweenService:Create(Floor, tweenInfo, {Position = Floor.Position + endOffset})
local KryshTweenPosition = TweenService:Create(Krysh, tweenInfo, {Position = Krysh.Position + endOffset})
local WallBTweenPosition = TweenService:Create(WallB, tweenInfo, {Position = WallB.Position + endOffset})
local ChairTweenPosition = TweenService:Create(Chair, tweenInfo, {Position = Chair.Position + endOffset})
local Chair1TweenPosition = TweenService:Create(Chair1, tweenInfo, {Position = Chair1.Position + endOffset})
local Chair2TweenPosition = TweenService:Create(ChairL, tweenInfo, {Position = ChairL.Position + endOffset})
local Chair3TweenPosition = TweenService:Create(ChairR, tweenInfo, {Position = ChairR.Position + endOffset})
script.Parent.Triggered:Connect(function()
script.Parent:Destroy()
object.Attachment.ProximityPrompt:Destroy()
tweenPosition:Play()
FRTweenPosition:Play()
ZRTweenPosition:Play()
FLTweenPosition:Play()
ZLTweenPosition:Play()
ChairTweenPosition:Play()
Chair1TweenPosition:Play()
Chair2TweenPosition:Play()
Chair3TweenPosition:Play()
WallBTweenPosition:Play()
WallRTweenPosition:Play()
WallLTweenPosition:Play()
FloorTweenPosition:Play()
KryshTweenPosition:Play()
end)
2-ой скрипт:
local TweenService = game:GetService("TweenService")
local object = workspace.Entry
local FL = object.jaderni_uskorL.Cylinder
local FR = object.jaderni_uskorR.Cylinder
local ZL = object.jaderni_uskorZL.Cylinder
local ZR = object.jaderni_uskorZR.Cylinder
local WallB = object.Union
local WallL = object.WallL
local WallR = object.WallR
local Krysh = object.Krysh
local Floor = object.Floor
local Chair = object.PlasticChair.Seat
local Chair1 = object.PlasticChair1.Seat
local ChairL = object.PlasticChair
local ChairR = object.PlasticChair1
local endOffset = Vector3.new(0, -1000, 0)
local tweenInfo = TweenInfo.new(
12,
Enum.EasingStyle.Quad,
Enum.EasingDirection.Out,
0,
false,
0
)
local tweenPosition = TweenService:Create(object, tweenInfo, {Position = object.Position + endOffset})
local FRTweenPosition = TweenService:Create(FR, tweenInfo, {Position = FR.Position + endOffset})
local FLTweenPosition = TweenService:Create(FL, tweenInfo, {Position = FL.Position + endOffset})
local ZRTweenPosition = TweenService:Create(ZR, tweenInfo, {Position = ZR.Position + endOffset})
local ZLTweenPosition = TweenService:Create(ZL, tweenInfo, {Position = ZL.Position + endOffset})
local WallLTweenPosition = TweenService:Create(WallL, tweenInfo, {Position = WallL.Position + endOffset})
local WallRTweenPosition = TweenService:Create(WallR, tweenInfo, {Position = WallR.Position + endOffset})
local FloorTweenPosition = TweenService:Create(Floor, tweenInfo, {Position = Floor.Position + endOffset})
local KryshTweenPosition = TweenService:Create(Krysh, tweenInfo, {Position = Krysh.Position + endOffset})
local WallBTweenPosition = TweenService:Create(WallB, tweenInfo, {Position = WallB.Position + endOffset})
local ChairTweenPosition = TweenService:Create(Chair, tweenInfo, {Position = Chair.Position + endOffset})
local Chair1TweenPosition = TweenService:Create(Chair1, tweenInfo, {Position = Chair1.Position + endOffset})
local Chair2TweenPosition = TweenService:Create(ChairL, tweenInfo, {Position = ChairL.Position + endOffset})
local Chair3TweenPosition = TweenService:Create(ChairR, tweenInfo, {Position = ChairR.Position + endOffset})
script.Parent.Triggered:Connect(function()
script.Parent:Destroy()
tweenPosition:Play()
FRTweenPosition:Play()
ZRTweenPosition:Play()
FLTweenPosition:Play()
ZLTweenPosition:Play()
ChairTweenPosition:Play()
Chair1TweenPosition:Play()
Chair2TweenPosition:Play()
Chair3TweenPosition:Play()
WallBTweenPosition:Play()
WallRTweenPosition:Play()
WallLTweenPosition:Play()
FloorTweenPosition:Play()
KryshTweenPosition:Play()
end)