SHOW:
|
|
- or go back to the newest paste.
1 | --https://github.com/Mokiros/roblox-FE-compatibility | |
2 | - | by ages_dreamcast around 2017-ish |
2 | + | if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end |
3 | - | put in startergui as a localscript |
3 | + | local Player,Mouse,mouse,UserInputService,ContextActionService = owner |
4 | - | press Q to fire |
4 | + | local RealPlayer = Player |
5 | - | ]]-- |
5 | + | do print("FE Compatibility code by Mokiros")local a=RealPlayer;script.Parent=a.Character;local b=Instance.new("RemoteEvent")b.Name="UserInput_Event"local function c()local d={_fakeEvent=true,Functions={},Connect=function(self,e)table.insert(self.Functions,e)end}d.connect=d.Connect;return d end;local f={Target=nil,Hit=CFrame.new(),KeyUp=c(),KeyDown=c(),Button1Up=c(),Button1Down=c(),Button2Up=c(),Button2Down=c()}local g={InputBegan=c(),InputEnded=c()}local CAS={Actions={},BindAction=function(self,h,i,j,...)CAS.Actions[h]=i and{Name=h,Function=i,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function k(self,l,...)local d=f[l]if d and d._fakeEvent then for m,e in pairs(d.Functions)do e(...)end end end;f.TrigEvent=k;g.TrigEvent=k;b.OnServerEvent:Connect(function(n,o)if n~=a then return end;f.Target=o.Target;f.Hit=o.Hit;if not o.isMouse then local p=o.UserInputState==Enum.UserInputState.Begin;if o.UserInputType==Enum.UserInputType.MouseButton1 then return f:TrigEvent(p and"Button1Down"or"Button1Up")end;if o.UserInputType==Enum.UserInputType.MouseButton2 then return f:TrigEvent(p and"Button2Down"or"Button2Up")end;for m,d in pairs(CAS.Actions)do for m,q in pairs(d.Keys)do if q==o.KeyCode then d.Function(d.Name,o.UserInputState,o)end end end;f:TrigEvent(p and"KeyDown"or"KeyUp",o.KeyCode.Name:lower())g:TrigEvent(p and"InputBegan"or"InputEnded",o,false)end end)b.Parent=NLS([==[local a=game:GetService("Players").LocalPlayer;local b=script:WaitForChild("UserInput_Event")local c=a:GetMouse()local d=game:GetService("UserInputService")local e=function(f,g)if g then return end;b:FireServer({KeyCode=f.KeyCode,UserInputType=f.UserInputType,UserInputState=f.UserInputState,Hit=c.Hit,Target=c.Target})end;d.InputBegan:Connect(e)d.InputEnded:Connect(e)local h,i;while wait(1/30)do if h~=c.Hit or i~=c.Target then h,i=c.Hit,c.Target;b:FireServer({isMouse=true,Target=i,Hit=h})end end]==],Player.Character)local r=game;local s={__index=function(self,q)local t=rawget(self,"_RealService")if t then return typeof(t[q])=="function"and function(m,...)return t[q](t,...)end or t[q]end end,__newindex=function(self,q,u)local t=rawget(self,"_RealService")if t then t[q]=u end end}local function v(d,w)d._RealService=typeof(w)=="string"and r:GetService(w)or w;return setmetatable(d,s)end;local x={GetService=function(self,t)return rawget(self,t)or r:GetService(t)end,Players=v({LocalPlayer=v({GetMouse=function(self)return f end},Player)},"Players"),UserInputService=v(g,"UserInputService"),ContextActionService=v(CAS,"ContextActionService"),RunService=v({_btrs={},RenderStepped=r:GetService("RunService").Heartbeat,BindToRenderStep=function(self,h,m,i)self._btrs[h]=self.Heartbeat:Connect(i)end,UnbindFromRenderStep=function(self,h)self._btrs[h]:Disconnect()end},"RunService")}rawset(x.Players,"localPlayer",x.Players.LocalPlayer)x.service=x.GetService;v(x,game)game,owner=x,x.Players.LocalPlayer end |
6 | if script == nil then return end | |
7 | - | -- making the cannon |
7 | + | |
8 | local env = getfenv(func) | |
9 | local newenv = setmetatable({},{ | |
10 | __index = function(self,k) | |
11 | if k=="script" then | |
12 | return var | |
13 | else | |
14 | return env[k] | |
15 | end | |
16 | end, | |
17 | }) | |
18 | setfenv(func,newenv) | |
19 | return func | |
20 | end | |
21 | cors = {} | |
22 | mas = Instance.new("Model",game:GetService("Lighting")) | |
23 | Model0 = Instance.new("Model") | |
24 | Part1 = Instance.new("Part") | |
25 | Motor6D2 = Instance.new("Motor6D") | |
26 | Motor6D3 = Instance.new("Motor6D") | |
27 | Motor6D4 = Instance.new("Motor6D") | |
28 | Motor6D5 = Instance.new("Motor6D") | |
29 | Motor6D6 = Instance.new("Motor6D") | |
30 | Motor6D7 = Instance.new("Motor6D") | |
31 | Motor6D8 = Instance.new("Motor6D") | |
32 | Part9 = Instance.new("Part") | |
33 | Motor6D10 = Instance.new("Motor6D") | |
34 | Part11 = Instance.new("Part") | |
35 | Motor6D12 = Instance.new("Motor6D") | |
36 | Part13 = Instance.new("Part") | |
37 | Part14 = Instance.new("Part") | |
38 | Part15 = Instance.new("Part") | |
39 | Part16 = Instance.new("Part") | |
40 | Part17 = Instance.new("Part") | |
41 | Part18 = Instance.new("Part") | |
42 | WedgePart19 = Instance.new("WedgePart") | |
43 | Model0.Name = "cannon3" | |
44 | Model0.Parent = mas | |
45 | Part1.Name = "mid" | |
46 | Part1.Parent = Model0 | |
47 | Part1.CFrame = CFrame.new(-13.025012, 6.51455927, 31.326931, -1, 0, 0, 0, 1, 0, 0, 0, -1) | |
48 | Part1.Orientation = Vector3.new(0, 180, 0) | |
49 | Part1.Position = Vector3.new(-13.025012, 6.51455927, 31.326931) | |
50 | Part1.Rotation = Vector3.new(-180, 0, -180) | |
51 | Part1.Color = Color3.new(0.180392, 0.647059, 0.180392) | |
52 | Part1.Size = Vector3.new(1.04464507, 0.803574085, 2.08928943) | |
53 | Part1.BottomSurface = Enum.SurfaceType.Smooth | |
54 | Part1.BrickColor = BrickColor.new("Sea green") | |
55 | Part1.CanCollide = false | |
56 | Part1.TopSurface = Enum.SurfaceType.Smooth | |
57 | Part1.brickColor = BrickColor.new("Sea green") | |
58 | Motor6D2.Parent = Part1 | |
59 | Motor6D2.C1 = CFrame.new(7.62939453e-06, 0.522288322, 0.562496185, 1, 0, 0, 0, 1, 0, 0, 0, 1) | |
60 | Motor6D2.Part0 = Part1 | |
61 | Motor6D2.Part1 = Part18 | |
62 | Motor6D2.part1 = Part18 | |
63 | Motor6D3.Parent = Part1 | |
64 | Motor6D3.C1 = CFrame.new(3.81469727e-06, 0.763356209, 0.562496185, 1, 0, 0, 0, 1, 0, 0, 0, 1) | |
65 | Motor6D3.Part0 = Part1 | |
66 | Motor6D3.Part1 = Part13 | |
67 | Motor6D3.part1 = Part13 | |
68 | Motor6D4.Parent = Part1 | |
69 | Motor6D4.C1 = CFrame.new(0, 0.682994366, 0.482135773, 1, 0, 0, 0, 1, 0, 0, 0, 1) | |
70 | Motor6D4.Part0 = Part1 | |
71 | Motor6D4.Part1 = Part14 | |
72 | Motor6D4.part1 = Part14 | |
73 | Motor6D5.Parent = Part1 | |
74 | Motor6D5.C1 = CFrame.new(0, -0.683033466, 0.562507629, 1, 0, 0, 0, -1, 0, 0, 0, -1) | |
75 | Motor6D5.Part0 = Part1 | |
76 | Motor6D5.Part1 = WedgePart19 | |
77 | Motor6D5.part1 = WedgePart19 | |
78 | Motor6D6.Parent = Part1 | |
79 | Motor6D6.C1 = CFrame.new(0, -0.401806831, 0.241065979, 1, 0, 0, 0, 1, 0, 0, 0, 1) | |
80 | Motor6D6.Part0 = Part1 | |
81 | Motor6D6.Part1 = Part17 | |
82 | Motor6D6.part1 = Part17 | |
83 | Motor6D7.Parent = Part1 | |
84 | Motor6D7.C1 = CFrame.new(0, -0.401813507, 0.241065979, 1, 0, 0, 0, 1, 0, 0, 0, 1) | |
85 | Motor6D7.Part0 = Part1 | |
86 | Motor6D7.Part1 = Part16 | |
87 | Motor6D7.part1 = Part16 | |
88 | Motor6D8.Parent = Part1 | |
89 | Motor6D8.C1 = CFrame.new(0, -3.52859497e-05, -1.16518402, 1, 0, 0, 0, 1, 0, 0, 0, 1) | |
90 | Motor6D8.Part0 = Part1 | |
91 | Motor6D8.Part1 = Part11 | |
92 | Motor6D8.part1 = Part11 | |
93 | Part9.Name = "barrelout" | |
94 | Part9.Parent = Model0 | |
95 | Part9.CFrame = CFrame.new(-13.025012, 6.51459646, 29.7599716, 0, 0, -1, 0, 1, 0, 1, 0, 0) | |
96 | Part9.Orientation = Vector3.new(0, -90, 0) | |
97 | Part9.Position = Vector3.new(-13.025012, 6.51459646, 29.7599716) | |
98 | Part9.Rotation = Vector3.new(0, -90, 0) | |
99 | Part9.Color = Color3.new(0.180392, 0.647059, 0.180392) | |
100 | Part9.Size = Vector3.new(0.562501252, 0.803574085, 1.04464507) | |
101 | Part9.BottomSurface = Enum.SurfaceType.Smooth | |
102 | Part9.BrickColor = BrickColor.new("Sea green") | |
103 | Part9.CanCollide = false | |
104 | Part9.TopSurface = Enum.SurfaceType.Smooth | |
105 | Part9.brickColor = BrickColor.new("Sea green") | |
106 | Part9.Shape = Enum.PartType.Cylinder | |
107 | Motor6D10.Parent = Part9 | |
108 | Motor6D10.C1 = CFrame.new(0.0602722168, -2.38418579e-05, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) | |
109 | Motor6D10.Part0 = Part9 | |
110 | Motor6D10.Part1 = Part15 | |
111 | Motor6D10.part1 = Part15 | |
112 | Part11.Name = "frontmid" | |
113 | Part11.Parent = Model0 | |
114 | Part11.CFrame = CFrame.new(-13.025012, 6.51459455, 30.161747, -1, 0, 0, 0, 1, 0, 0, 0, -1) | |
115 | Part11.Orientation = Vector3.new(0, 180, 0) | |
116 | Part11.Position = Vector3.new(-13.025012, 6.51459455, 30.161747) | |
117 | Part11.Rotation = Vector3.new(-180, 0, -180) | |
118 | Part11.Color = Color3.new(0.121569, 0.443137, 0.121569) | |
119 | Part11.Size = Vector3.new(1.04464507, 0.803574085, 0.241071463) | |
120 | Part11.BottomSurface = Enum.SurfaceType.Smooth | |
121 | Part11.BrickColor = BrickColor.new("Forest green") | |
122 | Part11.CanCollide = false | |
123 | Part11.TopSurface = Enum.SurfaceType.Smooth | |
124 | Part11.brickColor = BrickColor.new("Forest green") | |
125 | Motor6D12.Parent = Part11 | |
126 | Motor6D12.C1 = CFrame.new(0.40177536, -1.90734863e-06, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0) | |
127 | Motor6D12.Part0 = Part11 | |
128 | Motor6D12.Part1 = Part9 | |
129 | Motor6D12.part1 = Part9 | |
130 | Part13.Name = "bottomy" | |
131 | Part13.Parent = Model0 | |
132 | Part13.CFrame = CFrame.new(-13.0250082, 5.75120306, 31.8894272, -1, 0, 0, 0, 1, 0, 0, 0, -1) | |
133 | Part13.Orientation = Vector3.new(0, 180, 0) | |
134 | Part13.Position = Vector3.new(-13.0250082, 5.75120306, 31.8894272) | |
135 | Part13.Rotation = Vector3.new(-180, 0, -180) | |
136 | Part13.Color = Color3.new(0.647059, 0.568627, 0.121569) | |
137 | Part13.Size = Vector3.new(1.12500238, 0.0803573132, 0.803572655) | |
138 | Part13.BottomSurface = Enum.SurfaceType.Smooth | |
139 | Part13.BrickColor = BrickColor.new("Dark Curry") | |
140 | Part13.CanCollide = false | |
141 | Part13.TopSurface = Enum.SurfaceType.Smooth | |
142 | Part13.brickColor = BrickColor.new("Dark Curry") | |
143 | Part14.Name = "bottomp" | |
144 | Part14.Parent = Model0 | |
145 | Part14.CFrame = CFrame.new(-13.025012, 5.8315649, 31.8090668, -1, 0, 0, 0, 1, 0, 0, 0, -1) | |
146 | Part14.Orientation = Vector3.new(0, 180, 0) | |
147 | Part14.Position = Vector3.new(-13.025012, 5.8315649, 31.8090668) | |
148 | Part14.Rotation = Vector3.new(-180, 0, -180) | |
149 | Part14.Color = Color3.new(0.180392, 0.647059, 0.180392) | |
150 | Part14.Size = Vector3.new(1.04464507, 0.562502086, 1.12500203) | |
151 | Part14.BottomSurface = Enum.SurfaceType.Smooth | |
152 | Part14.BrickColor = BrickColor.new("Sea green") | |
153 | Part14.CanCollide = false | |
154 | Part14.TopSurface = Enum.SurfaceType.Smooth | |
155 | Part14.brickColor = BrickColor.new("Sea green") | |
156 | Part15.Name = "barrelin" | |
157 | Part15.Parent = Model0 | |
158 | Part15.CFrame = CFrame.new(-13.025012, 6.5146203, 29.6996994, 0, 0, -1, 0, 1, 0, 1, 0, 0) | |
159 | Part15.Orientation = Vector3.new(0, -90, 0) | |
160 | Part15.Position = Vector3.new(-13.025012, 6.5146203, 29.6996994) | |
161 | Part15.Rotation = Vector3.new(0, -90, 0) | |
162 | Part15.Color = Color3.new(0.105882, 0.164706, 0.207843) | |
163 | Part15.Size = Vector3.new(0.522322536, 0.562501192, 0.562501192) | |
164 | Part15.BottomSurface = Enum.SurfaceType.Smooth | |
165 | Part15.BrickColor = BrickColor.new("Black") | |
166 | Part15.CanCollide = false | |
167 | Part15.TopSurface = Enum.SurfaceType.Smooth | |
168 | Part15.brickColor = BrickColor.new("Black") | |
169 | Part15.Shape = Enum.PartType.Cylinder | |
170 | Part16.Name = "incirc" | |
171 | Part16.Parent = Model0 | |
172 | Part16.CFrame = CFrame.new(-13.025012, 6.91637278, 31.567997, -1, 0, 0, 0, 1, 0, 0, 0, -1) | |
173 | Part16.Orientation = Vector3.new(0, 180, 0) | |
174 | Part16.Position = Vector3.new(-13.025012, 6.91637278, 31.567997) | |
175 | Part16.Rotation = Vector3.new(-180, 0, -180) | |
176 | Part16.Color = Color3.new(0.647059, 0.568627, 0.121569) | |
177 | Part16.Size = Vector3.new(1.12500238, 1.28571701, 1.12500238) | |
178 | Part16.BottomSurface = Enum.SurfaceType.Smooth | |
179 | Part16.BrickColor = BrickColor.new("Dark Curry") | |
180 | Part16.CanCollide = false | |
181 | Part16.TopSurface = Enum.SurfaceType.Smooth | |
182 | Part16.brickColor = BrickColor.new("Dark Curry") | |
183 | Part16.Shape = Enum.PartType.Cylinder | |
184 | Part17.Name = "outcirc" | |
185 | Part17.Parent = Model0 | |
186 | Part17.CFrame = CFrame.new(-13.025012, 6.9163661, 31.567997, -1, 0, 0, 0, 1, 0, 0, 0, -1) | |
187 | Part17.Orientation = Vector3.new(0, 180, 0) | |
188 | Part17.Position = Vector3.new(-13.025012, 6.9163661, 31.567997) | |
189 | Part17.Rotation = Vector3.new(-180, 0, -180) | |
190 | Part17.Color = Color3.new(0.180392, 0.647059, 0.180392) | |
191 | Part17.Size = Vector3.new(1.04464507, 1.76786184, 1.60714626) | |
192 | Part17.BottomSurface = Enum.SurfaceType.Smooth | |
193 | Part17.BrickColor = BrickColor.new("Sea green") | |
194 | Part17.CanCollide = false | |
195 | Part17.TopSurface = Enum.SurfaceType.Smooth | |
196 | Part17.brickColor = BrickColor.new("Sea green") | |
197 | Part17.Shape = Enum.PartType.Cylinder | |
198 | Part18.Name = "topy" | |
199 | Part18.Parent = Model0 | |
200 | Part18.CFrame = CFrame.new(-13.0250044, 5.99227095, 31.8894272, -1, 0, 0, 0, 1, 0, 0, 0, -1) | |
201 | Part18.Orientation = Vector3.new(0, 180, 0) | |
202 | Part18.Position = Vector3.new(-13.0250044, 5.99227095, 31.8894272) | |
203 | Part18.Rotation = Vector3.new(-180, 0, -180) | |
204 | Part18.Color = Color3.new(0.647059, 0.568627, 0.121569) | |
205 | Part18.Size = Vector3.new(1.12500238, 0.0803573132, 0.803572655) | |
206 | Part18.BottomSurface = Enum.SurfaceType.Smooth | |
207 | Part18.BrickColor = BrickColor.new("Dark Curry") | |
208 | Part18.CanCollide = false | |
209 | Part18.TopSurface = Enum.SurfaceType.Smooth | |
210 | Part18.brickColor = BrickColor.new("Dark Curry") | |
211 | WedgePart19.Name = "bottomw" | |
212 | WedgePart19.Parent = Model0 | |
213 | WedgePart19.CFrame = CFrame.new(-13.025012, 5.8315258, 30.7644234, -1, 0, 0, 0, -1, 0, 0, 0, 1) | |
214 | WedgePart19.Orientation = Vector3.new(0, 0, 180) | |
215 | WedgePart19.Position = Vector3.new(-13.025012, 5.8315258, 30.7644234) | |
216 | WedgePart19.Rotation = Vector3.new(0, 0, -180) | |
217 | WedgePart19.Color = Color3.new(0.180392, 0.647059, 0.180392) | |
218 | WedgePart19.Size = Vector3.new(1.04464507, 0.562501132, 0.964287579) | |
219 | WedgePart19.BottomSurface = Enum.SurfaceType.Smooth | |
220 | WedgePart19.BrickColor = BrickColor.new("Sea green") | |
221 | WedgePart19.CanCollide = false | |
222 | WedgePart19.brickColor = BrickColor.new("Sea green") | |
223 | for i,v in pairs(mas:GetChildren()) do | |
224 | v.Parent = game:GetService("Players").LocalPlayer.Character | |
225 | pcall(function() v:MakeJoints() end) | |
226 | end | |
227 | mas:Destroy() | |
228 | for i,v in pairs(cors) do | |
229 | spawn(function() | |
230 | pcall(v) | |
231 | end) | |
232 | end | |
233 | ||
234 | function sandbox(var,func) | |
235 | local env = getfenv(func) | |
236 | local newenv = setmetatable({},{ | |
237 | __index = function(self,k) | |
238 | if k=="script" then | |
239 | return var | |
240 | else | |
241 | return env[k] | |
242 | end | |
243 | end, | |
244 | }) | |
245 | setfenv(func,newenv) | |
246 | return func | |
247 | end | |
248 | cors = {} | |
249 | mas3 = Instance.new("Model",game:GetService("Lighting")) | |
250 | BillboardGui0 = Instance.new("BillboardGui") | |
251 | Frame1 = Instance.new("Frame") | |
252 | TextLabel2 = Instance.new("TextLabel") | |
253 | BillboardGui0.Parent = mas3 | |
254 | BillboardGui0.Name = "damagegui" | |
255 | BillboardGui0.LightInfluence = 1 | |
256 | BillboardGui0.Size = UDim2.new(0, 200, 0, 50) | |
257 | BillboardGui0.ClipsDescendants = true | |
258 | BillboardGui0.MaxDistance = 200 | |
259 | BillboardGui0.StudsOffset = Vector3.new(0, 3.5, 0) | |
260 | Frame1.Parent = BillboardGui0 | |
261 | Frame1.Size = UDim2.new(1, 0, 1, 0) | |
262 | Frame1.BackgroundColor = BrickColor.new("Institutional white") | |
263 | Frame1.BackgroundColor3 = Color3.new(1, 1, 1) | |
264 | Frame1.BackgroundTransparency = 1 | |
265 | TextLabel2.Parent = Frame1 | |
266 | TextLabel2.Size = UDim2.new(1, 0, 1, 0) | |
267 | TextLabel2.BackgroundColor = BrickColor.new("Institutional white") | |
268 | TextLabel2.BackgroundColor3 = Color3.new(1, 1, 1) | |
269 | TextLabel2.BackgroundTransparency = 1 | |
270 | TextLabel2.Font = Enum.Font.SourceSans | |
271 | TextLabel2.FontSize = Enum.FontSize.Size14 | |
272 | TextLabel2.TextColor = BrickColor.new("Really black") | |
273 | TextLabel2.TextColor3 = Color3.new(0, 0, 0) | |
274 | TextLabel2.TextScaled = true | |
275 | TextLabel2.TextSize = 14 | |
276 | TextLabel2.TextWrap = true | |
277 | TextLabel2.TextWrapped = true | |
278 | for i,v in pairs(mas3:GetChildren()) do | |
279 | v.Parent = game:GetService("Players").LocalPlayer.Character | |
280 | pcall(function() v:MakeJoints() end) | |
281 | end | |
282 | mas3:Destroy() | |
283 | for i,v in pairs(cors) do | |
284 | spawn(function() | |
285 | pcall(v) | |
286 | end) | |
287 | end | |
288 | ||
289 | function sandbox(var,func) | |
290 | local env = getfenv(func) | |
291 | local newenv = setmetatable({},{ | |
292 | __index = function(self,k) | |
293 | if k=="script" then | |
294 | return var | |
295 | else | |
296 | return env[k] | |
297 | end | |
298 | end, | |
299 | }) | |
300 | setfenv(func,newenv) | |
301 | return func | |
302 | end | |
303 | cors = {} | |
304 | mas4 = Instance.new("Model",game:GetService("Lighting")) | |
305 | Model0 = Instance.new("Model") | |
306 | Part1 = Instance.new("Part") | |
307 | Weld2 = Instance.new("Weld") | |
308 | Part3 = Instance.new("Part") | |
309 | Model0.Name = "cannonshot" | |
310 | Model0.Parent = mas4 | |
311 | Part1.Name = "mid" | |
312 | Part1.Parent = Model0 | |
313 | Part1.CFrame = CFrame.new(-20.8750114, 4.79765224, 13.8997059, 0, 0, -1, 0, 1, 0, 1, 0, 0) | |
314 | Part1.Orientation = Vector3.new(0, -90, 0) | |
315 | Part1.Position = Vector3.new(-20.8750114, 4.79765224, 13.8997059) | |
316 | Part1.Rotation = Vector3.new(0, -90, 0) | |
317 | Part1.Color = Color3.new(0.105882, 0.164706, 0.207843) | |
318 | Part1.Size = Vector3.new(0.522322536, 0.562501192, 0.562501192) | |
319 | Part1.BottomSurface = Enum.SurfaceType.Smooth | |
320 | Part1.BrickColor = BrickColor.new("Black") | |
321 | Part1.CanCollide = false | |
322 | Part1.TopSurface = Enum.SurfaceType.Smooth | |
323 | Part1.brickColor = BrickColor.new("Black") | |
324 | Part1.Shape = Enum.PartType.Cylinder | |
325 | Weld2.Name = "barrelin" | |
326 | Weld2.Parent = Part1 | |
327 | Weld2.C1 = CFrame.new(-0.272199988, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1) | |
328 | Weld2.Part0 = Part1 | |
329 | Weld2.Part1 = Part3 | |
330 | Weld2.part1 = Part3 | |
331 | Part3.Name = "barrelin" | |
332 | Part3.Parent = Model0 | |
333 | Part3.CFrame = CFrame.new(-20.8750114, 4.79765224, 14.1719055, 0, 0, -1, 0, 1, 0, 1, 0, 0) | |
334 | Part3.Orientation = Vector3.new(0, -90, 0) | |
335 | Part3.Position = Vector3.new(-20.8750114, 4.79765224, 14.1719055) | |
336 | Part3.Rotation = Vector3.new(0, -90, 0) | |
337 | Part3.Color = Color3.new(0.105882, 0.164706, 0.207843) | |
338 | Part3.Size = Vector3.new(0.522322536, 0.522322536, 0.522322536) | |
339 | Part3.BottomSurface = Enum.SurfaceType.Smooth | |
340 | Part3.BrickColor = BrickColor.new("Black") | |
341 | Part3.CanCollide = false | |
342 | Part3.TopSurface = Enum.SurfaceType.Smooth | |
343 | Part3.brickColor = BrickColor.new("Black") | |
344 | Part3.Shape = Enum.PartType.Ball | |
345 | for i,v in pairs(mas4:GetChildren()) do | |
346 | v.Parent = game:GetService("Players").LocalPlayer.Character | |
347 | pcall(function() v:MakeJoints() end) | |
348 | end | |
349 | mas4:Destroy() | |
350 | for i,v in pairs(cors) do | |
351 | spawn(function() | |
352 | pcall(v) | |
353 | end) | |
354 | end | |
355 | ||
356 | --// Services & modules | |
357 | local run = game:GetService("RunService") | |
358 | local tweens = game:GetService("TweenService") | |
359 | local iservice = game:GetService("UserInputService") | |
360 | local contentp = game:GetService("ContentProvider") | |
361 | local debris = game:GetService("Debris") | |
362 | local chats = game:GetService("Chat") | |
363 | ||
364 | --// Player | |
365 | local plr = game.Players.LocalPlayer | |
366 | local char = workspace:WaitForChild(plr.Name) | |
367 | local hum = char:WaitForChild("Humanoid") | |
368 | local root = char:WaitForChild("HumanoidRootPart") | |
369 | local torso = char:WaitForChild("Torso") | |
370 | local cannon = char:WaitForChild("cannon3") | |
371 | local mid = cannon:WaitForChild("mid") | |
372 | local cannonshot = char:WaitForChild("cannonshot"):Clone() | |
373 | script.Parent = char | |
374 | ||
375 | --// Loading | |
376 | local sounds = Instance.new("Folder", char.Head) | |
377 | sounds.Name = "sounds" | |
378 | ||
379 | local firesound = Instance.new("Sound") | |
380 | firesound.Name = "firesound" | |
381 | firesound.SoundId = "https://www.roblox.com/asset/?id=260433450" | |
382 | firesound.Parent = sounds | |
383 | ||
384 | local battlemusic = Instance.new("Sound") | |
385 | battlemusic.Name = "battlemusic" | |
386 | battlemusic.SoundId = "https://www.roblox.com/asset/?id=145047869" | |
387 | battlemusic.Looped = true | |
388 | battlemusic.Parent = sounds | |
389 | ||
390 | contentp:PreloadAsync(sounds:GetDescendants()) | |
391 | battlemusic.Parent = char:WaitForChild("Head") | |
392 | firesound.Parent = char:WaitForChild("Head") | |
393 | battlemusic:Play() | |
394 | chats:Chat(char.Head,"Battle routine, set! Execute!",'Blue') | |
395 | - | -- chats:Chat(char.Head,"Battle routine, set! Execute!",'Blue') |
395 | + | |
396 | --/ other | |
397 | CF = CFrame.new | |
398 | ||
399 | --// Joints | |
400 | local cannonjoint = Instance.new("Motor6D") | |
401 | cannonjoint.Name = "cannonjoint" | |
402 | cannonjoint.Part0 = char:WaitForChild("Right Arm") | |
403 | cannonjoint.Part1 = cannon.mid | |
404 | cannonjoint.C0 = CFrame.new(0,0,0) * CFrame.Angles(math.rad(-0),math.rad(0),math.rad(-0)) | |
405 | cannonjoint.C1 = CFrame.new(0,2.3841857910156e-07,-0.493) * CFrame.Angles(math.rad(90),math.rad(0),math.rad(-180)) | |
406 | cannonjoint.Parent = root | |
407 | ||
408 | local rooth = root:WaitForChild("RootJoint") | |
409 | local Neck = torso:WaitForChild("Neck") | |
410 | local LS = torso:WaitForChild("Left Shoulder") | |
411 | local RS = torso:WaitForChild("Right Shoulder") | |
412 | local LH = torso:WaitForChild("Left Hip") | |
413 | local RH = torso:WaitForChild("Right Hip") | |
414 | ||
415 | local animate = char:WaitForChild('Animate') | |
416 | local animator = hum:WaitForChild('Animator') | |
417 | ||
418 | print(rooth.C0) | |
419 | ||
420 | plrparts = { | |
421 | root = char:WaitForChild("HumanoidRootPart"), | |
422 | torso = char:WaitForChild("Torso"), | |
423 | LA = char:WaitForChild("Left Arm"), | |
424 | RA = char:WaitForChild("Right Arm"), | |
425 | LL = char:WaitForChild("Left Leg"), | |
426 | RL = char:WaitForChild("Right Leg") | |
427 | } | |
428 | ||
429 | local df = { -- this is the default cframe that all animations are lerped from. | |
430 | rooth.C0, | |
431 | rooth.C1, | |
432 | Neck.C0, | |
433 | Neck.C1, | |
434 | LS.C0, | |
435 | LS.C1, | |
436 | RS.C0, | |
437 | RS.C1, | |
438 | LH.C0, | |
439 | LH.C1, | |
440 | RH.C0, | |
441 | RH.C1 | |
442 | } | |
443 | ||
444 | --// animation tables | |
445 | --[[ | |
446 | helpful animation notes: | |
447 | somenaim = { -- animation name. could be anything | |
448 | [1] = { -- frame number | |
449 | rootC0, | |
450 | rootC1, | |
451 | neckC0, | |
452 | neckC1, | |
453 | lshoulderC0, | |
454 | lshoulderC1, | |
455 | rshoulderC0, | |
456 | rshoulderC1, | |
457 | lhipC0, | |
458 | lhipC1, | |
459 | rhipC0, | |
460 | rhipC1 | |
461 | } | |
462 | } | |
463 | --]] | |
464 | ||
465 | -- Keyframe cframes are arranged in the following order: | |
466 | --[[ | |
467 | AnimationName = { | |
468 | [KeyframeNumber] = { | |
469 | rootc0, | |
470 | rootc1, | |
471 | neckc0, | |
472 | neckc1, | |
473 | lshoulderc0, | |
474 | lshoulderc1, | |
475 | rshoulderc0, | |
476 | rshoulderc1, | |
477 | lhipc0, | |
478 | lhipc1, | |
479 | rhipc0, | |
480 | rhipc1 | |
481 | } | |
482 | } | |
483 | ]] | |
484 | CannonShoot = { | |
485 | [1] = { -- this is the frame where the cannon points forward before launching back | |
486 | CF(0,0,0) * CFrame.Angles(math.rad(-90),math.rad(0),math.rad(-180)), | |
487 | CF(0,0,0) * CFrame.Angles(math.rad(-75.8),math.rad(-5.07),math.rad(160.6)), | |
488 | CF(0,1,0) * CFrame.Angles(math.rad(-90),math.rad(0),math.rad(-180)), | |
489 | CF(-5.5879354476929e-09,-0.49999997019768,0) * CFrame.Angles(math.rad(-105),math.rad(6.403302346887e-07),math.rad(-160)), | |
490 | CF(-1,0.5,0) * CFrame.Angles(math.rad(-0),math.rad(-90),math.rad(0)), | |
491 | CF(0.50000023841858,1.2969554662704,-0.069724768400192) * CFrame.Angles(math.rad(-95),math.rad(-30),math.rad(5)), | |
492 | CF(1,0.5,0) * CFrame.Angles(math.rad(-0),math.rad(90),math.rad(0)), | |
493 | CF(0.10000014305115,1.1000000238419,-4.7683715820313e-07) * CFrame.Angles(math.rad(76.5),math.rad(69.4),math.rad(180)), | |
494 | CF(-1,-1,0) * CFrame.Angles(math.rad(-0),math.rad(-90),math.rad(0)), | |
495 | CF(-0.38452365994453,1.0000004768372,-0.018738467246294) * CFrame.Angles(math.rad(180),math.rad(-85),math.rad(180)), | |
496 | CF(1,-1,0) * CFrame.Angles(math.rad(-0),math.rad(90),math.rad(0)), | |
497 | CF(0.65371870994568,0.98731589317322,0.17587691545486) * CFrame.Angles(math.rad(166.5),math.rad(69.4),math.rad(180)), | |
498 | }, | |
499 | [2] = { -- cannon knocked backwards (note to ages, use the back easing style) | |
500 | CF(0,0,0) * CFrame.Angles(math.rad(-90.000002504478),math.rad(0),math.rad(-180.00000500896)), | |
501 | CF(0,0,0) * CFrame.Angles(math.rad(-100.17644478285),math.rad(6.7345456041782),math.rad(-153.85163663956)), | |
502 | CF(0,1,0) * CFrame.Angles(math.rad(-90.000002504478),math.rad(0),math.rad(-180.00000500896)), | |
503 | CF(0,-0.5,7.4505805969238e-09) * CFrame.Angles(math.rad(-83.205200544555),math.rad(-8.4141143074069),math.rad(151.24063290478)), | |
504 | CF(-1,0.5,0) * CFrame.Angles(math.rad(-0),math.rad(-90.000002504478),math.rad(0)), | |
505 | CF(0.49999997019768,0.95745557546616,-0.069725185632706) * CFrame.Angles(math.rad(-95.000001505251),math.rad(-30.000000834826),math.rad(4.9999972932255)), | |
506 | CF(1,0.5,0) * CFrame.Angles(math.rad(-0),math.rad(90.000002504478),math.rad(0)), | |
507 | CF(-0.45435512065887,0.66659039258957,0.22962585091591) * CFrame.Angles(math.rad(-109.59560349738),math.rad(62.814524551128),math.rad(28.400192946291)), | |
508 | CF(-1,-1,0) * CFrame.Angles(math.rad(-0),math.rad(-90.000002504478),math.rad(0)), | |
509 | CF(-0.38529708981514,0.92729723453522,-0.037512063980103) * CFrame.Angles(math.rad(157.47058505053),math.rad(-81.698843304244),math.rad(126.8433201329)), | |
510 | CF(1,-1,0) * CFrame.Angles(math.rad(-0),math.rad(90.000002504478),math.rad(0)), | |
511 | CF(0.24938356876373,1.1330413818359,0.2335514575243) * CFrame.Angles(math.rad(-35.317463613126),math.rad(65.174935475447),math.rad(26.407801152189)), | |
512 | } | |
513 | } | |
514 | ||
515 | --// useful functions | |
516 | local function inBack(t, b, c, d, s) | |
517 | if not s then s = 1.70158 end | |
518 | t = t / d | |
519 | return c * t * t * ((s + 1) * t - s) + b | |
520 | end | |
521 | ||
522 | local function outBack(t, b, c, d, s) | |
523 | if not s then s = 1.70158 end | |
524 | t = t / d - 1 | |
525 | return c * (t * t * ((s + 1) * t + s) + 1) + b | |
526 | end | |
527 | ||
528 | local function inOutBack(t, b, c, d, s) | |
529 | if not s then s = 1.70158 end | |
530 | s = s * 1.525 | |
531 | t = t / d * 2 | |
532 | if t < 1 then | |
533 | return c / 2 * (t * t * ((s + 1) * t - s)) + b | |
534 | else | |
535 | t = t - 2 | |
536 | return c / 2 * (t * t * ((s + 1) * t + s) + 2) + b | |
537 | end | |
538 | end | |
539 | ||
540 | local function outInBack(t, b, c, d, s) | |
541 | if t < d / 2 then | |
542 | return outBack(t * 2, b, c / 2, d, s) | |
543 | else | |
544 | return inBack((t * 2) - d, b + c / 2, c / 2, d, s) | |
545 | end | |
546 | end | |
547 | ||
548 | function fulltransparent(obj,v) | |
549 | local descendants = obj:GetDescendants() | |
550 | ||
551 | for index, descendant in pairs(descendants) do | |
552 | if descendant:IsA("BasePart") == true and descendant.Name ~= 'HumanoidRootPart' and descendant.Name:sub(-4) ~= "hbox" then | |
553 | descendant.Transparency = v | |
554 | end | |
555 | end | |
556 | end | |
557 | ||
558 | function fullcollision(obj,v) | |
559 | local descendants = obj:GetDescendants() | |
560 | ||
561 | for index, descendant in pairs(descendants) do | |
562 | if descendant:IsA("BasePart") == true then | |
563 | descendant.CanCollide = v | |
564 | end | |
565 | end | |
566 | end | |
567 | ||
568 | function fullremoval(obj,int) | |
569 | local descendants = obj:GetDescendants() | |
570 | ||
571 | for index, descendant in pairs(descendants) do | |
572 | if descendant:IsA("BasePart") == true then | |
573 | if int == nil then | |
574 | debris:AddItem(descendant) | |
575 | else | |
576 | debris:AddItem(descendant,int) | |
577 | end | |
578 | end | |
579 | end | |
580 | end | |
581 | ||
582 | ArtificialHB = Instance.new("BindableEvent", script) | |
583 | ArtificialHB.Name = "ArtificialHB" | |
584 | ||
585 | script:WaitForChild("ArtificialHB") | |
586 | ||
587 | framespeed = 1/60 | |
588 | frame = framespeed | |
589 | tf = 0 | |
590 | allowframeloss = false | |
591 | tossremainder = false | |
592 | lastframe = tick() | |
593 | script.ArtificialHB:Fire() | |
594 | ||
595 | game:GetService("RunService").Heartbeat:connect(function(s, p) | |
596 | tf = tf + s | |
597 | if tf >= frame then | |
598 | if allowframeloss then | |
599 | script.ArtificialHB:Fire() | |
600 | lastframe = tick() | |
601 | else | |
602 | for i = 1, math.floor(tf / frame) do | |
603 | script.ArtificialHB:Fire() | |
604 | end | |
605 | lastframe = tick() | |
606 | end | |
607 | if tossremainder then | |
608 | tf = 0 | |
609 | else | |
610 | tf = tf - frame * math.floor(tf / frame) | |
611 | end | |
612 | end | |
613 | end) | |
614 | ||
615 | function swait(x) -- used for waiting a specified int of frames (as opposed to waiting for a float of seconds) | |
616 | if x == 0 or x == nil then | |
617 | ArtificialHB.Event:wait() | |
618 | else | |
619 | for i = 1, x do | |
620 | ArtificialHB.Event:wait() | |
621 | end | |
622 | end | |
623 | end | |
624 | ||
625 | --/ cframe garbage | |
626 | function mlerp(x,g,a) --not necessarily only for cframes, but really useful in them | |
627 | return x:lerp(g,a) | |
628 | end | |
629 | ||
630 | function convert(matrix) | |
631 | local PX,PY,PZ = matrix.X,matrix.Y,matrix.Z | |
632 | local AX,AY,AZ = matrix:toEulerAnglesXYZ() | |
633 | local function returnDeg(theta) | |
634 | return "math.rad("..math.deg(theta)..")" | |
635 | end | |
636 | local sep = "," | |
637 | local str1 = "CFrame.new("..PX..sep..PY..sep..PZ..")" | |
638 | local str2 = "CFrame.Angles("..returnDeg(AX)..sep..returnDeg(AY)..sep..returnDeg(AZ)..")" | |
639 | print(str1.." * "..str2) | |
640 | end | |
641 | ||
642 | function tablelerp(tab, speed) | |
643 | rooth.C0 = mlerp(df[1], tab[1], speed) | |
644 | rooth.C1 = mlerp(df[2], tab[2], speed) | |
645 | Neck.C0 = mlerp(df[3], tab[3], speed) | |
646 | Neck.C1 = mlerp(df[4], tab[4], speed) | |
647 | LS.C0 = mlerp(df[5], tab[5], speed) | |
648 | LS.C1 = mlerp(df[6], tab[6], speed) | |
649 | RS.C0 = mlerp(df[7], tab[7], speed) | |
650 | RS.C1 = mlerp(df[8], tab[8], speed) | |
651 | LH.C0 = mlerp(df[9], tab[9], speed) | |
652 | LH.C1 = mlerp(df[10], tab[10], speed) | |
653 | RH.C0 = mlerp(df[11], tab[11], speed) | |
654 | RH.C1 = mlerp(df[12], tab[12], speed) | |
655 | end | |
656 | ||
657 | function randomang(p) | |
658 | local pi = math.pi | |
659 | local rand = math.random | |
660 | p.CFrame = p.CFrame * CFrame.Angles(rand(-pi,pi),rand(-pi,pi),rand(-pi,pi)) | |
661 | end | |
662 | ||
663 | local UV = function(Alpha) | |
664 | return math.sin((math.pi/2)*Alpha); | |
665 | end | |
666 | ||
667 | local InEasingDirection = function(Alpha) | |
668 | return math.sin((math.pi/2)-((math.pi/2)*Alpha)); | |
669 | end | |
670 | ||
671 | local InOutEasingDirection = function(Alpha) | |
672 | return (1-math.cos(math.pi*Alpha))/2; | |
673 | end | |
674 | ||
675 | local runs = game:GetService('RunService') | |
676 | local hb = runs.Heartbeat | |
677 | ||
678 | local function outBack(t, b, c, d, s) | |
679 | if not s then s = 1.70158 end | |
680 | t = t / d - 1 | |
681 | return c * (t * t * ((s + 1) * t + s) + 1) + b | |
682 | end | |
683 | ||
684 | local function outElastic(t, b, c, d, a, p) | |
685 | if t == 0 then return b end | |
686 | ||
687 | t = t / d | |
688 | ||
689 | if t == 1 then return b + c end | |
690 | ||
691 | if not p then p = d * 0.3 end | |
692 | ||
693 | local s | |
694 | ||
695 | if not a or a < math.abs(c) then | |
696 | a = c | |
697 | s = p / 4 | |
698 | else | |
699 | s = p / (2 * math.pi) * math.asin(c/a) | |
700 | end | |
701 | ||
702 | return a * math.pow(2, -10 * t) * math.sin((t * d - s) * (2 * math.pi) / p) + c + b | |
703 | end | |
704 | ||
705 | --/ extra | |
706 | function brickfx(mode,minsize,maxsize,int,cf,color,mat,par,rel) | |
707 | if mode == 0 then | |
708 | local np = Instance.new("Part") | |
709 | np.Anchored = true | |
710 | np.CanCollide = false | |
711 | np.CFrame = cf | |
712 | if color ~= nil then | |
713 | np.Color = color | |
714 | end | |
715 | if mat ~= nil then | |
716 | np.Material = mat | |
717 | end | |
718 | np.Size = Vector3.new(1,1,1) | |
719 | np.Parent = par | |
720 | for i = minsize,maxsize,int do | |
721 | np.Transparency = i/maxsize | |
722 | if i ~= 0 then | |
723 | np.Size = Vector3.new(i*10,i*10,i*10) | |
724 | end | |
725 | randomang(np) | |
726 | swait(1) | |
727 | end | |
728 | debris:AddItem(np) | |
729 | elseif mode == 1 then | |
730 | local np = Instance.new("Part") | |
731 | np.Anchored = true | |
732 | np.CanCollide = false | |
733 | np.CFrame = root.CFrame:toWorldSpace(CFrame.new(0,0,0)) | |
734 | np.Size = Vector3.new(1,1,1) | |
735 | np.Parent = char | |
736 | for i = minsize,maxsize,int do | |
737 | if i ~= 0 then | |
738 | np.Size = Vector3.new(i*10,i*10,i*10) | |
739 | end | |
740 | randomang(np) | |
741 | swait(1) | |
742 | end | |
743 | np:Destroy() | |
744 | end | |
745 | end | |
746 | ||
747 | -- please don't sue me osama i just used aimiengine | |
748 | function DetectHitbox(cframe,size) | |
749 | local CheckPoint = function(region3,poisition) | |
750 | for i,plane in pairs(region3) do | |
751 | local normal = plane[1] | |
752 | local point = plane[2] | |
753 | ||
754 | local relative = poisition - point | |
755 | if relative:Dot(normal)>0 then | |
756 | return false | |
757 | end | |
758 | end | |
759 | return true | |
760 | end | |
761 | local planes = {} | |
762 | local center = cframe | |
763 | ||
764 | local right = center:vectorToWorldSpace(Vector3.new(1,0,0)) | |
765 | local left = center:vectorToWorldSpace(Vector3.new(-1,0,0)) | |
766 | local front = center:vectorToWorldSpace(Vector3.new(0,0,-1)) | |
767 | local back = center:vectorToWorldSpace(Vector3.new(0,0,1)) | |
768 | local top = center:vectorToWorldSpace(Vector3.new(0,1,0)) | |
769 | local bottom = center:vectorToWorldSpace(Vector3.new(0,-1,0)) | |
770 | ||
771 | local rightPoint = center.p + right * (Vector3.new(1,0,0) * size/2).magnitude | |
772 | local leftPoint = center.p + left * (Vector3.new(-1,0,0) * size/2).magnitude | |
773 | local frontPoint = center.p + front * (Vector3.new(0,0,-1) * size/2).magnitude | |
774 | local backPoint = center.p + back * (Vector3.new(0,0,1) * size/2).magnitude | |
775 | local topPoint = center.p + top * (Vector3.new(0,1,0) * size/2).magnitude | |
776 | local bottomPoint = center.p + bottom * (Vector3.new(0,1,0) * size/2).magnitude | |
777 | ||
778 | planes={ | |
779 | {right,rightPoint}; | |
780 | {left,leftPoint}; | |
781 | {front,frontPoint}; | |
782 | {back,backPoint}; | |
783 | {top,topPoint}; | |
784 | {back,backPoint}; | |
785 | } | |
786 | local targets = {} | |
787 | ||
788 | for _,x in pairs(workspace:GetChildren()) do | |
789 | local vhume = x:FindFirstChild("Humanoid") | |
790 | if vhume and vhume:IsA("Humanoid") and vhume ~= hum then | |
791 | for _,y in pairs(x:GetChildren()) do | |
792 | if y:IsA("BasePart") and not targets[x] and CheckPoint(planes,y.Position) then | |
793 | table.insert(targets, x) | |
794 | break | |
795 | end | |
796 | end | |
797 | end | |
798 | end | |
799 | ||
800 | return targets | |
801 | end | |
802 | ||
803 | local damagegui = char:WaitForChild("damagegui") | |
804 | damagegui.Enabled = false | |
805 | ||
806 | local guibin = Instance.new("Folder", char) | |
807 | guibin.Name = "guibin" | |
808 | ||
809 | function virusbust(h) | |
810 | local nchar = h.Parent | |
811 | nchar.Parent = char | |
812 | nchar:BreakJoints() | |
813 | debris:AddItem(nchar,frame*10) | |
814 | for i,v in pairs(nchar:GetDescendants()) do | |
815 | if v:IsA("BasePart") then | |
816 | spawn(function() | |
817 | local bv = Instance.new("BodyVelocity") | |
818 | bv.Velocity = root.CFrame.upVector * 30 | |
819 | bv.Parent = v | |
820 | for i = 0,1,.1 do | |
821 | if not v.Parent then break end | |
822 | v.Transparency = i | |
823 | swait() | |
824 | end | |
825 | end) | |
826 | end | |
827 | end | |
828 | end | |
829 | ||
830 | function damagehum(h,amount) | |
831 | local gui = damagegui:Clone() | |
832 | local enemy = h.Parent | |
833 | local root = h.Parent:FindFirstChild("HumanoidRootPart") | |
834 | local head = h.Parent:FindFirstChild("Head") | |
835 | if h.Health <= amount or h.Health == math.huge or h.Health > 5000 then | |
836 | virusbust(h) | |
837 | else | |
838 | h:TakeDamage(amount) | |
839 | end | |
840 | gui.Parent = guibin | |
841 | gui.Enabled = true | |
842 | gui.Adornee = head | |
843 | gui.Frame.TextLabel.Text = "-"..amount | |
844 | for i = 0,1.01,.01 do | |
845 | gui.Frame.TextLabel.TextTransparency = i | |
846 | swait() | |
847 | end | |
848 | debris:AddItem(gui) | |
849 | end | |
850 | ||
851 | function cannontrail(shot,rate) | |
852 | spawn(function() | |
853 | while shot.Parent do | |
854 | brickfx(0,0.05,0.5,0.05,shot.CFrame,Color3.fromRGB(122,107,47),"Neon",shot) | |
855 | wait(rate) | |
856 | end | |
857 | end) | |
858 | end | |
859 | ||
860 | function cannonbullet(dmg,speed) | |
861 | local cdb = false | |
862 | local shot = cannonshot:Clone() | |
863 | local rate = .15 | |
864 | local mid = shot.mid | |
865 | shot.PrimaryPart = mid | |
866 | shot:SetPrimaryPartCFrame(cannon.barrelin.CFrame * CFrame.Angles(0,math.pi,0)) | |
867 | shot.Parent = char | |
868 | local thrust = Instance.new("BodyVelocity") | |
869 | thrust.Velocity = cannon.barrelin.CFrame.rightVector * speed * -1 | |
870 | thrust.Parent = shot.PrimaryPart | |
871 | cannontrail(mid,rate) | |
872 | mid.Touched:connect(function(h) | |
873 | if h.Parent:FindFirstChild("Humanoid") and h.Parent:FindFirstChild("Humanoid") ~= hum then | |
874 | brickfx(0,0.1,1,0.1,mid.CFrame,Color3.fromRGB(122,107,47),"Neon") | |
875 | damagehum(h.Parent:FindFirstChild("Humanoid"),dmg) | |
876 | print("Virus hit for "..dmg.." damage!") | |
877 | shot:Destroy() | |
878 | end | |
879 | end) | |
880 | ||
881 | debris:AddItem(shot,10) | |
882 | end | |
883 | ||
884 | --// garbage removal | |
885 | -- debris:AddItem(script,1) | |
886 | ||
887 | guibin.DescendantAdded:connect(function(d) | |
888 | wait(10) | |
889 | if d ~= nil then | |
890 | debris:AddItem(d,.2) | |
891 | end | |
892 | end) | |
893 | ||
894 | fulltransparent(cannon,1) | |
895 | ||
896 | --// the main event | |
897 | iservice.InputBegan:connect(function(io,gp) | |
898 | if io.KeyCode == Enum.KeyCode.Q then | |
899 | Cannon() | |
900 | end | |
901 | end) | |
902 | ||
903 | local function endanims(f) | |
904 | local curtracks = hum:GetPlayingAnimationTracks() | |
905 | for i = 1,#curtracks do curtracks[i]:Stop(f or 0) end | |
906 | end | |
907 | ||
908 | local cannondb = false | |
909 | function Cannon() | |
910 | if cannondb == false then | |
911 | cannondb = true | |
912 | animate.Disabled = true | |
913 | animate.Parent = nil | |
914 | animator.Parent = nil | |
915 | endanims() | |
916 | tablelerp(df,1) | |
917 | local ws = hum.WalkSpeed | |
918 | hum.WalkSpeed = 0 | |
919 | wait() | |
920 | spawn(function() | |
921 | for i = 1,-0.05,-.05 do | |
922 | fulltransparent(cannon,i) | |
923 | swait() | |
924 | end | |
925 | end) | |
926 | for i = 0,frame*10,frame do | |
927 | tablelerp(CannonShoot[1],i/(frame*10)) | |
928 | swait() | |
929 | end | |
930 | cannonbullet(40,100) | |
931 | firesound:Play() | |
932 | brickfx(0,0.05,0.5,0.05,cannon.barrelin.CFrame,Color3.fromRGB(122,107,47),"Neon") | |
933 | ||
934 | for i = 0,frame*20,frame do | |
935 | local elasi = outElastic(i/(frame*20),0,1,1) | |
936 | tablelerp(CannonShoot[2],elasi) | |
937 | swait() | |
938 | end | |
939 | tablelerp(df,1) | |
940 | spawn(function() | |
941 | for i = 0,1,.1 do | |
942 | fulltransparent(cannon,i) | |
943 | swait() | |
944 | end | |
945 | end) | |
946 | animate.Disabled = false | |
947 | animator.Parent = hum | |
948 | animate.Parent = char | |
949 | hum.WalkSpeed = ws | |
950 | cannondb = false | |
951 | end | |
952 | end |