Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local TweenService = game:GetService("TweenService")
- local part = script.Parent.Parent
- local startCoordinates = part.Position
- local newPosition = Vector3.new(-14.178, 5.154, -7.71)
- local isOpen = false
- local tweenInfo = TweenInfo.new(
- 1.5,
- Enum.EasingStyle.Linear,
- Enum.EasingDirection.Out,
- 0,
- false,
- 0
- )
- script.Parent.Triggered:Connect(function()
- local tween
- if isOpen == true then
- local properties = {
- ["Position"] = startCoordinates
- }
- tween = TweenService:Create(part,tweenInfo, properties)
- else
- local properties = {
- ["Position"] = newPosition
- }
- tween = TweenService:Create(part,tweenInfo, properties)
- end
- tween:Play()
- tween.Completed:Connect(function()
- isOpen = not isOpen
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement