View difference between Paste ID: ydyATzq4 and 4jEpF8Dr
SHOW: | | - or go back to the newest paste.
1
-- imagine naming a script mainAPI when its not even an api but actually using one
2
-- :thonk:
3
local RunService = game:GetService("RunService")
4
local contentBro = game:GetService("ContentProvider")
5
local player = game.Players.LocalPlayer
6
local mouse = player:GetMouse()
7
local inGame = false
8
local debounce = false
9
local ts = game:GetService("TweenService")
10
local dead = false
11
local objectDict = {
12
	[script.Parent.background.ThreeCactusSmall] = 0.45,
13
	[script.Parent.background.TwoCactus] = 0.45,
14
	[script.Parent.background.OneCactus] = 0.1
15
}
16
local objects = {}
17
for obj in pairs(objectDict) do
18
	table.insert(objects, obj)
19
end
20
contentBro:PreloadAsync(objects)
21
local dinosaur = script.Parent.background.dinosaur
22
local uis = game:GetService("UserInputService")
23
mouse.Icon = "rbxassetid://3313572053"
24
25
local objectTable = {}
26
------------------ ok now stuff that doesnt matter in the fucking slightest ------------------------
27
28
script.Parent.onlyinteractable.MouseEnter:Connect(function()
29
	mouse.Icon  = "rbxassetid://3313510115"
30
end)
31
script.Parent.onlyinteractable.MouseLeave:Connect(function()
32
	mouse.Icon = "rbxassetid://3313572053"
33
end)
34
local pls = {true}
35
uis.InputBegan:Connect(function(inp,gpe)
36
    if (inp.KeyCode == Enum.KeyCode.Space or inp.UserInputType == Enum.UserInputType.Touch) and not gpe and not inGame then
37
        inGame = true
38
		debounce = true
39
		dinosaur.Position = UDim2.new(0.001, 0, 0.55, 0)
40
		script.Parent.urdeadlol.Visible = false
41
		dinosaur.Image = "rbxassetid://3314227620"
42
		script.Parent.barrier1.Position = UDim2.new(0.689, 0, 0.542, 0)
43
		for i, obj in pairs(objectTable) do
44
			table.remove(objectTable, i)
45
			obj:Destroy()
46
		end
47
		script.Parent.background.score.Text = "00000"
48
		local function aa()
49
			script.Parent.badboy.Position = UDim2.new(0.667, 0, 0.542, 0)
50
			script.Parent.badboy:TweenPosition(script.Parent.badboy.Position - UDim2.new(0, script.Parent.badboy.AbsoluteSize.X, 0, 0), Enum.EasingDirection.Out,Enum.EasingStyle.Linear,3,false,aa)
51
		end
52
		aa()
53
		dinosaur:TweenPosition(UDim2.new(0.001, 0,0.1, 0),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,.3)
54
		wait(.31)
55
56
dinosaur:TweenPosition(UDim2.new(0.001, 0,0.55, 0),Enum.EasingDirection.In,Enum.EasingStyle.Quad,.2)
57
wait(.2)
58
script.Parent.barrier1:TweenPosition(UDim2.new(0.92, 0,0.542, 0),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,1)
59
wait(.5)
60
dinosaur:TweenPosition(UDim2.new(0.021, 0,0.55, 0),Enum.EasingDirection.Out,Enum.EasingStyle.Linear,.2)
61
62
debounce = false
63
spawn(function()
64
	while inGame and not dead do
65
		dinosaur.Image = "rbxassetid://3314873926"
66
    wait(.1)
67
if dead then break end
68
    dinosaur.Image = "rbxassetid://3314873718"
69
wait(.1)
70
		
71
	end
72
end)
73
74
spawn(function()
75
	while not dead do
76
		script.Parent.background.score.Text = string.format("%05.f", tonumber(script.Parent.background.score.Text) + 1)
77
		wait(0.1)
78
	end
79
end)
80
81
dead = false
82
local collidedWith
83
84
local hm = false
85
while not dead and pls[1] do
86
	local object
87
	local nani = math.random() -- nani?!
88
	--if  nani == 1 or nani == 2 and not dead then print("goofy goober")
89
	if not dead then print("goofy goober")
90
		--[[local original = script.Parent.background.TwoCactus
91
	object = original:Clone()
92
object.Position = original.Position
93
	object.Parent = script.Parent.Parent.background
94
	elseif nani == 2 then]]
95
		--local original = script.Parent.background.ThreeCactusSmall
96
		local s = 0
97
		local original
98
		for object, chance in pairs(objectDict) do
99
			if nani >= s and nani < s + chance then
100
				original = object
101
				break
102
			end
103
			s = s + chance
104
		end
105
		--object = script.Parent.background.ThreeCactusSmall:Clone()
106
		object = original:Clone()
107
		object.Position = original.Position
108
		object.Parent = script.Parent.background
109
		
110
		object:TweenPosition(UDim2.new(-0.2, 0,object.Position.Y.Scale,0),Enum.EasingDirection.In,Enum.EasingStyle.Linear,(object.Parent.AbsoluteSize.X * (0.2 + object.Position.X.Scale))/(script.Parent.badboy.AbsoluteSize.X/3), true)
111
		table.insert(objectTable, object)
112
	
113
	local collisionConnection
114
	collisionConnection = RunService.Heartbeat:Connect(function()
115
		if dinosaur.AbsolutePosition.X <= object.AbsolutePosition.X + object.AbsoluteSize.X and
116
		   dinosaur.AbsolutePosition.X + dinosaur.AbsoluteSize.X >= object.AbsolutePosition.X and
117
		   dinosaur.AbsolutePosition.Y <= object.AbsolutePosition.Y + object.AbsoluteSize.Y and
118
		   dinosaur.AbsolutePosition.Y + dinosaur.AbsoluteSize.Y >= object.AbsolutePosition.Y then
119
			collisionConnection:Disconnect()
120
			print("epic gamer collision")
121
			collidedWith = object
122
            for i, obj in pairs(objectTable) do
123
				if obj ~= collidedWith then
124
					table.remove(objectTable, i)
125
					obj:Destroy()
126
				end
127
			end
128
			object:TweenPosition(object.Position,Enum.EasingDirection.In,Enum.EasingStyle.Linear,2.5, true)
129
			dinosaur:TweenPosition(dinosaur.Position,Enum.EasingDirection.In,Enum.EasingStyle.Quad,.2,true)
130
			script.Parent.badboy:TweenPosition(script.Parent.badboy.Position,nil,nil,0,true)
131
			script.Parent.urdeadlol.Visible = true
132
			dinosaur.Image = "rbxassetid://3315457212"
133
            pls[1] = false
134
            pls[2] = true
135
			hm = true
136
			dead = true
137
			inGame = false
138
		end
139
	end)
140
	local sum = 0
141
	while sum <= 1.5 do
142
		if hm then
143
			hm = false
144
			for i, obj in pairs(objectTable) do
145
				if obj ~= collidedWith then
146
					table.remove(objectTable, i)
147
					obj:Destroy()
148
				end
149
			end
150
		end
151
		sum = sum + RunService.Heartbeat:Wait()
152
	end
153
	coroutine.resume(coroutine.create(function()
154
		wait((object.Parent.AbsoluteSize.X * (0.2 + object.Position.X.Scale))/(script.Parent.badboy.AbsoluteSize.X/3))
155
		if not dead then
156
			collisionConnection:Disconnect()
157
			object:Destroy()
158
		end
159
	end))
160
	end
161
end
162
table.remove(pls, 1)
163
164
    end
165
end)
166
167
local debounce2
168
uis.InputBegan:Connect(function(inp,gpe)
169
    if (inp.KeyCode == Enum.KeyCode.Space or inp.UserInputType == Enum.UserInputType.Touch) and not gpe and  inGame and not debounce2 and not dead then
170
        debounce2 = true
171
script.Parent.Parent.jump:Play()
172
		 dinosaur:TweenPosition(UDim2.new(dinosaur.Position.X.Scale, 0,0.1, 0),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,.3,true)
173
wait(.31)
174
if not dead then
175
dinosaur:TweenPosition(UDim2.new(dinosaur.Position.X.Scale, 0,0.55, 0),Enum.EasingDirection.In,Enum.EasingStyle.Quad,.2,true)
176
wait(.21)
177
end
178
debounce2 = false
179
180
    end
181
182
end)
183
--[[while true do
184
	wait()
185
	while inGame == true do
186
	wait()
187
	script.Parent.background:TweenPosition(UDim2.new(-1.234, 0,0.542, 0),Enum.EasingDirection.In,Enum.EasingStyle.Linear,3)
188
	wait(3)
189
	script.Parent.background.Position = UDim2.new(0.667, 0,0.542, 0)
190
	end
191
end
192
]]