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