Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- this script is one of the source code of a script in zq's sansbox. Please do not redistribute.
- This is a solo project I was working on and thought I could post this to the applications.
- - zqozr_II
- ]]
- local phases = {
- first = {
- start = 2; -- starts attacking after x seconds
- firstspeech = [[Your life.. may end up in a high place]];
- secondspeech = [[ ____]];
- thirdspeech = [[Show me your resolve.]];
- fourthspeech = [[This is just the beginning____ it might not look too good for you won't it now?.]];
- fifthspeech = [[I was sure I made that decently fast._ ]];
- };
- second = {
- firstspeech = [[I slacked around too much, it's time to end.. this ]];
- secondspeech = [[Do you feel your demise!?____]];
- thirdspeech = [[Could it get worse?]];
- fourthspeech = [[Struggling? I still have 200 moves left.]];
- fifthspeech = [[I haven't started combining my attacks yet.]];
- sixthspeech = [[Can you really survive this one?]];
- seventhspeech = [[That was alright. But my strongest attacks would be nothing compared to that.]]
- -- the next speeches will be manually inputed for now
- };
- third = {
- };
- fourth = {
- };
- fifth = {
- };
- }
- local maxhealth = 100
- local bosshealth = 100
- for _, v in pairs(script.Parent:GetChildren()) do
- if string.match(v.Name:lower(), 'template') then
- v.Visible = false
- end
- end
- local timestopped = false
- local tick = os.time
- local tweens = {}
- local realtweenservice = game:GetService('TweenService')
- local start = tick()
- local plr = game:GetService('Players').LocalPlayer
- local leaderstats = plr:WaitForChild('leaderstats')
- local deaths = leaderstats:WaitForChild('deaths')
- local rs = game:GetService('ReplicatedStorage')
- local collisionservice = require(rs:WaitForChild('GuiCollisionService'))
- local dragservice = require(rs:WaitForChild('DraggableObject'))
- local mouse = plr:GetMouse()
- local tweenservice = game:GetService('TweenService')
- local tweenservice = {}
- function tweenservice:Create(...) -- by simply tampering with tweenservice functions we can record them too
- local tween = realtweenservice:Create(...)
- local insert = {}
- insert.tween = tween
- insert.waspaused = false
- table.insert(tweens, insert)
- tween.Completed:Once(function() -- could this parameter be expensive?
- local find = table.find(tweens, insert)
- if find then
- table.remove(tweens, find)
- end
- end)
- return tween
- end
- local uis = game:GetService('UserInputService')
- local remote = rs:WaitForChild('all')
- local isStudio = game:GetService('RunService'):IsStudio()
- local background = script.Parent.Background
- local border = script.Parent.Border
- local cursor = script.Parent.cursor
- local bordervisual = script.Parent.BorderVisual
- local dialogue = script.Parent.Dialogue
- local phase = script.Parent.Phase
- local rswait = function(x: 'wait time')
- local z = tick()
- repeat game:GetService('RunService').RenderStepped:Wait() until tick()>=z+x
- end
- local group = collisionservice.createCollisionGroup()
- local godmode = false
- local ultrainstinct = false
- group:setZIndexHierarchy(true)
- group:addCollider(border, true)
- group:addCollider(cursor, true)
- uis.MouseIconEnabled = false
- local lastposition = nil
- local lastpositions = {}
- local v2 = Vector2.new
- local abs = math.abs
- local oldmouseaxis = v2(0, 0)
- local cursorcanmove = true
- local function randomletter(amount)
- local str = ''
- for i = 1, amount, 1 do
- str = str.. string.char(97+math.random(0,25))
- end
- return str
- end
- local function randomnumber(digits)
- local num = ''
- for i = 1, digits, 1 do
- num = num .. math.random(1, 10)
- end
- return num
- end
- local function writeText(text, charname)
- local basetext = charname or '???: ' -- if charname then charname else '???:'
- for i = 1, string.len(text), 1 do
- local letter = string.sub(text, i, i)
- if letter~='_' then
- basetext = basetext.. letter
- local soundclone = workspace:WaitForChild('sanstalk'):Clone()
- soundclone.Parent = workspace
- soundclone:Play()
- game:GetService('Debris'):AddItem(soundclone, 1.1)
- dialogue.Text = basetext
- end
- if letter == '.' or letter == '_' then
- for z = 1,15,1 do
- game:GetService('RunService').RenderStepped:Wait()
- end
- else
- game:GetService('RunService').RenderStepped:Wait()
- game:GetService('RunService').RenderStepped:Wait()
- game:GetService('RunService').RenderStepped:Wait()
- end
- end
- end
- local function simulatehit(position, targethit) -- check if the cursor will still collide in this position
- local viewport = workspace.CurrentCamera.ViewportSize
- local check = cursor:Clone()
- check.Name='CURSORCHECK'
- check.Transparency = 1
- check.Position = UDim2.new(position.X/viewport.X-(check.Size.X.Scale/2), 0, position.Y/viewport.Y+(check.Size.Y.Scale/2), 0)
- check.Parent = script.Parent
- local boolvalue = collisionservice.isColliding(check, targethit) or collisionservice.isInCore(targethit, check)
- check:Destroy()
- return boolvalue
- --[[
- local index = group:addCollider(check, true)
- local boolvalue = collisionservice.isc
- task.delay(0.1, function()
- group:removeCollider(index)
- check:Destroy()
- end)
- ]]
- end
- local function cursordistancefrommouse()
- local viewport = workspace.CurrentCamera.ViewportSize
- local vector2distance = v2(abs(cursor.Position.X.Scale-mouse.X/viewport.X), abs(cursor.Position.Y.Scale-mouse.Y/viewport.Y))
- return vector2distance, vector2distance.Magnitude
- end
- local function shakecursor(shakes)
- cursorcanmove = false
- local cursorposition = cursor.Position
- local oldcolor = cursor.BackgroundColor3
- cursor.BackgroundColor3 = Color3.fromRGB(138, 0, 10)
- for i = 1, shakes*2, 1 do
- local random = Random.new()
- cursor.Position = cursorposition + UDim2.new(random:NextNumber(-0.05, 0.05), 0, random:NextNumber(-0.065, 0.065), 0)
- if i%2 == 0 then -- even number
- cursor.Rotation = 10
- else -- odd number
- cursor.Rotation = -10
- end
- game:GetService('RunService').RenderStepped:Wait()
- end
- cursor.BackgroundColor3 = oldcolor
- cursor.Rotation = 0
- cursorcanmove = true
- end
- local rendersteppedconnect;rendersteppedconnect = game:GetService('RunService').RenderStepped:Connect(function()
- local viewport = workspace.CurrentCamera.ViewportSize
- local targetposition = UDim2.new(mouse.X/viewport.X-(cursor.Size.X.Scale/2), 0, mouse.Y/viewport.Y+(cursor.Size.Y.Scale/2), 0)
- if not lastposition then
- lastposition = targetposition
- oldmouseaxis = v2(mouse.X, mouse.Y)
- end
- local function borderadjust()
- -- repeat cursor.Position = cursor.Position - UDim2.new(0, 0, 0.01, 0) until cursor.Position.Y.Scale<=border.Position.Y.Scale-border.Size.Y.Scale/2
- if not simulatehit(Vector2.new(mouse.X, mouse.Y), border) then
- local vector2, distance = cursordistancefrommouse()
- --[[
- if targetposition.Y.Scale<=border.Position.Y.Scale+border.Size.Y.Scale/2 then
- cursor.Position = lastposition
- return
- else
- cursor.Position = targetposition
- warn('free')
- end
- ]]
- cursor.Position = targetposition
- else
- cursor.Position = UDim2.new(targetposition.X.Scale, 0, bordervisual.Position.Y.Scale+bordervisual.Size.Y.Scale/1.05, 0)
- return true
- end
- end
- if godmode == false then
- for i, v in pairs(script.Parent:GetChildren()) do
- if v.Name == 'dangerframe' then
- if collisionservice.isColliding(cursor, v) then
- if ultrainstinct == true then
- local random = math.random(1,3) -- left, right and back
- if random == 1 then
- cursor.Position = v.Position + UDim2.new(v.Size.X.Scale, 0, 0, 0)
- elseif random == 2 then
- cursor.Position = v.Position + UDim2.new(-v.Size.X.Scale, 0, 0, 0)
- else
- cursor.Position = v.Position + UDim2.new(0, 0, v.Size.Y.Scale, 0)
- -- cursor.Position = lastpositions[1]
- end
- return
- else
- game:GetService('StarterGui'):SetCore('SendNotification', {
- Title = ':(';
- Text = "You died. Automatically respawned";
- })
- rendersteppedconnect:Disconnect()
- remote:FireServer('dead')
- _G.restart()
- return
- end
- end
- end
- end
- end
- if collisionservice.isColliding(cursor, border) or collisionservice.isInCore(border, cursor) then
- local a = borderadjust()
- if a then return end
- else
- if cursorcanmove == true then
- local a = borderadjust()
- if a then return end
- if not collisionservice.isInCore(border, cursor) then
- cursor.Position = targetposition
- end
- end
- end
- lastposition = targetposition
- oldmouseaxis = v2(mouse.X, mouse.Y)
- table.insert(lastpositions, lastposition)
- if #lastpositions>9 then
- table.remove(lastpositions, 1)
- end
- end)
- local function createdangerblock(debristime)
- local dangerframe = script.Parent.dangerframeblocktemplate:Clone()
- dangerframe.Parent = script.Parent
- dangerframe.Position = UDim2.new(2,0,2,0)
- dangerframe.Visible = true
- dangerframe.Name = 'dangerframe'
- game:GetService('Debris'):AddItem(dangerframe, debristime)
- return dangerframe
- end
- local function dealdamage(damage)
- bosshealth-=damage
- tweenservice:Create(bordervisual.Fill, TweenInfo.new(0.3, Enum.EasingStyle.Linear), {
- Size = UDim2.new(bosshealth/maxhealth, 0, 1, 0)
- }):Play()
- end
- local function tallLeftpillar(settingsarray)
- local offset = -0.2 -- -0.2 is leftside of the screen, 1.1 is righjtside
- local endingpoint = 1.1
- local random = Random.new()
- local highpillar = createdangerblock(6)
- local lowpillar = createdangerblock(6)
- local hole = random:NextNumber(0.12+border.Size.Y.Scale, 0.9)
- local gap = random:NextNumber(0.2, 0.3)
- local speed = 1.8
- if settingsarray then
- speed = settingsarray.speed or speed
- gap = settingsarray.gap or gap
- hole = settingsarray.hole or hole
- end
- highpillar.Size = UDim2.new(0.07, 0, 1, 0)
- lowpillar.Size = UDim2.new(0.07, 0, 1, 0)
- highpillar.Position = UDim2.new(offset, 0, hole - (highpillar.Size.Y.Scale+gap/2), 0)
- lowpillar.Position = UDim2.new(offset, 0, highpillar.Position.Y.Scale + (lowpillar.Size.Y.Scale+gap/2), 0)
- tweenservice:Create(highpillar, TweenInfo.new(2, Enum.EasingStyle.Linear), {
- Position = UDim2.new(endingpoint, 0, highpillar.Position.Y.Scale, 0)
- }):Play()
- local a = tweenservice:Create(lowpillar, TweenInfo.new(2, Enum.EasingStyle.Linear), {
- Position = UDim2.new(endingpoint, 0, lowpillar.Position.Y.Scale, 0)
- })
- a:Play()
- end
- local function tallRightpillar(settingsarray)
- local offset = 1.1 -- -0.2 is leftside of the screen, 1.1 is righjtside
- local endingpoint = -0.2
- local random = Random.new()
- local highpillar = createdangerblock(6)
- local lowpillar = createdangerblock(6)
- local hole = random:NextNumber(0.12+border.Size.Y.Scale, 0.9)
- local gap = random:NextNumber(0.2, 0.3)
- local speed = 1.8
- if settingsarray then
- speed = settingsarray.speed or speed
- gap = settingsarray.gap or gap
- hole = settingsarray.hole or hole
- end
- highpillar.Size = UDim2.new(0.07, 0, 1, 0)
- lowpillar.Size = UDim2.new(0.07, 0, 1, 0)
- highpillar.Position = UDim2.new(offset, 0, hole - (highpillar.Size.Y.Scale+gap/2), 0)
- lowpillar.Position = UDim2.new(offset, 0, highpillar.Position.Y.Scale + (lowpillar.Size.Y.Scale+gap/2), 0)
- tweenservice:Create(highpillar, TweenInfo.new(2, Enum.EasingStyle.Linear), {
- Position = UDim2.new(endingpoint, 0, highpillar.Position.Y.Scale, 0)
- }):Play()
- local a = tweenservice:Create(lowpillar, TweenInfo.new(2, Enum.EasingStyle.Linear), {
- Position = UDim2.new(endingpoint, 0, lowpillar.Position.Y.Scale, 0)
- })
- a:Play()
- end
- local function tallCeilingpillar(settingsarray)
- local random = Random.new()
- local leftpillar = createdangerblock(6)
- local rightpillar = createdangerblock(6)
- local hole = random:NextNumber(0.1, 0.9)
- local gap = random:NextNumber(0.18, 0.25)
- local speed = 1.8
- if settingsarray then
- speed = settingsarray.speed or speed
- gap = settingsarray.gap or gap
- hole = settingsarray.hole or hole
- end
- leftpillar.Size = UDim2.new(1, 0, 0.1, 0)
- rightpillar.Size = UDim2.new(1, 0, 0.1, 0)
- leftpillar.Position = UDim2.new(hole - (leftpillar.Size.X.Scale + gap/2), 0, -1.1, 0)
- rightpillar.Position = UDim2.new(leftpillar.Position.X.Scale + (rightpillar.Size.X.Scale+gap/2), 0, -1.1, 0)
- tweenservice:Create(leftpillar, TweenInfo.new(speed, Enum.EasingStyle.Linear), {
- Position = UDim2.new(leftpillar.Position.X.Scale, 0, 1.1, 0)
- }):Play()
- local a = tweenservice:Create(rightpillar, TweenInfo.new(speed, Enum.EasingStyle.Linear), {
- Position = UDim2.new(rightpillar.Position.X.Scale, 0, 1.1, 0)
- })
- a:Play()
- end
- local defaultcolor = cursor.ImageColor3
- local timestopcon = nil
- uis.InputBegan:Connect(function(inp, gps)
- if gps then return end
- if plr.UserId == game.CreatorId or isStudio then
- if inp.KeyCode == Enum.KeyCode.C then
- godmode = not godmode
- if godmode == true then
- cursor.ImageColor3 = Color3.fromRGB(117, 255, 30)
- else
- cursor.ImageColor3 = defaultcolor
- end
- elseif inp.KeyCode == Enum.KeyCode.V then
- ultrainstinct = not ultrainstinct
- elseif inp.KeyCode == Enum.KeyCode.B then
- timestopped = not timestopped
- if timestopped == true then
- timestopcon = game:GetService('RunService').Heartbeat:Connect(function()
- for i, v in pairs(tweens) do
- if v.waspaused == false then
- v.waspaused = true
- v.tween:Pause()
- end
- end
- end)
- else
- if timestopcon then
- timestopcon:Disconnect()
- for i, v in pairs(tweens) do
- if v.waspaused==true then
- v.waspaused = false
- v.tween:Play()
- end
- end
- end
- end
- end
- end
- end)
- task.spawn(function()
- repeat game:GetService('RunService').RenderStepped:Wait() until (tick()-_G.z)>=phases.first.start
- --
- local firstphase = tick()
- warn('first phase')
- local zds = math.random(1,2)
- if zds == 1 then
- for i = 0.3, 0.5, 0.1 do
- tallCeilingpillar({
- gap = 0.5;
- hole = i;
- speed = 1;
- })
- task.wait(0.08)
- end
- for i = 0.5, 0.3, -0.1 do
- tallCeilingpillar({
- gap = 0.5;
- hole = i;
- speed = 1;
- })
- task.wait(0.08)
- end
- else
- for i = 0.5, 0.3, -0.1 do
- tallCeilingpillar({
- gap = 0.5;
- hole = i;
- speed = 1;
- })
- task.wait(0.08)
- end
- for i = 0.3, 0.5, 0.1 do
- tallCeilingpillar({
- gap = 0.5;
- hole = i;
- speed = 1;
- })
- task.wait(0.08)
- end
- end
- writeText(phases.first.firstspeech)
- task.wait(0.5)
- writeText(phases.first.thirdspeech)
- for i = 1, 8, 1 do
- local random = Random.new()
- local dangerblock = createdangerblock(3)
- dangerblock.Position = UDim2.new(random:NextNumber(0, 0.97),0,1.1, 0)
- dangerblock.Size = dangerblock.Size + UDim2.new(0, 0, random:NextNumber(0.01, 0.2), 0)
- tweenservice:Create(dangerblock, TweenInfo.new(random:NextNumber(0.9, 1.5), Enum.EasingStyle.Linear), {
- Position = UDim2.new(dangerblock.Position.X.Scale, 0, -0.2 - dangerblock.Size.Y.Scale, 0)
- }):Play()
- game:GetService('RunService').RenderStepped:Wait()
- end
- task.wait(1.2)
- for i = 1, 10, 1 do
- local random = Random.new()
- local dangerblock = createdangerblock(3)
- dangerblock.Position = UDim2.new(random:NextNumber(0, 0.97),0,1.1, 0)
- dangerblock.Size = dangerblock.Size + UDim2.new(0, 0, random:NextNumber(0.01, 0.2), 0)
- tweenservice:Create(dangerblock, TweenInfo.new(random:NextNumber(0.9, 1.35), Enum.EasingStyle.Linear), {
- Position = UDim2.new(dangerblock.Position.X.Scale, 0, -0.05 - dangerblock.Size.Y.Scale, 0)
- }):Play()
- game:GetService('RunService').RenderStepped:Wait()
- end
- task.wait(1.2)
- for i = 1, 10, 1 do
- local random = Random.new()
- local dangerblock = createdangerblock(3)
- dangerblock.Position = UDim2.new(random:NextNumber(0, 0.97),0,1.1, 0)
- dangerblock.Size = dangerblock.Size + UDim2.new(0, 0, random:NextNumber(0.01, 0.2), 0)
- tweenservice:Create(dangerblock, TweenInfo.new(random:NextNumber(0.9, 1), Enum.EasingStyle.Linear), {
- Position = UDim2.new(dangerblock.Position.X.Scale, 0, -0.05 - dangerblock.Size.Y.Scale, 0)
- }):Play()
- task.wait(0.1)
- end
- task.wait(1.5)
- writeText(phases.first.fourthspeech)
- for i = 1, 12, 1 do
- local random = Random.new()
- local dangerblock = createdangerblock(3)
- dangerblock.Position = UDim2.new(random:NextNumber(0, 0.97),0, -0.2, 0)
- dangerblock.Size = dangerblock.Size + UDim2.new(0, 0, random:NextNumber(0.01, 0.2), 0)
- tweenservice:Create(dangerblock, TweenInfo.new(random:NextNumber(0.6, 1.1), Enum.EasingStyle.Linear), {
- Position = UDim2.new(dangerblock.Position.X.Scale, 0, 1.1, 0)
- }):Play()
- game:GetService('RunService').RenderStepped:Wait()
- end
- task.wait(1.7)
- writeText(phases.first.fifthspeech)
- for i = 1, 60, 1 do
- game:GetService('RunService').RenderStepped:Wait()
- task.spawn(function()
- phase.Text = 'Phase: '.. randomnumber(2)
- writeText(randomletter(4), randomletter(3).. ': ')
- end)
- end
- dealdamage(3)
- dialogue.TextColor3 = Color3.fromRGB(239, 182, 19)
- dialogue.TextStrokeTransparency = 1
- writeText(phases.second.firstspeech)
- phase.Text = 'Phase: 2'
- phase.TextColor3 = Color3.fromRGB(239, 182, 19)
- task.wait(0.5)
- dialogue.TextColor3 = Color3.fromRGB(232, 56, 22)
- phase.TextColor3 = Color3.fromRGB(232, 56, 22)
- dialogue.Font = Enum.Font.Creepster
- task.spawn(function()
- shakecursor(50)
- end)
- writeText(phases.second.secondspeech)
- task.wait(2)
- writeText(phases.second.thirdspeech)
- for i = 1, 30, 1 do
- local random = Random.new()
- local dangerblock = createdangerblock(4)
- dangerblock.Position = UDim2.new(cursor.Position.X,0, -0.2, 0)
- tweenservice:Create(dangerblock, TweenInfo.new(random:NextNumber(0.8, 1.2), Enum.EasingStyle.Linear), {
- Position = UDim2.new(dangerblock.Position.X.Scale, 0, 1.1, 0)
- }):Play()
- task.wait(0.1)
- end
- --
- task.wait(0.3)
- for i = 1, 15, 1 do
- local random = Random.new()
- local dangerblock = createdangerblock(3)
- local number = if math.random(1,2)==1 then -1 else 1
- dangerblock.Position = UDim2.new(number,0, cursor.Position.Y.Scale,0)
- tweenservice:Create(dangerblock, TweenInfo.new(random:NextNumber(0.9,1.1), Enum.EasingStyle.Linear), {
- Position = UDim2.new(if number==1 then -1 else 1, 0, dangerblock.Position.Y.Scale, 0)
- }):Play()
- task.wait(0.1)
- end
- task.wait(0.6)
- -- create a pillar with a hole in the middle --
- writeText(phases.second.fourthspeech)
- for i = 1, 10, 1 do
- tallCeilingpillar()
- task.wait(1.1)
- end
- task.wait(0.5)
- for i = 1, 10, 1 do
- tallLeftpillar()
- task.wait(0.8)
- end
- for i = 1, 10, 1 do
- tallRightpillar()
- task.wait(0.8)
- end
- --
- writeText(phases.second.fifthspeech)
- task.spawn(function()
- tallCeilingpillar({
- gap = 0.35;
- hole = 0.8;
- })
- task.wait(1)
- tallLeftpillar()
- task.wait(1.3)
- tallCeilingpillar({
- gap = 0.35;
- hole = 0.2;
- })
- tallRightpillar()
- task.wait(1.5)
- for i = 1, 3, 1 do
- tallCeilingpillar({
- speed = 1.05; -- top pillar is x times faster
- hole = 0.5;
- gap = 0.4;
- })
- task.wait(1.5)
- tallLeftpillar()
- task.wait(0.9)
- tallRightpillar()
- task.wait(1.5)
- end
- --
- writeText(phases.second.sixthspeech)
- for i = 0.3, 1, 0.1 do
- tallRightpillar({
- gap = 0.6;
- hole = i;
- })
- task.wait(0.1)
- end
- for i = 1, 0.3, -0.1 do
- tallRightpillar({
- gap = 0.6;
- hole = i;
- })
- task.wait(0.1)
- end
- for i = 0.3, 1, 0.1 do
- tallRightpillar({
- gap = 0.6;
- hole = i;
- })
- task.wait(0.1)
- end
- writeText(phases.second.seventhspeech)
- local bigblock = createdangerblock(8)
- bigblock.Size = UDim2.new(0.3, 0, 1.1, 0)
- bigblock.Position = UDim2.new(1 + bigblock.Size.X.Scale, 0, 0, 0)
- local bigblocktween = tweenservice:Create(bigblock, TweenInfo.new(1, Enum.EasingStyle.Linear), {
- Position = UDim2.new(0.1, 0, 0, 0)
- })
- bigblocktween:Play()
- bigblocktween.Completed:Wait()
- task.wait(1)
- bigblocktween = tweenservice:Create(bigblock, TweenInfo.new(2, Enum.EasingStyle.Linear), {
- Position = UDim2.new(1+bigblock.Size.X.Scale, 0, 0, 0)
- })
- bigblocktween:Play()
- bigblocktween.Completed:Wait()
- if deaths.Value>=75 then
- writeText(`With {deaths.Value} deaths I guess its reasonable you got pass phase 2__ `)
- else
- writeText('Seriously? Are you human? ')
- end
- end)
- --[[
- repeat game:GetService('RunService').RenderStepped:Wait()
- -- perform actions
- until (tick()-firstphase)>=phases.first.duration
- ]]
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement