Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local TweenService = game:GetService("TweenService")
- local door = script.Parent.Parent.Door
- local doorButton = script.Parent
- local clickDetector = script.Parent.ClickDetector
- local doorClosed = true
- local doorClosedPosition = door.Position
- local doorClosedSize = door.Size
- clickDetector.MouseClick:Connect(function()
- local doorTweenInfo = TweenInfo.new(2)
- local endPosition = {}
- if doorClosed == true then
- endPosition.Position = Vector3.new(door.Position.X, door.Position.Y + door.Size.Y/2, door.Position.Z)
- endPosition.Size = Vector3.new(door.Size.X, 0, door.Size.Z)
- doorButton.BrickColor = BrickColor.new("Really red")
- doorClosed = false
- else
- endPosition.Position = doorClosedPosition
- endPosition.Size = doorClosedSize
- doorButton.BrickColor = BrickColor.new("Lime green")
- doorClosed = true
- end
- local tween = TweenService:Create(door, doorTweenInfo, endPosition)
- tween:Play()
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement