Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local TweenService = game:GetService("TweenService")
- local Players = game.Players
- camera = workspace.CurrentCamera
- camera.CameraType = Enum.CameraType.Scriptable
- local index = 0
- local height = 0.5
- local previousPart = Instance.new("Part")
- previousPart.Size = Vector3.new(10, 1, 8)
- previousPart.Material = Enum.Material.SmoothPlastic
- previousPart.Parent = workspace
- camera.CFrame = CFrame.lookAt(Vector3.new(1, 15, 6), previousPart.Position)
- local cameraCf = camera.CFrame
- wait(2)
- while true do
- height += 1
- index += 1
- local part = Instance.new("Part")
- part.Anchored = true
- part.Material = Enum.Material.SmoothPlastic
- part.Size = previousPart.Size
- part.CFrame = previousPart.CFrame + Vector3.new(index % 2 == 0 and 8 or -8, 5.5, 0)
- part.Parent = workspace
- cameraCf += Vector3.new(0, 1, 0)
- TweenService:Create(camera, TweenInfo.new(0.8), {
- CFrame = cameraCf
- }):Play()
- local tweenInfo = TweenInfo.new(3, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, -1, true)
- local tween = TweenService:Create(part, tweenInfo, {
- CFrame = previousPart.CFrame + Vector3.new(index % 2 == 0 and -8 or 8, 5.5, 0)
- })
- tween:Play()
- Players.LocalPlayer:GetMouse().Button1Up:Wait()
- tween:Cancel()
- local shrinkBy = math.abs(previousPart.Position.X - part.Position.X)
- if shrinkBy > part.Size.X then
- print("Final score:", index)
- part.Anchored = false
- part.CanCollide = false
- break
- end
- tween = TweenService:Create(part, TweenInfo.new(0.4, Enum.EasingStyle.Quad), {
- Position = Vector3.new(part.Position.X, height, part.Position.Z)
- })
- tween:Play()
- tween.Completed:Wait()
- -- Some visual effects, cutting off a piece of the block and letting it fall
- local slice = Instance.new("Part")
- slice.CanCollide = false -- Let it fall through the floor into oblivion
- slice.Material = Enum.Material.SmoothPlastic
- slice.Size = Vector3.new(shrinkBy, 1, 8)
- part.Size = Vector3.new(part.Size.X - shrinkBy, 1, 8)
- if part.Position.X < previousPart.Position.X then
- part.CFrame += Vector3.new(shrinkBy / 2, 0, 0)
- slice.CFrame = part.CFrame - Vector3.new(part.Size.X/2, 0, 0) - Vector3.new(shrinkBy/2, 0, 0)
- else
- part.CFrame -= Vector3.new(shrinkBy / 2, 0, 0)
- slice.CFrame = part.CFrame + Vector3.new(part.Size.X/2, 0, 0) + Vector3.new(shrinkBy/2, 0, 0)
- end
- slice.Parent = workspace
- previousPart = part
- print(index)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement