SHOW:
|
|
- or go back to the newest paste.
1 | --just put this on the top of a script and boom 89% works | |
2 | --note this does not work on big scripts | |
3 | if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end | |
4 | local Player,game,owner = owner,game | |
5 | local RealPlayer = Player | |
6 | do | |
7 | local rp = RealPlayer | |
8 | script.Parent = rp.Character | |
9 | ||
10 | --RemoteEvent for communicating | |
11 | local Event = Instance.new("RemoteEvent") | |
12 | Event.Name = "UserInput_Event" | |
13 | ||
14 | --Fake event to make stuff like Mouse.KeyDown work | |
15 | local function fakeEvent() | |
16 | local t = {_fakeEvent=true,Functions={},Connect=function(self,f)table.insert(self.Functions,f) end} | |
17 | t.connect = t.Connect | |
18 | return t | |
19 | end | |
20 | ||
21 | --Creating fake input objects with fake variables | |
22 | local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()} | |
23 | local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()} | |
24 | local CAS = {Actions={},BindAction=function(self,name,fun,touch,...) | |
25 | CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil | |
26 | end} | |
27 | --Merged 2 functions into one by checking amount of arguments | |
28 | CAS.UnbindAction = CAS.BindAction | |
29 | ||
30 | --This function will trigger the events that have been :Connect()'ed | |
31 | local function te(self,ev,...) | |
32 | local t = m[ev] | |
33 | if t and t._fakeEvent then | |
34 | for _,f in pairs(t.Functions) do | |
35 | f(...) | |
36 | end | |
37 | end | |
38 | end | |
39 | m.TrigEvent = te | |
40 | UIS.TrigEvent = te | |
41 | ||
42 | Event.OnServerEvent:Connect(function(plr,io) | |
43 | if plr~=rp then return end | |
44 | m.Target = io.Target | |
45 | m.Hit = io.Hit | |
46 | if not io.isMouse then | |
47 | local b = io.UserInputState == Enum.UserInputState.Begin | |
48 | if io.UserInputType == Enum.UserInputType.MouseButton1 then | |
49 | return m:TrigEvent(b and "Button1Down" or "Button1Up") | |
50 | end | |
51 | for _,t in pairs(CAS.Actions) do | |
52 | for _,k in pairs(t.Keys) do | |
53 | if k==io.KeyCode then | |
54 | t.Function(t.Name,io.UserInputState,io) | |
55 | end | |
56 | end | |
57 | end | |
58 | m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower()) | |
59 | UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false) | |
60 | end | |
61 | end) | |
62 | Event.Parent = NLS([==[ | |
63 | local Player = game:GetService("Players").LocalPlayer | |
64 | local Event = script:WaitForChild("UserInput_Event") | |
65 | ||
66 | local Mouse = Player:GetMouse() | |
67 | local UIS = game:GetService("UserInputService") | |
68 | local input = function(io,a) | |
69 | if a then return end | |
70 | --Since InputObject is a client-side instance, we create and pass table instead | |
71 | Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target}) | |
72 | end | |
73 | UIS.InputBegan:Connect(input) | |
74 | UIS.InputEnded:Connect(input) | |
75 | ||
76 | local h,t | |
77 | --Give the server mouse data 30 times every second, but only if the values changed | |
78 | --If player is not moving their mouse, client won't fire events | |
79 | while wait(1/30) do | |
80 | if h~=Mouse.Hit or t~=Mouse.Target then | |
81 | h,t=Mouse.Hit,Mouse.Target | |
82 | Event:FireServer({isMouse=true,Target=t,Hit=h}) | |
83 | end | |
84 | end]==],Player.Character) | |
85 | ||
86 | ----Sandboxed game object that allows the usage of client-side methods and services | |
87 | --Real game object | |
88 | local _rg = game | |
89 | ||
90 | --Metatable for fake service | |
91 | local fsmt = { | |
92 | __index = function(self,k) | |
93 | local s = rawget(self,"_RealService") | |
94 | if s then return s[k] end | |
95 | end, | |
96 | __newindex = function(self,k,v) | |
97 | local s = rawget(self,"_RealService") | |
98 | if s then s[k]=v end | |
99 | end, | |
100 | __call = function(self,...) | |
101 | local s = rawget(self,"_RealService") | |
102 | if s then return s(...) end | |
103 | end | |
104 | } | |
105 | local function FakeService(t,RealService) | |
106 | t._RealService = typeof(RealService)=="string" and _rg:GetService(RealService) or RealService | |
107 | return setmetatable(t,fsmt) | |
108 | end | |
109 | ||
110 | --Fake game object | |
111 | local g = { | |
112 | GetService = function(self,s) | |
113 | return self[s] | |
114 | end, | |
115 | Players = FakeService({ | |
116 | LocalPlayer = FakeService({GetMouse=function(self)return m end},Player) | |
117 | },"Players"), | |
118 | UserInputService = FakeService(UIS,"UserInputService"), | |
119 | ContextActionService = FakeService(CAS,"ContextActionService"), | |
120 | } | |
121 | rawset(g.Players,"localPlayer",g.Players.LocalPlayer) | |
122 | g.service = g.GetService | |
123 | ||
124 | g.RunService = FakeService({ | |
125 | RenderStepped = _rg:GetService("RunService").Heartbeat, | |
126 | BindToRenderStep = function(self,name,_,fun) | |
127 | self._btrs[name] = self.Heartbeat:Connect(fun) | |
128 | end, | |
129 | UnbindFromRenderStep = function(self,name) | |
130 | self._btrs[name]:Disconnect() | |
131 | end, | |
132 | },"RunService") | |
133 | ||
134 | setmetatable(g,{ | |
135 | __index=function(self,s) | |
136 | return _rg:GetService(s) or typeof(_rg[s])=="function" | |
137 | and function(_,...)return _rg[s](_rg,...)end or _rg[s] | |
138 | end, | |
139 | __newindex = fsmt.__newindex, | |
140 | __call = fsmt.__call | |
141 | }) | |
142 | --Changing owner to fake player object to support owner:GetMouse() | |
143 | game,owner = g,g.Players.LocalPlayer | |
144 | end | |
145 | ||
146 | ||
147 | -- Synapse Decompiler | |
148 | -- Purchase Here: https://brack4712.xyz/synapse/purchase/ | |
149 | ||
150 | ||
151 | ||
152 | -- Rideket | |
153 | -- @Acecateer | |
154 | ||
155 | -- Acecateer Rideket | |
156 | ||
157 | wait(0.5) | |
158 | ||
159 | --[[ Missile properties ]]-- | |
160 | local currentSpeed = 0 | |
161 | local ejectedSpeed = 0 | |
162 | local maxSpeed = 350 | |
163 | local increaseTime = 0.3 | |
164 | local increaseIncrement = 10 | |
165 | local decreaseTime = 0.2 | |
166 | local decreaseIncrement = 15 | |
167 | local collisionSpeed = 100 | |
168 | local doPrints = false | |
169 | local Color = false | |
170 | local speedGauge = true | |
171 | ||
172 | local Player = game.Players.LocalPlayer | |
173 | local Mouse = Player:GetMouse() | |
174 | Mouse.TargetFilter = workspace | |
175 | local mousePos | |
176 | repeat wait() until Player.Character:IsDescendantOf(workspace) | |
177 | local Character = Player.Character | |
178 | repeat wait() until Character:FindFirstChild("Humanoid") | |
179 | local Humanoid = Character.Humanoid | |
180 | Humanoid:WaitForChild("Animator"):Destroy() | |
181 | ||
182 | -- Services | |
183 | local InputService = game:GetService("UserInputService") | |
184 | local RunService = game:GetService("RunService") | |
185 | ||
186 | -- Set up character variables | |
187 | local bodyParts = {} | |
188 | local Joints = {} | |
189 | ||
190 | local scanCharacter = function() | |
191 | Scan = function(Target) | |
192 | for _, child in pairs(Target:GetChildren()) do | |
193 | if child:IsA("Part") then | |
194 | bodyParts[child.Name] = child | |
195 | if #child:GetChildren() > 0 then | |
196 | Scan(child) | |
197 | end | |
198 | elseif child:IsA("Motor6D") then | |
199 | Joints[child.Name] = child | |
200 | end | |
201 | end | |
202 | end | |
203 | Scan(Character) | |
204 | end | |
205 | scanCharacter() | |
206 | ||
207 | local fromRootC0, fromRootC1 = Joints["RootJoint"].C0, Joints["RootJoint"].C1 | |
208 | local fromNeck = Joints["Neck"].C1 | |
209 | local fromLeftShoulder = Joints["Left Shoulder"].C1 | |
210 | local fromRightShoulder = Joints["Right Shoulder"].C1 | |
211 | local fromLeftHip = Joints["Left Hip"].C1 | |
212 | local fromRightHip = Joints["Right Hip"].C1 | |
213 | ||
214 | local Seat = Instance.new("Seat", Character) | |
215 | Seat.Transparency = 1 | |
216 | Seat.CanCollide = false | |
217 | Seat.FormFactor = Enum.FormFactor.Custom | |
218 | Seat.Size = Vector3.new(1, 0.5, 1) | |
219 | local seatWeld = Instance.new("Weld", Seat) | |
220 | seatWeld.Part0 = Seat | |
221 | seatWeld.Part1 = bodyParts["Torso"] | |
222 | seatWeld.C1 = CFrame.new(0, -0.8, 0) * CFrame.Angles(math.pi/2, 0, 0) | |
223 | ||
224 | local lastSeatChar | |
225 | local preLeftJoint, preRightJoint | |
226 | Seat.Changed:connect(function(Property) | |
227 | if Property == "Occupant" and Seat.Occupant then | |
228 | lastSeatChar = Seat.Occupant.Parent | |
229 | local Torso = lastSeatChar:FindFirstChild("Torso") | |
230 | if Torso then | |
231 | local LeftJoint = Torso["Left Hip"] | |
232 | local RightJoint = Torso["Right Hip"] | |
233 | preLeftJoint = LeftJoint.C1 | |
234 | preRightJoint = RightJoint.C1 | |
235 | LeftJoint.C1 = LeftJoint.C1 * CFrame.Angles(math.rad(25), 0, 0) | |
236 | RightJoint.C1 = RightJoint.C1 * CFrame.Angles(math.rad(25), 0, 0) | |
237 | end | |
238 | elseif not Seat.Occupant and lastSeatChar then | |
239 | local Torso = lastSeatChar:FindFirstChild("Torso") | |
240 | if Torso then | |
241 | local LeftJoint = Torso["Left Hip"] | |
242 | local RightJoint = Torso["Right Hip"] | |
243 | LeftJoint.C1 = preLeftJoint | |
244 | RightJoint.C1 = preRightJoint | |
245 | end | |
246 | end | |
247 | end) | |
248 | ||
249 | createMissile = function() | |
250 | local Ejected = false | |
251 | ||
252 | Humanoid.Jump = true; wait(0.3) | |
253 | ||
254 | local Missile = Instance.new("Part", Character) | |
255 | Missile.Name = "Missile" | |
256 | if Color then Missile.BrickColor = Color end | |
257 | Missile.FormFactor = Enum.FormFactor.Custom | |
258 | Missile.Size = Vector3.new(1.56, 1.37, 5.65) | |
259 | ||
260 | local Mesh = Instance.new("SpecialMesh", Missile) | |
261 | Mesh.MeshId = "http://www.roblox.com/asset/?id=103970395" | |
262 | if not Color then Mesh.TextureId = "http://www.roblox.com/asset/?id=103967643" end | |
263 | Mesh.Scale = Vector3.new(4, 4, 4) | |
264 | ||
265 | local EmitterPart = Instance.new("Part", Character) | |
266 | EmitterPart.Name = "SmokeEmitter" | |
267 | EmitterPart.CanCollide = false | |
268 | EmitterPart.Transparency = 1 | |
269 | EmitterPart.FormFactor = Enum.FormFactor.Custom | |
270 | EmitterPart.Size = Vector3.new(0.2, 0.2, 0.2) | |
271 | ||
272 | local EmitterWeld = Instance.new("Weld", Missile) | |
273 | EmitterWeld.Part0 = Missile | |
274 | EmitterWeld.Part1 = EmitterPart | |
275 | EmitterWeld.C0 = CFrame.Angles(math.pi/2, 0, 0) | |
276 | EmitterWeld.C1 = CFrame.new(0, -Missile.Size.Z/2, 0) | |
277 | ||
278 | local Smoke = Instance.new("ParticleEmitter", EmitterPart) | |
279 | Smoke.Enabled = false | |
280 | Smoke.Size = NumberSequence.new(0.8) | |
281 | Smoke.Texture = "rbxassetid://243661573" | |
282 | Smoke.Lifetime = NumberRange.new(0.5, 1) | |
283 | Smoke.Rate = 25 | |
284 | Smoke.Rotation = NumberRange.new(-15, 15) | |
285 | Smoke.RotSpeed = NumberRange.new(50) | |
286 | Smoke.Speed = NumberRange.new(5, 10) | |
287 | Smoke.VelocitySpread = 30 | |
288 | ||
289 | Joints["RootJoint"].C0 = fromRootC0 * CFrame.Angles(math.pi/2, 0, 0) | |
290 | Joints["RootJoint"].C1 = fromRootC1 * CFrame.new(0, 3, 0) | |
291 | local Weld = Instance.new("Weld", bodyParts["Torso"]) | |
292 | Weld.Part0 = bodyParts["Torso"] | |
293 | Weld.Part1 = Missile | |
294 | Weld.C0 = CFrame.new(0, 0, -1) | |
295 | Weld.C1 = CFrame.Angles(-math.pi/2, 0, 0) | |
296 | ||
297 | -- Set up posture! | |
298 | local currentLeftShoulder, currentRightShoulder = Joints["Left Shoulder"].C1, Joints["Right Shoulder"].C1 | |
299 | local currentLeftHip, currentRightHip = Joints["Left Hip"].C1, Joints["Right Hip"].C1 | |
300 | local currentNeck = Joints["Neck"].C1 | |
301 | local toNeck = fromNeck * CFrame.new(0, 0.25, 0) * CFrame.Angles(math.rad(80), 0, 0) | |
302 | local toLeftShoulder = fromLeftShoulder * CFrame.new(-0.3, 0, 0.5) * CFrame.Angles(math.pi/2, math.rad(120), 0) | |
303 | local toRightShoulder = fromRightShoulder * CFrame.new(0.3, 0, 0.5) * CFrame.Angles(math.pi/2, -math.rad(120), 0) | |
304 | local toLeftHip = fromLeftHip * CFrame.new(0.5, -0.5, 0) * CFrame.Angles(math.rad(30), math.rad(40), math.rad(20)) | |
305 | local toRightHip = fromRightHip * CFrame.new(-0.5, -0.5, 0) * CFrame.Angles(math.rad(30), -math.rad(40), -math.rad(20)) | |
306 | spawn(function() | |
307 | for i = 0, 1, 0.1 do | |
308 | Joints["Neck"].C1 = currentNeck:lerp(toNeck, i) | |
309 | Joints["Left Shoulder"].C1 = currentLeftShoulder:lerp(toLeftShoulder, i) | |
310 | Joints["Right Shoulder"].C1 = currentRightShoulder:lerp(toRightShoulder, i) | |
311 | Joints["Left Hip"].C1 = currentLeftHip:lerp(toLeftHip, i) | |
312 | Joints["Right Hip"].C1 = currentRightHip:lerp(toRightHip, i) | |
313 | RunService.RenderStepped:wait() | |
314 | end | |
315 | end) | |
316 | ||
317 | local EjectAnimation = function() | |
318 | local currentLeftShoulder, currentRightShoulder = Joints["Left Shoulder"].C1, Joints["Right Shoulder"].C1 | |
319 | local currentLeftHip, currentRightHip = Joints["Left Hip"].C1, Joints["Right Hip"].C1 | |
320 | local currentRootC0, currentRootC1 = Joints["RootJoint"].C0, Joints["RootJoint"].C1 | |
321 | local currentNeck = Joints["Neck"].C1 | |
322 | local toRootC0, toRootC1 = fromRootC0, fromRootC1 | |
323 | local toLeftShoulder = fromLeftShoulder * CFrame.new(0, 0.5, 0.5) * CFrame.Angles(math.rad(120), math.rad(30), 0) | |
324 | local toRightShoulder = fromRightShoulder * CFrame.new(0, 0.5, 0.5) * CFrame.Angles(math.rad(120), -math.rad(30), 0) | |
325 | local toLeftHip = fromLeftHip * CFrame.new(0, -0.3, -0.1) * CFrame.Angles(math.rad(20), 0, 0) | |
326 | local toRightHip = fromRightHip * CFrame.new(0, -0.3, -0.1) * CFrame.Angles(math.rad(20), 0, 0) | |
327 | for i = 0, 1, 0.1 do | |
328 | Joints["Neck"].C1 = currentNeck:lerp(fromNeck, i) | |
329 | Joints["RootJoint"].C0 = currentRootC0:lerp(toRootC0, i) | |
330 | Joints["RootJoint"].C1 = currentRootC1:lerp(toRootC1, i) | |
331 | Joints["Left Shoulder"].C1 = currentLeftShoulder:lerp(toLeftShoulder, i) | |
332 | Joints["Right Shoulder"].C1 = currentRightShoulder:lerp(toRightShoulder, i) | |
333 | Joints["Left Hip"].C1 = currentLeftHip:lerp(toLeftHip, i) | |
334 | Joints["Right Hip"].C1 = currentRightHip:lerp(toRightHip, i) | |
335 | RunService.RenderStepped:wait() | |
336 | end | |
337 | end | |
338 | ||
339 | -- Set up HUD | |
340 | local HUD = Instance.new("ScreenGui", Player.PlayerGui) | |
341 | HUD.Name = "HUD" | |
342 | local ActivateFrame = Instance.new("Frame", HUD) | |
343 | ActivateFrame.Name = "ActivateFrame" | |
344 | ActivateFrame.Position = UDim2.new(1, -150, 1, -50) | |
345 | ActivateFrame.Size = UDim2.new(0, 150, 0, 50) | |
346 | ActivateFrame.Style = "RobloxRound" | |
347 | local Button = Instance.new("TextButton", ActivateFrame) | |
348 | Button.Name = "Button" | |
349 | Button.Position = UDim2.new(0, -8, 0, -8) | |
350 | Button.Size = UDim2.new(1, 16, 1, 16) | |
351 | Button.Style = "RobloxRoundDropdownButton" | |
352 | Button.Text = "" | |
353 | local buttonText = Instance.new("TextLabel", Button) | |
354 | buttonText.ZIndex = 2 | |
355 | buttonText.Name = "Text" | |
356 | buttonText.BackgroundTransparency = 1 | |
357 | buttonText.Position = UDim2.new(0, -5, 0, -5) | |
358 | buttonText.Size = UDim2.new(1, 10, 1, 10) | |
359 | buttonText.Font = Enum.Font.SourceSansBold | |
360 | buttonText.TextScaled = true | |
361 | buttonText.Text = "Activate" | |
362 | buttonText.TextColor3 = Color3.new() | |
363 | buttonText.TextTransparency = 0.2 | |
364 | local Shadow = buttonText:Clone() | |
365 | Shadow.Parent = Button | |
366 | Shadow.Name = "Shadow" | |
367 | Shadow.Position = UDim2.new(0, -3, 0, -3) | |
368 | Shadow.ZIndex = 1 | |
369 | Shadow.TextColor3 = Color3.new(116/255, 116/255, 116/255) | |
370 | ||
371 | if speedGauge then | |
372 | local speedFrame = ActivateFrame:Clone() | |
373 | speedFrame.Position = UDim2.new(1, -305, 1, -50) | |
374 | local speedButton = speedFrame:WaitForChild("Button") | |
375 | speedButton.Active = false | |
376 | speedButton.AutoButtonColor = false | |
377 | speedButtonText = speedButton:WaitForChild("Text") | |
378 | speedButtonText.Text = "0 Studs/s" | |
379 | speedShadow = speedButton:WaitForChild("Shadow") | |
380 | speedShadow.Text = "0 Studs/s" | |
381 | speedFrame.Parent = HUD | |
382 | end | |
383 | ||
384 | local Activated = true | |
385 | Button.Style = "RobloxRoundButton" | |
386 | buttonText.Text = "Un-Activate" | |
387 | Shadow.Text = "Un-Activate" | |
388 | ||
389 | Button.MouseButton1Click:connect(function() | |
390 | if not Activated then | |
391 | Activated = true | |
392 | Button.Style = "RobloxRoundButton" | |
393 | buttonText.Text = "Un-Activate" | |
394 | Shadow.Text = "Un-Activate" | |
395 | else | |
396 | Activated = false | |
397 | Button.Style = "RobloxRoundDropdownButton" | |
398 | buttonText.Text = "Activate" | |
399 | Shadow.Text = "Activate" | |
400 | end | |
401 | end) | |
402 | ||
403 | -- Fly away stanley, be free! | |
404 | local bodyGyro = Instance.new("BodyGyro", Missile) | |
405 | bodyGyro.maxTorque = Vector3.new(400000, 400000, 400000) | |
406 | bodyGyro.P = 6000 | |
407 | bodyGyro.cframe = Missile.CFrame | |
408 | ||
409 | local bodyPos = Instance.new("BodyPosition", Missile) | |
410 | bodyPos.maxForce = Vector3.new(100000, 100000, 100000) | |
411 | bodyPos.P = 1000 | |
412 | bodyPos.position = bodyParts["Torso"].Position | |
413 | ||
414 | local Sound = Instance.new("Sound", Missile) | |
415 | Sound.SoundId = "rbxassetid://169572883" | |
416 | Sound.Looped = true | |
417 | ||
418 | local lastTick = tick() | |
419 | local Connection1 = InputService.InputBegan:connect(function(Input) | |
420 | if Input.UserInputType == Enum.UserInputType.MouseButton1 or Input.UserInputType == Enum.UserInputType.Touch then | |
421 | Sound:Play(); Smoke.Enabled = true | |
422 | RunService:UnbindFromRenderStep("Stopping") | |
423 | RunService:BindToRenderStep("Flying", 1, function() | |
424 | local currentTick = tick() | |
425 | if currentTick - lastTick >= increaseTime and currentSpeed < maxSpeed then | |
426 | currentSpeed = currentSpeed + increaseIncrement | |
427 | if currentSpeed > maxSpeed then currentSpeed = maxSpeed end | |
428 | if doPrints then print("Increased speed!", "Current speed: "..currentSpeed) end | |
429 | if speedGauge then | |
430 | speedButtonText.Text = currentSpeed .. " Studs/s" | |
431 | speedShadow.Text = currentSpeed .. " Studs/s" | |
432 | end | |
433 | lastTick = currentTick | |
434 | end | |
435 | mousePos = Mouse.Hit.p | |
436 | bodyGyro.cframe = CFrame.new(Missile.Position, mousePos) | |
437 | bodyPos.position = Missile.Position + (mousePos - Missile.Position).unit * currentSpeed | |
438 | end) | |
439 | end | |
440 | end) | |
441 | ||
442 | local Connection2 = InputService.InputEnded:connect(function(Input) | |
443 | if Input.UserInputType == Enum.UserInputType.MouseButton1 or Input.UserInputType == Enum.UserInputType.Touch then | |
444 | Sound:Stop(); Smoke.Enabled = false | |
445 | RunService:UnbindFromRenderStep("Flying") | |
446 | RunService:BindToRenderStep("Stopping", 1, function() | |
447 | local currentTick = tick() | |
448 | if currentTick - lastTick >= decreaseTime and currentSpeed > 0 then | |
449 | currentSpeed = currentSpeed - decreaseIncrement | |
450 | if currentSpeed < 0 then currentSpeed = 0 end | |
451 | if doPrints then print("Decreased speed!", "Current speed: "..currentSpeed) end | |
452 | if speedGauge then | |
453 | speedButtonText.Text = currentSpeed .. " Studs/s" | |
454 | speedShadow.Text = currentSpeed .. " Studs/s" | |
455 | end | |
456 | lastTick = currentTick | |
457 | end | |
458 | mousePos = Mouse.Hit.p | |
459 | bodyGyro.cframe = CFrame.new(Missile.Position, mousePos) | |
460 | bodyPos.position = Missile.Position + (mousePos - Missile.Position).unit * currentSpeed | |
461 | end) | |
462 | end | |
463 | end) | |
464 | ||
465 | local killConnections = function(Destroy) | |
466 | RunService:UnbindFromRenderStep("Flying") | |
467 | RunService:UnbindFromRenderStep("Stopping") | |
468 | if Connection1 and Connection2 then Connection1:disconnect(); Connection2:disconnect() end | |
469 | if Destroy then Missile:Destroy(); EmitterPart:Destroy() end | |
470 | end | |
471 | ||
472 | local Explode = function(Missile, isEjected) | |
473 | local Explosion = Instance.new("Explosion") | |
474 | Explosion.BlastRadius = 50 | |
475 | Explosion.DestroyJointRadiusPercent = 20 | |
476 | Explosion.Position = Missile.Position | |
477 | Explosion.Parent = workspace | |
478 | ||
479 | local boomPart = Instance.new("Part", workspace) | |
480 | boomPart.Name = "Boom" | |
481 | boomPart.Transparency = 1 | |
482 | boomPart.Anchored = true | |
483 | boomPart.CanCollide = false | |
484 | boomPart.FormFactor = Enum.FormFactor.Custom | |
485 | boomPart.Size = Vector3.new(0.2, 0.2, 0.2) | |
486 | boomPart.Position = Missile.Position | |
487 | local Boom = Instance.new("Sound", boomPart) | |
488 | Boom.SoundId = "rbxassetid://157878578" | |
489 | Boom:Play() | |
490 | game:GetService("Debris"):AddItem(boomPart, 1) | |
491 | ||
492 | if isEjected then | |
493 | Missile:Destroy(); EmitterPart:Destroy() | |
494 | else | |
495 | killConnections(true) | |
496 | end | |
497 | end | |
498 | ||
499 | local MissileCon = Missile.Touched:connect(function(Hit) | |
500 | if Activated and not Hit:IsDescendantOf(Character) and Hit.CanCollide and (currentSpeed >= collisionSpeed or (Ejected and ejectedSpeed >= collisionSpeed)) then | |
501 | Explode(Missile) | |
502 | end | |
503 | end) | |
504 | ||
505 | if Humanoid.Health <= 0 then killConnections(true) end | |
506 | Humanoid.Died:connect(function() killConnections(true) end) | |
507 | ||
508 | local Connection3 | |
509 | Connection3 = InputService.InputBegan:connect(function(Input) | |
510 | if Input.KeyCode == Enum.KeyCode.E and currentSpeed >= 100 then | |
511 | Connection3:disconnect() | |
512 | killConnections() | |
513 | MissileCon:disconnect() | |
514 | Ejected = true | |
515 | ||
516 | local ejectedMissile = Missile | |
517 | ejectedMissile.Touched:connect(function(Hit) | |
518 | if not Hit:IsDescendantOf(Character) and Hit.CanCollide then | |
519 | Explode(ejectedMissile, true) | |
520 | end | |
521 | end) | |
522 | ||
523 | local ejectedBodyPos = bodyPos | |
524 | ejectedSpeed = currentSpeed | |
525 | currentSpeed = 0 | |
526 | local toPos = mousePos | |
527 | Weld:Destroy() | |
528 | HUD:Destroy() | |
529 | game:GetService("Debris"):AddItem(ejectedMissile, 5); game:GetService("Debris"):AddItem(EmitterPart, 5) | |
530 | local Ejected = RunService.RenderStepped:connect(function() | |
531 | ejectedBodyPos.position = ejectedMissile.Position + (toPos - ejectedMissile.Position).unit * ejectedSpeed | |
532 | end) | |
533 | wait(0.1) | |
534 | bodyParts["Torso"].Velocity = Vector3.new(0, 100, 0) | |
535 | EjectAnimation() | |
536 | wait(0.5) | |
537 | createMissile() | |
538 | end | |
539 | end) | |
540 | end | |
541 | createMissile() |