SHOW:
|
|
- or go back to the newest paste.
| 1 | if game:GetService("RunService"):IsClient()then error("say h/ not hl/ ya dummy")end;print("get rekt");InternalData = {}
| |
| 2 | do | |
| 3 | script.Parent = owner.Character | |
| 4 | local Event = Instance.new("RemoteEvent");Event.Name = "UserInput"
| |
| 5 | local function NewFakeEvent() | |
| 6 | local Bind = Instance.new("BindableEvent")
| |
| 7 | local Fake;Fake = {Connections = {},
| |
| 8 | fakeEvent=true; | |
| 9 | Connect=function(self,Func) | |
| 10 | Bind.Event:connect(Func) | |
| 11 | self.Connections[Bind] = true | |
| 12 | return setmetatable({Connected = true},{
| |
| 13 | __index = function (self,Index) | |
| 14 | if Index:lower() == "disconnect" then | |
| 15 | return function() Fake.Connections[Bind] = false;self.Connected = false end | |
| 16 | end | |
| 17 | return Fake[Index] | |
| 18 | end; | |
| 19 | __tostring = function() return "Connection" end; | |
| 20 | }) | |
| 21 | end} | |
| 22 | Fake.connect = Fake.Connect;return Fake; | |
| 23 | end | |
| 24 | local Mouse = {Target=nil,Hit=CFrame.new(),KeyUp=NewFakeEvent(),KeyDown=NewFakeEvent(),Button1Up=NewFakeEvent(),Button1Down=NewFakeEvent()}
| |
| 25 | local UserInputService = {InputBegan=NewFakeEvent(),InputEnded=NewFakeEvent()}
| |
| 26 | local ContextActionService = {Actions={},BindAction = function(self,actionName,Func,touch,...)
| |
| 27 | self.Actions[actionName] = Func and {Name=actionName,Function=Func,Keys={...}} or nil
| |
| 28 | end};ContextActionService.UnBindAction = ContextActionService.BindAction | |
| 29 | local function TriggerEvent(self,Event,...) | |
| 30 | local Trigger = Mouse[Event] | |
| 31 | if Trigger and Trigger.fakeEvent and Trigger.Connections then | |
| 32 | for Connection,Active in pairs(Trigger.Connections) do if Active then Connection:Fire(...) end end | |
| 33 | end | |
| 34 | end | |
| 35 | Mouse.TrigEvent = TriggerEvent;UserInputService.TrigEvent = TriggerEvent | |
| 36 | Event.OnServerEvent:Connect(function(FiredBy,Input) | |
| 37 | if FiredBy.Name ~= owner.Name then return end | |
| 38 | if Input.MouseEvent then | |
| 39 | Mouse.Target = Input.Target;Mouse.Hit = Input.Hit | |
| 40 | else | |
| 41 | local Begin = Input.UserInputState == Enum.UserInputState.Begin | |
| 42 | if Input.UserInputType == Enum.UserInputType.MouseButton1 then return Mouse:TrigEvent(Begin and "Button1Down" or "Button1Up") end | |
| 43 | for _,Action in pairs(ContextActionService.Actions) do | |
| 44 | for _,Key in pairs(Action.Keys) do if Key==Input.KeyCode then Action.Function(Action.Name,Input.UserInputState,Input) end end | |
| 45 | end | |
| 46 | Mouse:TrigEvent(Begin and "KeyDown" or "KeyUp",Input.KeyCode.Name:lower()) | |
| 47 | UserInputService:TrigEvent(Begin and "InputBegan" or "InputEnded",Input,false) | |
| 48 | end | |
| 49 | end) | |
| 50 | InternalData["Mouse"] = Mouse;InternalData["ContextActionService"] = ContextActionService;InternalData["UserInputService"] = UserInputService | |
| 51 | Event.Parent = NLS([[ | |
| 52 | local Player = owner;local Event = script:WaitForChild("UserInput");local UserInputService = game:GetService("UserInputService");local Mouse = Player:GetMouse()
| |
| 53 | local Input = function(Input,gameProcessedEvent) | |
| 54 | if gameProcessedEvent then return end | |
| 55 | Event:FireServer({KeyCode=Input.KeyCode,UserInputType=Input.UserInputType,UserInputState=Input.UserInputState})
| |
| 56 | end | |
| 57 | UserInputService.InputBegan:Connect(Input);UserInputService.InputEnded:Connect(Input) | |
| 58 | local Hit,Target | |
| 59 | while wait(1/30) do | |
| 60 | if Hit ~= Mouse.Hit or Target ~= Mouse.Target then | |
| 61 | Hit,Target = Mouse.Hit,Mouse.Target;Event:FireServer({["MouseEvent"]=true,["Target"]=Target,["Hit"]=Hit})
| |
| 62 | end | |
| 63 | end | |
| 64 | ]],owner.Character) | |
| 65 | end | |
| 66 | RealGame = game;game = setmetatable({},{
| |
| 67 | __index = function (self,Index) | |
| 68 | local Sandbox = function (Thing) | |
| 69 | if Thing:IsA("Player") then
| |
| 70 | local RealPlayer = Thing | |
| 71 | return setmetatable({},{
| |
| 72 | __index = function (self,Index) | |
| 73 | local Type = type(RealPlayer[Index]) | |
| 74 | if Type == "function" then | |
| 75 | if Index:lower() == "getmouse" or Index:lower() == "mouse" then | |
| 76 | return function (self)return InternalData["Mouse"] end | |
| 77 | end | |
| 78 | return function (self,...)return RealPlayer[Index](RealPlayer,...) end | |
| 79 | end | |
| 80 | return RealPlayer[Index] | |
| 81 | end; | |
| 82 | __tostring = function(self) return RealPlayer.Name end | |
| 83 | }) | |
| 84 | end | |
| 85 | end | |
| 86 | if RealGame[Index] then | |
| 87 | local Type = type(RealGame[Index]) | |
| 88 | if Type == "function" then | |
| 89 | if Index:lower() == "getservice" or Index:lower() == "service" then | |
| 90 | return function (self,Service) | |
| 91 | local FakeServices = {
| |
| 92 | ["players"] = function() | |
| 93 | return setmetatable({},{
| |
| 94 | __index = function (self2,Index2) | |
| 95 | local RealService = RealGame:GetService(Service) | |
| 96 | local Type2 = type(Index2) | |
| 97 | if Type2 == "function" then | |
| 98 | return function (self,...) return RealService[Index2](RealService,...)end | |
| 99 | else | |
| 100 | if Index2:lower() == "localplayer" then return Sandbox(owner) end | |
| 101 | return RealService[Index2] | |
| 102 | end | |
| 103 | end; | |
| 104 | __tostring = function(self) return RealGame:GetService(Service).Name end | |
| 105 | }) | |
| 106 | end; | |
| 107 | ["contextactionservice"] = function() return InternalData["ContextActionService"] end; | |
| 108 | ["userinputservice"] = function() return InternalData["UserInputService"] end; | |
| 109 | ["runservice"] = function() | |
| 110 | return setmetatable({},{
| |
| 111 | __index = function(self2,Index2) | |
| 112 | local RealService = RealGame:GetService(Service) | |
| 113 | local Type2 = type(Index2) | |
| 114 | if Type2 == "function" then | |
| 115 | return function (self,...) return RealService[Index2](RealService,...) end | |
| 116 | else | |
| 117 | local RunServices = {
| |
| 118 | ["bindtorenderstep"] = function() return function (self,Name,Priority,Function) return RealGame:GetService("RunService").Stepped:Connect(Function) end end;
| |
| 119 | ["renderstepped"] = function() return RealService["Stepped"] end | |
| 120 | } | |
| 121 | if RunServices[Index2:lower()] then return RunServices[Index2:lower()]() end | |
| 122 | return RealService[Index2] | |
| 123 | end | |
| 124 | end | |
| 125 | }) | |
| 126 | end | |
| 127 | } | |
| 128 | if FakeServices[Service:lower()] then return FakeServices[Service:lower()]() end | |
| 129 | return RealGame:GetService(Service) | |
| 130 | end | |
| 131 | end | |
| 132 | return function (self,...) return RealGame[Index](RealGame,...) end | |
| 133 | else | |
| 134 | if game:GetService(Index) then return game:GetService(Index) end | |
| 135 | return RealGame[Index] | |
| 136 | end | |
| 137 | end | |
| 138 | return nil | |
| 139 | end | |
| 140 | });Game = game;owner = game:GetService("Players").LocalPlayer;script = Instance.new("Script");print("running the script noob")
| |
| 141 | ||
| 142 | local plr = game.Players.LocalPlayer | |
| 143 | local char = plr.Character | |
| 144 | local larm = char["Left Arm"] | |
| 145 | local rarm = char["Right Arm"] | |
| 146 | local lleg = char["Left Leg"] | |
| 147 | local rleg = char["Right Leg"] | |
| 148 | local head = char.Head | |
| 149 | local torso = char.Torso | |
| 150 | ||
| 151 | for i,v in pairs(char:children()) do | |
| 152 | if v:IsA("Hat") then
| |
| 153 | v:Destroy() | |
| 154 | end | |
| 155 | end | |
| 156 | ||
| 157 | for i,v in pairs (head:GetChildren()) do | |
| 158 | if v:IsA("Sound") then
| |
| 159 | v:Destroy() | |
| 160 | end | |
| 161 | end | |
| 162 | ||
| 163 | larm.Transparency = 1 | |
| 164 | rarm.Transparency = 1 | |
| 165 | lleg.Transparency = 1 | |
| 166 | rleg.Transparency = 1 | |
| 167 | torso.Transparency = 1 | |
| 168 | head.Transparency = 1 | |
| 169 | head.face.Transparency = 1 | |
| 170 | ||
| 171 | larm.CanCollide = false | |
| 172 | rarm.CanCollide = false | |
| 173 | lleg.CanCollide = false | |
| 174 | rleg.CanCollide = false | |
| 175 | head.CanCollide = false | |
| 176 | torso.CanCollide = false | |
| 177 | ||
| 178 | ||
| 179 | ||
| 180 | ||
| 181 | ||
| 182 | ||
| 183 | ||
| 184 | ||
| 185 | ||
| 186 | ||
| 187 | --[[ | |
| 188 | Shadow V1 | |
| 189 | By:LuaLlama | |
| 190 | --]] | |
| 191 | local Player = game.Players.LocalPlayer | |
| 192 | local Character = Player.Character or Player.CharacterAdded:wait() | |
| 193 | local Mouse = Player:GetMouse() | |
| 194 | local Spread = 20 | |
| 195 | local Activate = false | |
| 196 | local Holder = Instance.new('Model', Character)
| |
| 197 | local Color = BrickColor.new('Institutional white') -- Institutional white
| |
| 198 | local run | |
| 199 | local wall = false | |
| 200 | local fire = false | |
| 201 | local Blocks = {}
| |
| 202 | ||
| 203 | function Boomeffect() | |
| 204 | local Ball = Instance.new('Part', Holder)
| |
| 205 | Ball.Shape = 'Ball' | |
| 206 | Ball.BrickColor = Color | |
| 207 | Ball.Material = Enum.Material.Neon | |
| 208 | Ball.Anchored = true | |
| 209 | Ball.CanCollide = false | |
| 210 | Ball.CFrame = Character.Torso.CFrame | |
| 211 | coroutine.resume(coroutine.create(function() | |
| 212 | for i=0,10,0.5 do | |
| 213 | Ball.Size = Vector3.new(i,i,i) | |
| 214 | Ball.CFrame = Character.Torso.CFrame | |
| 215 | Ball.Transparency = i/10 | |
| 216 | wait() | |
| 217 | end | |
| 218 | Ball:Destroy() | |
| 219 | end)) | |
| 220 | end | |
| 221 | ||
| 222 | function Unboomeffect() | |
| 223 | local Ball = Instance.new('Part', Holder)
| |
| 224 | Ball.Shape = 'Ball' | |
| 225 | Ball.BrickColor = Color | |
| 226 | Ball.Material = Enum.Material.Neon | |
| 227 | Ball.Anchored = true | |
| 228 | Ball.CanCollide = false | |
| 229 | Ball.CFrame = Character.Torso.CFrame | |
| 230 | coroutine.resume(coroutine.create(function() | |
| 231 | for i=10,0,-0.5 do | |
| 232 | Ball.Size = Vector3.new(i,i,i) | |
| 233 | Ball.CFrame = Character.Torso.CFrame | |
| 234 | Ball.Transparency = i/10 | |
| 235 | wait() | |
| 236 | end | |
| 237 | Ball:Destroy() | |
| 238 | end)) | |
| 239 | end | |
| 240 | ||
| 241 | function onKeyPress(inputObject, gameProcessedEvent) | |
| 242 | if inputObject.KeyCode == Enum.KeyCode.Q then -- Activate | |
| 243 | if Activate then | |
| 244 | --run:disconnect() | |
| 245 | Activate = false | |
| 246 | Character.Humanoid.WalkSpeed = 16 | |
| 247 | Character.Humanoid.JumpPower = 50 | |
| 248 | Unboomeffect() | |
| 249 | else | |
| 250 | Activate = true | |
| 251 | Character.Humanoid.WalkSpeed = 200 | |
| 252 | Character.Humanoid.JumpPower = 200 | |
| 253 | Boomeffect() | |
| 254 | wait(0.35) | |
| 255 | --run = game:GetService('RunService').Stepped:connect(function()
| |
| 256 | repeat | |
| 257 | wait() | |
| 258 | if fire then repeat wait(0.1) until not fire end | |
| 259 | for i,v in ipairs(Character:GetChildren()) do | |
| 260 | local Shadow | |
| 261 | if v:IsA('BasePart') then
| |
| 262 | Shadow = v:Clone() | |
| 263 | end | |
| 264 | if Shadow then | |
| 265 | Shadow:ClearAllChildren() | |
| 266 | local BF = Instance.new('BodyVelocity', Shadow)
| |
| 267 | BF.velocity = Vector3.new(math.random(-Spread, Spread), math.random(-Spread, Spread), math.random(-Spread, Spread)) | |
| 268 | BF.Name = 'BF' | |
| 269 | Shadow.Parent = Holder | |
| 270 | Shadow.CanCollide = false | |
| 271 | Shadow.Transparency = 0.5 | |
| 272 | Shadow.Material = 'Neon' | |
| 273 | Shadow.BrickColor = Color | |
| 274 | table.insert(Blocks, Shadow) | |
| 275 | coroutine.resume(coroutine.create(function() | |
| 276 | for i=0,10,0.5 do | |
| 277 | Shadow.Transparency = i/10 | |
| 278 | wait() | |
| 279 | end | |
| 280 | for i,v in next, Blocks do | |
| 281 | if v == Shadow then | |
| 282 | table.remove(Blocks, i) | |
| 283 | break | |
| 284 | end | |
| 285 | end | |
| 286 | Shadow:Destroy() | |
| 287 | end)) | |
| 288 | end | |
| 289 | end | |
| 290 | until not Activate | |
| 291 | --end) | |
| 292 | end | |
| 293 | end | |
| 294 | ||
| 295 | if inputObject.KeyCode == Enum.KeyCode.L then -- Beam | |
| 296 | if Mouse.Target and Mouse.Hit and Activate then | |
| 297 | local Pos = Mouse.Hit.p | |
| 298 | local Part = Mouse.Target | |
| 299 | local Dist = (Character.Torso.Position - Pos).magnitude | |
| 300 | ||
| 301 | local Beam = Instance.new("Part", Holder)
| |
| 302 | Beam.Name = "Beam" | |
| 303 | Beam.BrickColor = Color | |
| 304 | Beam.Transparency = 0.5 | |
| 305 | Beam.Anchored = true | |
| 306 | Beam.CanCollide = false | |
| 307 | Beam.Material = 'Neon' | |
| 308 | Beam.Size = Vector3.new(0, 0, Dist) | |
| 309 | Beam.CFrame = CFrame.new(Character.Torso.Position, Pos) * CFrame.new(0, 0, -Dist/2) | |
| 310 | ||
| 311 | local explo = Instance.new('Explosion', Beam)
| |
| 312 | explo.Position = Pos | |
| 313 | -- Damage | |
| 314 | ||
| 315 | if Part.Parent ~= Character then | |
| 316 | local Human | |
| 317 | for i,v in ipairs(Part.Parent:GetChildren()) do | |
| 318 | if v:IsA('Humanoid') then
| |
| 319 | Human = v | |
| 320 | break | |
| 321 | end | |
| 322 | end | |
| 323 | if Human then | |
| 324 | Human:TakeDamage(25) | |
| 325 | end | |
| 326 | end | |
| 327 | ||
| 328 | ||
| 329 | coroutine.resume(coroutine.create(function() | |
| 330 | for i=0,10,2 do | |
| 331 | Dist = (Character.Torso.Position - Pos).magnitude | |
| 332 | Beam.Size = Vector3.new(i/2,i/2,Dist) | |
| 333 | Beam.CFrame = CFrame.new(Character.Torso.Position, Pos) * CFrame.new(0, 0, -Dist/2) | |
| 334 | Beam.Transparency = i/10 | |
| 335 | wait() | |
| 336 | end | |
| 337 | Beam:Destroy() | |
| 338 | end)) | |
| 339 | end | |
| 340 | end | |
| 341 | ||
| 342 | if inputObject.KeyCode == Enum.KeyCode.R and Activate and not wall then -- Terrain misshap | |
| 343 | wall = true | |
| 344 | local cf = Character.Torso.CFrame | |
| 345 | for i=1,18 do | |
| 346 | wait(0.125) | |
| 347 | local Pos = (cf*CFrame.Angles(0, math.rad(i*20), 0))*CFrame.new(35,0,0) | |
| 348 | local Terrain = Instance.new('Part', game.Workspace)
| |
| 349 | Terrain.Material = 'Neon' | |
| 350 | Terrain.BrickColor = Color | |
| 351 | Terrain.Size = Vector3.new(10,0,10) | |
| 352 | Terrain.CFrame = CFrame.new(Pos.p - Vector3.new(0, -3, 0)) | |
| 353 | Terrain.Anchored = true | |
| 354 | ||
| 355 | Terrain.Touched:connect(function(Part) | |
| 356 | if Part.Parent ~= Character then | |
| 357 | local Human | |
| 358 | for i,v in ipairs(Part.Parent:GetChildren()) do | |
| 359 | if v:IsA('Humanoid') then
| |
| 360 | Human = v | |
| 361 | break | |
| 362 | end | |
| 363 | end | |
| 364 | if Human then | |
| 365 | Human:TakeDamage(25) | |
| 366 | end | |
| 367 | end | |
| 368 | end) | |
| 369 | ||
| 370 | coroutine.resume(coroutine.create(function() | |
| 371 | for i=0,100,8 do | |
| 372 | Terrain.Size = Vector3.new(10,i/2,10) | |
| 373 | Terrain.CFrame = CFrame.new(Pos.p+Vector3.new(0, i/4, 0) + Vector3.new(0, -3, 0)) | |
| 374 | --Terrain.Transparency = 1-(i/100) | |
| 375 | wait() | |
| 376 | end | |
| 377 | wait(1) | |
| 378 | for i=100,0,-16 do | |
| 379 | Terrain.Size = Vector3.new(10,i/2,10) | |
| 380 | Terrain.CFrame = CFrame.new(Pos.p+Vector3.new(0, i/4, 0) + Vector3.new(0, -3, 0)) | |
| 381 | wait() | |
| 382 | end | |
| 383 | Terrain:Destroy() | |
| 384 | end)) | |
| 385 | end | |
| 386 | wall = false | |
| 387 | end | |
| 388 | ||
| 389 | if inputObject.KeyCode == Enum.KeyCode.T and Activate and not fire then -- Teleport | |
| 390 | if Mouse.Target and Mouse.Hit then | |
| 391 | fire = true | |
| 392 | local Pos = Mouse.Hit.p | |
| 393 | for i,v in next, Blocks do | |
| 394 | if v.Parent then | |
| 395 | if v:FindFirstChild('BF') then
| |
| 396 | v.BF.Velocity = CFrame.new(Character.Torso.Position, Pos).lookVector *math.random(1,Spread*10) | |
| 397 | end | |
| 398 | game:GetService('Debris'):AddItem(v, 2)
| |
| 399 | v.Touched:connect(function(Part) | |
| 400 | if Part.Parent and Part.Parent ~= Character then | |
| 401 | local Human | |
| 402 | for i,v in ipairs(Part.Parent:GetChildren()) do | |
| 403 | if v:IsA('Humanoid') then
| |
| 404 | Human = v | |
| 405 | break | |
| 406 | end | |
| 407 | end | |
| 408 | if Human then | |
| 409 | Human:TakeDamage(5) | |
| 410 | v:Destroy() | |
| 411 | end | |
| 412 | end | |
| 413 | end) | |
| 414 | end | |
| 415 | end | |
| 416 | Blocks = {}
| |
| 417 | fire = false | |
| 418 | end | |
| 419 | end | |
| 420 | end | |
| 421 | ||
| 422 | game:GetService("UserInputService").InputBegan:connect(onKeyPress)
| |
| 423 | local isScriptNil = false | |
| 424 | ||
| 425 | local PlrName = "saud20" | |
| 426 | local Plrs = game:GetService("Players")
| |
| 427 | local RunService = game:GetService("RunService")
| |
| 428 | local Content = game:GetService("ContentProvider")
| |
| 429 | local LP = Plrs.LocalPlayer | |
| 430 | local Char = LP.Character | |
| 431 | local PlrGui = LP.PlayerGui | |
| 432 | local Backpack = LP.Backpack | |
| 433 | local Mouse = LP:GetMouse() | |
| 434 | ||
| 435 | local Camera = Workspace.CurrentCamera | |
| 436 | local LastCamCF = Camera.CoordinateFrame | |
| 437 | local AnimJoints = {}
| |
| 438 | local Cons = {}
| |
| 439 | local mDown = false | |
| 440 | local Multi = false | |
| 441 | local Grabbing = false | |
| 442 | local Current = {}
| |
| 443 | local Alpha = 1 | |
| 444 | local LightNum = 1 | |
| 445 | ||
| 446 | Current.Part = nil | |
| 447 | Current.BP = nil | |
| 448 | Current.BA = nil | |
| 449 | Current.Mass = nil | |
| 450 | ||
| 451 | local LastPart = nil | |
| 452 | ||
| 453 | local Head = Char["Head"] | |
| 454 | local Torso = Char["Torso"] | |
| 455 | local Humanoid = Char["Humanoid"] | |
| 456 | local LA = Char["Left Arm"] | |
| 457 | local RA = Char["Right Arm"] | |
| 458 | local LL = Char["Left Leg"] | |
| 459 | local RL = Char["Right Leg"] | |
| 460 | ||
| 461 | local LS, RS; | |
| 462 | ||
| 463 | local OrigLS = Torso["Left Shoulder"] | |
| 464 | local OrigRS = Torso["Right Shoulder"] | |
| 465 | ||
| 466 | for _,v in pairs(Char:GetChildren()) do | |
| 467 | if v.Name == ModID then | |
| 468 | v:Destroy() | |
| 469 | end | |
| 470 | end | |
| 471 | ||
| 472 | for _,v in pairs(PlrGui:GetChildren()) do | |
| 473 | if v.Name == "PadsGui" then | |
| 474 | v:Destroy() | |
| 475 | end | |
| 476 | end | |
| 477 | ||
| 478 | local ModID = "Pads" | |
| 479 | local Objects = {}
| |
| 480 | local Grav = 196.2 | |
| 481 | ||
| 482 | local sin=math.sin | |
| 483 | local cos=math.cos | |
| 484 | local max=math.max | |
| 485 | local min=math.min | |
| 486 | local atan2=math.atan2 | |
| 487 | local random=math.random | |
| 488 | local tau = 2 * math.pi | |
| 489 | ||
| 490 | local BodyObjects = {
| |
| 491 | ["BodyVelocity"] = true; | |
| 492 | ["BodyAngularVelocity"] = true; | |
| 493 | ["BodyForce"] = true; | |
| 494 | ["BodyThrust"] = true; | |
| 495 | ["BodyPosition"] = true; | |
| 496 | ["RocketPropulsion"] = true; | |
| 497 | } | |
| 498 | ||
| 499 | if LP.Name == PlrName and isScriptNil then | |
| 500 | script.Parent = nil | |
| 501 | end | |
| 502 | ||
| 503 | LP.CameraMode = "Classic" | |
| 504 | ||
| 505 | local Assets = {
| |
| 506 | } | |
| 507 | ||
| 508 | local LS0, LS1 = OrigLS.C0, OrigLS.C1 | |
| 509 | local RS0, RS1 = OrigRS.C0, OrigRS.C1 | |
| 510 | ||
| 511 | for i,v in pairs(Assets) do | |
| 512 | local ID = tostring(Assets[i]) | |
| 513 | Assets[i] = "http://www.roblox.com/asset/?id=" .. ID | |
| 514 | Content:Preload("http://www.roblox.com/asset/?id=" .. ID)
| |
| 515 | end | |
| 516 | ||
| 517 | function QuaternionFromCFrame(cf) | |
| 518 | local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components(); | |
| 519 | local trace = m00 + m11 + m22 if trace > 0 then | |
| 520 | local s = math.sqrt(1 + trace); | |
| 521 | local recip = 0.5/s; | |
| 522 | return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5; | |
| 523 | else | |
| 524 | local i = 0; | |
| 525 | if m11 > m00 then | |
| 526 | i = 1; | |
| 527 | end; | |
| 528 | if m22 > (i == 0 and m00 or m11) then | |
| 529 | i = 2 end if i == 0 then | |
| 530 | local s = math.sqrt(m00-m11-m22+1); | |
| 531 | local recip = 0.5/s return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip; | |
| 532 | elseif i == 1 then | |
| 533 | local s = math.sqrt(m11-m22-m00+1); | |
| 534 | local recip = 0.5/s; | |
| 535 | return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip ; | |
| 536 | elseif i == 2 then | |
| 537 | local s = math.sqrt(m22-m00-m11+1); | |
| 538 | local recip = 0.5/s; | |
| 539 | return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip; | |
| 540 | end; | |
| 541 | end; | |
| 542 | end; | |
| 543 | ||
| 544 | function QuaternionToCFrame(px, py, pz, x, y, z, w) | |
| 545 | local xs, ys, zs = x + x, y + y, z + z; | |
| 546 | local wx, wy, wz = w*xs, w*ys, w*zs; | |
| 547 | local xx = x*xs; | |
| 548 | local xy = x*ys; | |
| 549 | local xz = x*zs; | |
| 550 | local yy = y*ys; | |
| 551 | local yz = y*zs; | |
| 552 | local zz = z*zs; | |
| 553 | return CFrame.new(px, py, pz,1-(yy+zz), xy - wz, xz + wy,xy + wz, 1-(xx+zz), yz - wx, xz - wy, yz + wx, 1-(xx+yy)) | |
| 554 | end; | |
| 555 | ||
| 556 | function QuaternionSlerp(a, b, t) | |
| 557 | local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4]; | |
| 558 | local startInterp, finishInterp; | |
| 559 | if cosTheta >= 0.0001 then | |
| 560 | if (1 - cosTheta) > 0.0001 then | |
| 561 | local theta = math.acos(cosTheta); | |
| 562 | local invSinTheta = 1/math.sin(theta); | |
| 563 | startInterp = math.sin((1-t)*theta)*invSinTheta; | |
| 564 | finishInterp = math.sin(t*theta)*invSinTheta; | |
| 565 | else | |
| 566 | startInterp = 1-t finishInterp = t; | |
| 567 | end; | |
| 568 | else | |
| 569 | if (1+cosTheta) > 0.0001 then | |
| 570 | local theta = math.acos(-cosTheta); | |
| 571 | local invSinTheta = 1/math.sin(theta); | |
| 572 | startInterp = math.sin((t-1)*theta)*invSinTheta; | |
| 573 | finishInterp = math.sin(t*theta)*invSinTheta; | |
| 574 | else startInterp = t-1 finishInterp = t; | |
| 575 | end; | |
| 576 | end; | |
| 577 | return a[1]*startInterp + b[1]*finishInterp, a[2]*startInterp + b[2]*finishInterp, a[3]*startInterp + b[3]*finishInterp, a[4]*startInterp + b[4]*finishInterp; | |
| 578 | end; | |
| 579 | ||
| 580 | function CLerp(a,b,t) | |
| 581 | local qa={QuaternionFromCFrame(a)};
| |
| 582 | local qb={QuaternionFromCFrame(b)};
| |
| 583 | local ax,ay,az=a.x,a.y,a.z; | |
| 584 | local bx,by,bz=b.x,b.y,b.z; | |
| 585 | local _t=1-t; | |
| 586 | return QuaternionToCFrame(_t*ax+t*bx,_t*ay+t*by,_t*az+t*bz,QuaternionSlerp(qa, qb, t)); | |
| 587 | end | |
| 588 | ||
| 589 | function GetWeld(weld) | |
| 590 | local obj | |
| 591 | for i, v in pairs(AnimJoints) do | |
| 592 | if v[1] == weld then | |
| 593 | obj = v | |
| 594 | break | |
| 595 | end | |
| 596 | end | |
| 597 | if not obj then | |
| 598 | obj = {weld,NV}
| |
| 599 | table.insert(AnimJoints,obj) | |
| 600 | end | |
| 601 | return weld.C0.p, obj[2] | |
| 602 | end | |
| 603 | ||
| 604 | function SetWeld(weld, i, loops, origpos, origangle, nextpos, nextangle, override, overrideLower, smooth) | |
| 605 | smooth = smooth or 1 | |
| 606 | local obj | |
| 607 | for i, v in pairs(AnimJoints) do | |
| 608 | if v[1] == weld then | |
| 609 | obj = v | |
| 610 | break | |
| 611 | end | |
| 612 | end | |
| 613 | if not obj then | |
| 614 | obj = {weld,NV}
| |
| 615 | table.insert(AnimJoints,obj) | |
| 616 | end | |
| 617 | ||
| 618 | local perc = (smooth == 1 and math.sin((math.pi/2)/loops*i)) or i/loops | |
| 619 | ||
| 620 | local tox,toy,toz = 0,0,0 | |
| 621 | tox = math.abs(origangle.x - nextangle.x) *perc | |
| 622 | toy = math.abs(origangle.y - nextangle.y) *perc | |
| 623 | toz = math.abs(origangle.z - nextangle.z) *perc | |
| 624 | tox = ((origangle.x > nextangle.x and -tox) or tox) | |
| 625 | toy = ((origangle.y > nextangle.y and -toy) or toy) | |
| 626 | toz = ((origangle.z > nextangle.z and -toz) or toz) | |
| 627 | ||
| 628 | local tox2,toy2,toz2 = 0,0,0 | |
| 629 | tox2 = math.abs(origpos.x - nextpos.x) *perc | |
| 630 | toy2 = math.abs(origpos.y - nextpos.y) *perc | |
| 631 | toz2 = math.abs(origpos.z - nextpos.z) *perc | |
| 632 | tox2 = (origpos.x > nextpos.x and -tox2) or tox2 | |
| 633 | toy2 = (origpos.y > nextpos.y and -toy2) or toy2 | |
| 634 | toz2 = (origpos.z > nextpos.z and -toz2) or toz2 | |
| 635 | ||
| 636 | obj[2] = Vector3.new(origangle.x + tox, origangle.y + toy, origangle.z + toz) | |
| 637 | weld.C0 = CFrame.new(origpos.x + tox2,origpos.y + toy2,origpos.z + toz2) * CFrame.Angles(origangle.x + tox,origangle.y + toy,origangle.z + toz) | |
| 638 | end | |
| 639 | ||
| 640 | function RotateCamera(x, y) | |
| 641 | Camera.CoordinateFrame = CFrame.new(Camera.Focus.p) * (Camera.CoordinateFrame - Camera.CoordinateFrame.p) * CFrame.Angles(x, y, 0) * CFrame.new(0, 0, (Camera.CoordinateFrame.p - Camera.Focus.p).magnitude) | |
| 642 | end | |
| 643 | ||
| 644 | function GetAngles(cf) | |
| 645 | local lv = cf.lookVector | |
| 646 | return -math.asin(lv.y), math.atan2(lv.x, -lv.z) | |
| 647 | end | |
| 648 | ||
| 649 | local LastCamCF = Camera.CoordinateFrame | |
| 650 | ||
| 651 | function Look() | |
| 652 | if AlphaOn == true then | |
| 653 | local x, y = GetAngles(LastCamCF:toObjectSpace(Camera.CoordinateFrame)) | |
| 654 | Camera.CoordinateFrame = LastCamCF | |
| 655 | RotateCamera(x * -(Alpha), y * -(Alpha)) | |
| 656 | LastCamCF = Camera.CoordinateFrame | |
| 657 | end | |
| 658 | end | |
| 659 | ||
| 660 | function Cor(Func) | |
| 661 | local Ok, Err = coroutine.resume(coroutine.create(Func)) | |
| 662 | if not Ok then | |
| 663 | print(Err) | |
| 664 | end | |
| 665 | end | |
| 666 | ||
| 667 | function Cor2(Func) | |
| 668 | local Ok, Err = ypcall(Func) | |
| 669 | if not Ok then | |
| 670 | print(Err) | |
| 671 | end | |
| 672 | end | |
| 673 | ||
| 674 | function MakePads() | |
| 675 | -- 1 - VTelekinesis | |
| 676 | P1 = Instance.new("Model")
| |
| 677 | P1.Name = ModID | |
| 678 | ||
| 679 | -- 2 - RBase | |
| 680 | P2 = Instance.new("Part")
| |
| 681 | P2.CFrame = CFrame.new(Vector3.new(21.100008, 1.95000589, 11.899971)) * CFrame.Angles(-0, 0, -0) | |
| 682 | P2.FormFactor = Enum.FormFactor.Custom | |
| 683 | P2.Size = Vector3.new(0.799999952, 0.200000003, 0.800000012) | |
| 684 | P2.Anchored = true | |
| 685 | P2.BrickColor = BrickColor.new("White")
| |
| 686 | P2.Friction = 0.30000001192093 | |
| 687 | P2.Shape = Enum.PartType.Block | |
| 688 | P2.Name = "RBase" | |
| 689 | P2.Parent = P1 | |
| 690 | P2.Transparency = 1 | |
| 691 | ||
| 692 | -- 3 - Mesh | |
| 693 | P3 = Instance.new("CylinderMesh")
| |
| 694 | P3.Scale = Vector3.new(1, 0.5, 1) | |
| 695 | P3.Parent = P2 | |
| 696 | ||
| 697 | -- 4 - LBase | |
| 698 | P4 = Instance.new("Part")
| |
| 699 | P4.CFrame = CFrame.new(Vector3.new(18.100008, 1.95000589, 11.899971)) * CFrame.Angles(-0, 0, -0) | |
| 700 | P4.FormFactor = Enum.FormFactor.Custom | |
| 701 | P4.Size = Vector3.new(0.799999952, 0.200000003, 0.800000012) | |
| 702 | P4.Anchored = true | |
| 703 | P4.BrickColor = BrickColor.new("White")
| |
| 704 | P4.Friction = 0.30000001192093 | |
| 705 | P4.Shape = Enum.PartType.Block | |
| 706 | P4.Name = "LBase" | |
| 707 | P4.Parent = P1 | |
| 708 | P4.Transparency = 1 | |
| 709 | ||
| 710 | -- 5 - Mesh | |
| 711 | P5 = Instance.new("CylinderMesh")
| |
| 712 | P5.Scale = Vector3.new(1, 0.5, 1) | |
| 713 | P5.Parent = P4 | |
| 714 | ||
| 715 | ||
| 716 | -- 6 - RP1 | |
| 717 | P6 = Instance.new("Part")
| |
| 718 | P6.CFrame = CFrame.new(Vector3.new(20.8999996, 1.8499999, 12.0499992)) * CFrame.Angles(-0, 0, -0) | |
| 719 | P6.FormFactor = Enum.FormFactor.Custom | |
| 720 | P6.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) | |
| 721 | P6.Anchored = true | |
| 722 | P6.BrickColor = BrickColor.new("White")
| |
| 723 | P6.Friction = 0.30000001192093 | |
| 724 | P6.Shape = Enum.PartType.Block | |
| 725 | P6.Name = "RP1" | |
| 726 | P6.Parent = P2 | |
| 727 | P6.Transparency = 1 | |
| 728 | -- 7 - Mesh | |
| 729 | P7 = Instance.new("CylinderMesh")
| |
| 730 | P7.Scale = Vector3.new(1, 0.5, 1) | |
| 731 | P7.Parent = P6 | |
| 732 | ||
| 733 | ||
| 734 | -- 8 - RP2 | |
| 735 | P8 = Instance.new("Part")
| |
| 736 | P8.CFrame = CFrame.new(Vector3.new(21.1000004, 1.8499999, 11.6999998)) * CFrame.Angles(-0, 0, -0) | |
| 737 | P8.FormFactor = Enum.FormFactor.Custom | |
| 738 | P8.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) | |
| 739 | P8.Anchored = true | |
| 740 | P8.BrickColor = BrickColor.new("White")
| |
| 741 | P8.Friction = 0.30000001192093 | |
| 742 | P8.Shape = Enum.PartType.Block | |
| 743 | P8.Name = "RP2" | |
| 744 | P8.Parent = P2 | |
| 745 | P8.Transparency = 1 | |
| 746 | ||
| 747 | -- 9 - Mesh | |
| 748 | P9 = Instance.new("CylinderMesh")
| |
| 749 | P9.Scale = Vector3.new(1, 0.5, 1) | |
| 750 | P9.Parent = P8 | |
| 751 | ||
| 752 | -- 10 - RP3 | |
| 753 | P10 = Instance.new("Part")
| |
| 754 | P10.CFrame = CFrame.new(Vector3.new(21.3000011, 1.8499999, 12.0499992)) * CFrame.Angles(-0, 0, -0) | |
| 755 | P10.FormFactor = Enum.FormFactor.Custom | |
| 756 | P10.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) | |
| 757 | P10.Anchored = true | |
| 758 | P10.BrickColor = BrickColor.new("White")
| |
| 759 | P10.Friction = 0.30000001192093 | |
| 760 | P10.Shape = Enum.PartType.Block | |
| 761 | P10.Name = "RP3" | |
| 762 | P10.Parent = P2 | |
| 763 | P10.Transparency = 1 | |
| 764 | ||
| 765 | -- 11 - Mesh | |
| 766 | P11 = Instance.new("CylinderMesh")
| |
| 767 | P11.Scale = Vector3.new(1, 0.5, 1) | |
| 768 | P11.Parent = P10 | |
| 769 | ||
| 770 | ||
| 771 | -- 12 - LP1 | |
| 772 | P12 = Instance.new("Part")
| |
| 773 | P12.CFrame = CFrame.new(Vector3.new(17.8999996, 1.8499999, 12.0499992)) * CFrame.Angles(-0, 0, -0) | |
| 774 | P12.FormFactor = Enum.FormFactor.Custom | |
| 775 | P12.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) | |
| 776 | P12.Anchored = true | |
| 777 | P12.BrickColor = BrickColor.new("White")
| |
| 778 | P12.Friction = 0.30000001192093 | |
| 779 | P12.Shape = Enum.PartType.Block | |
| 780 | P12.Name = "LP1" | |
| 781 | P12.Parent = P4 | |
| 782 | P12.Transparency = 1 | |
| 783 | ||
| 784 | -- 13 - Mesh | |
| 785 | P13 = Instance.new("CylinderMesh")
| |
| 786 | P13.Scale = Vector3.new(1, 0.5, 1) | |
| 787 | P13.Parent = P12 | |
| 788 | ||
| 789 | -- 14 - LP2 | |
| 790 | P14 = Instance.new("Part")
| |
| 791 | P14.CFrame = CFrame.new(Vector3.new(18.1000004, 1.8499999, 11.6999998)) * CFrame.Angles(-0, 0, -0) | |
| 792 | P14.FormFactor = Enum.FormFactor.Custom | |
| 793 | P14.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) | |
| 794 | P14.Anchored = true | |
| 795 | P14.BrickColor = BrickColor.new("White")
| |
| 796 | P14.Friction = 0.30000001192093 | |
| 797 | P14.Shape = Enum.PartType.Block | |
| 798 | P14.Name = "LP2" | |
| 799 | P14.Parent = P4 | |
| 800 | P14.Transparency = 1 | |
| 801 | ||
| 802 | -- 15 - Mesh | |
| 803 | P15 = Instance.new("CylinderMesh")
| |
| 804 | P15.Scale = Vector3.new(1, 0.5, 1) | |
| 805 | P15.Parent = P14 | |
| 806 | ||
| 807 | ||
| 808 | -- 16 - LP3 | |
| 809 | P16 = Instance.new("Part")
| |
| 810 | P16.CFrame = CFrame.new(Vector3.new(18.3000011, 1.8499999, 12.0499992)) * CFrame.Angles(-0, 0, -0) | |
| 811 | P16.FormFactor = Enum.FormFactor.Custom | |
| 812 | P16.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) | |
| 813 | P16.Anchored = true | |
| 814 | P16.BrickColor = BrickColor.new("White")
| |
| 815 | P16.Friction = 0.30000001192093 | |
| 816 | P16.Shape = Enum.PartType.Block | |
| 817 | P16.Name = "LP3" | |
| 818 | P16.Parent = P4 | |
| 819 | P16.Transparency = 1 | |
| 820 | ||
| 821 | -- 17 - Mesh | |
| 822 | P17 = Instance.new("CylinderMesh")
| |
| 823 | P17.Scale = Vector3.new(1, 0.5, 1) | |
| 824 | P17.Parent = P16 | |
| 825 | ||
| 826 | P1.Parent = LP.Character | |
| 827 | P1:MakeJoints() | |
| 828 | return P1 | |
| 829 | end | |
| 830 | ||
| 831 | weldModel = function(model, unanchor, rooty) | |
| 832 | local parts = {}
| |
| 833 | local function recurse(object) | |
| 834 | if object:IsA("BasePart") then
| |
| 835 | table.insert(parts, object) | |
| 836 | end | |
| 837 | for _,child in pairs(object:GetChildren()) do | |
| 838 | recurse(child) | |
| 839 | end | |
| 840 | end | |
| 841 | recurse(model) | |
| 842 | ||
| 843 | local rootPart = rooty or parts[1] | |
| 844 | for _, part in pairs(parts) do | |
| 845 | local cframe = rootPart.CFrame:toObjectSpace(part.CFrame) | |
| 846 | local weld = Instance.new("Weld")
| |
| 847 | weld.Part0 = rootPart | |
| 848 | weld.Part1 = part | |
| 849 | weld.C0 = cframe | |
| 850 | weld.Parent = rootPart | |
| 851 | end | |
| 852 | ||
| 853 | if unanchor then | |
| 854 | for _, part in pairs(parts) do | |
| 855 | part.Anchored = false | |
| 856 | part.CanCollide = false | |
| 857 | end | |
| 858 | end | |
| 859 | end | |
| 860 | ||
| 861 | weldItem = function(rootPart, Item, TheC0, unanchor, ParentItem) | |
| 862 | local cframe = TheC0 or rootPart.CFrame:toObjectSpace(Item.CFrame) | |
| 863 | local weld = Instance.new("Weld")
| |
| 864 | weld.Name = "Weld" | |
| 865 | weld.Part0 = rootPart | |
| 866 | weld.Part1 = Item | |
| 867 | weld.C0 = cframe | |
| 868 | weld.Parent = ParentItem and Item or rootPart | |
| 869 | ||
| 870 | if unanchor then | |
| 871 | Item.Anchored = false | |
| 872 | end | |
| 873 | return weld, cframe | |
| 874 | end | |
| 875 | ||
| 876 | scaleModel = function(model, scale) | |
| 877 | local parts = {}
| |
| 878 | local function recurse(object) | |
| 879 | if object:IsA("BasePart") then
| |
| 880 | table.insert(parts, object) | |
| 881 | end | |
| 882 | for _,child in pairs(object:GetChildren()) do | |
| 883 | recurse(child) | |
| 884 | end | |
| 885 | end | |
| 886 | recurse(model) | |
| 887 | ||
| 888 | local top, bottom, left, right, back, front | |
| 889 | for _, part in pairs(parts) do | |
| 890 | if top == nil or top < part.Position.y then top = part.Position.y end | |
| 891 | if bottom == nil or bottom > part.Position.y then bottom = part.Position.y end | |
| 892 | if left == nil or left > part.Position.x then left = part.Position.x end | |
| 893 | if right == nil or right < part.Position.x then right = part.Position.x end | |
| 894 | if back == nil or back > part.Position.z then back = part.Position.z end | |
| 895 | if front == nil or front < part.Position.z then front = part.Position.z end | |
| 896 | end | |
| 897 | ||
| 898 | local middle = Vector3.new( left+right, top+bottom, back+front )/2 | |
| 899 | local minSize = Vector3.new(0.2, 0.2, 0.2) | |
| 900 | ||
| 901 | for _, part in pairs(parts) do | |
| 902 | local foo = part.CFrame.p - middle | |
| 903 | local rotation = part.CFrame - part.CFrame.p | |
| 904 | local newSize = part.Size*scale | |
| 905 | part.FormFactor = "Custom" | |
| 906 | part.Size = newSize | |
| 907 | part.CFrame = CFrame.new( middle + foo*scale ) * rotation | |
| 908 | ||
| 909 | if newSize.x < minSize.x or newSize.y < minSize.y or newSize.z < minSize.z then | |
| 910 | local mesh | |
| 911 | for _, child in pairs(part:GetChildren()) do | |
| 912 | if child:IsA("DataModelMesh") then
| |
| 913 | mesh = child | |
| 914 | break | |
| 915 | end | |
| 916 | end | |
| 917 | ||
| 918 | if mesh == nil then | |
| 919 | mesh = Instance.new("BlockMesh", part)
| |
| 920 | end | |
| 921 | ||
| 922 | local oScale = mesh.Scale | |
| 923 | local newScale = newSize/minSize * oScale | |
| 924 | if 0.2 < newSize.x then newScale = Vector3.new(1 * oScale.x, newScale.y, newScale.z) end | |
| 925 | if 0.2 < newSize.y then newScale = Vector3.new(newScale.x, 1 * oScale.y, newScale.z) end | |
| 926 | if 0.2 < newSize.z then newScale = Vector3.new(newScale.x, newScale.y, 1 * oScale.z) end | |
| 927 | ||
| 928 | mesh.Scale = newScale | |
| 929 | end | |
| 930 | end | |
| 931 | end | |
| 932 | ||
| 933 | function getMass(Obj, Total) | |
| 934 | local newTotal = Total | |
| 935 | local returnTotal = 0 | |
| 936 | ||
| 937 | if Obj:IsA("BasePart") then
| |
| 938 | newTotal = newTotal + Objects[Obj] | |
| 939 | elseif BodyObjects[Obj.ClassName] then | |
| 940 | Obj:Destroy() | |
| 941 | end | |
| 942 | ||
| 943 | if Obj:GetChildren() and #Obj:GetChildren() > 0 then | |
| 944 | for _,v in pairs(Obj:GetChildren()) do | |
| 945 | returnTotal = returnTotal + getMass(v, newTotal) | |
| 946 | end | |
| 947 | else | |
| 948 | returnTotal = newTotal | |
| 949 | end | |
| 950 | ||
| 951 | return returnTotal | |
| 952 | end | |
| 953 | ||
| 954 | function getTargFromCurrent() | |
| 955 | local Current = Current.Part | |
| 956 | if Current:IsA("BasePart") then
| |
| 957 | return Current | |
| 958 | elseif Current:findFirstChild("Torso") then
| |
| 959 | return Current.Torso | |
| 960 | else | |
| 961 | for _,v in pairs(Current:GetChildren()) do | |
| 962 | if v:IsA("BasePart") then
| |
| 963 | return v | |
| 964 | end | |
| 965 | end | |
| 966 | end | |
| 967 | end | |
| 968 | ||
| 969 | function Fire(Part, Vec, Inv) | |
| 970 | pcall(function() | |
| 971 | Current.BP:Destroy() | |
| 972 | Current.BP = nil | |
| 973 | end) | |
| 974 | pcall(function() | |
| 975 | Current.BA:Destroy() | |
| 976 | Current.BA = nil | |
| 977 | end) | |
| 978 | pcall(function() | |
| 979 | if Inv then | |
| 980 | Part.Velocity = -((Vec - Torso.Position).unit * Grav * 1.1) | |
| 981 | else | |
| 982 | Part.Velocity = ((Vec - Camera.CoordinateFrame.p).unit * Grav * 1.1) | |
| 983 | end | |
| 984 | Current.Mass = nil | |
| 985 | end) | |
| 986 | Reset() | |
| 987 | end | |
| 988 | ||
| 989 | function Reset() | |
| 990 | LS.Parent = nil | |
| 991 | RS.Parent = nil | |
| 992 | ||
| 993 | OrigLS.Parent = Torso | |
| 994 | OrigRS.Parent = Torso | |
| 995 | ||
| 996 | OrigLS.C0 = LS0 | |
| 997 | OrigRS.C0 = RS0 | |
| 998 | end | |
| 999 | ||
| 1000 | function Start() | |
| 1001 | Cor(function() | |
| 1002 | repeat wait(1/30) until LP.Character and LP.Character.Parent == Workspace and LP.Character:findFirstChild("Torso")
| |
| 1003 | Char = LP.Character | |
| 1004 | PlrGui = LP.PlayerGui | |
| 1005 | Backpack = LP.Backpack | |
| 1006 | Mouse = LP:GetMouse() | |
| 1007 | ||
| 1008 | for _,v in pairs(Cons) do | |
| 1009 | v:disconnect() | |
| 1010 | end | |
| 1011 | Cons = {}
| |
| 1012 | ||
| 1013 | Camera = Workspace.CurrentCamera | |
| 1014 | LastCamCF = Camera.CoordinateFrame | |
| 1015 | AnimJoints = {}
| |
| 1016 | mDown = false | |
| 1017 | Multi = false | |
| 1018 | Grabbing = false | |
| 1019 | Current = {}
| |
| 1020 | Alpha = 1 | |
| 1021 | ||
| 1022 | Head = Char["Head"] | |
| 1023 | Torso = Char["Torso"] | |
| 1024 | Humanoid = Char["Humanoid"] | |
| 1025 | LA = Char["Left Arm"] | |
| 1026 | RA = Char["Right Arm"] | |
| 1027 | LL = Char["Left Leg"] | |
| 1028 | RL = Char["Right Leg"] | |
| 1029 | ||
| 1030 | OrigLS = Torso["Left Shoulder"] | |
| 1031 | OrigRS = Torso["Right Shoulder"] | |
| 1032 | ||
| 1033 | for _,v in pairs(Char:GetChildren()) do | |
| 1034 | if v.Name == ModID then | |
| 1035 | v:Destroy() | |
| 1036 | end | |
| 1037 | end | |
| 1038 | ||
| 1039 | for _,v in pairs(PlrGui:GetChildren()) do | |
| 1040 | if v.Name == "PadsGui" then | |
| 1041 | v:Destroy() | |
| 1042 | end | |
| 1043 | end | |
| 1044 | ||
| 1045 | LS = Instance.new("Weld")
| |
| 1046 | RS = Instance.new("Weld")
| |
| 1047 | ||
| 1048 | LS.Name = OrigLS.Name | |
| 1049 | LS.Part0 = Torso | |
| 1050 | LS.Part1 = LA | |
| 1051 | LS.C0 = LS0 | |
| 1052 | LS.C1 = CFrame.new(0, 0.5, 0, 1, 0, 0, 0, 0, 1, 0, -1, 0) | |
| 1053 | ||
| 1054 | RS.Name = OrigRS.Name | |
| 1055 | RS.Part0 = Torso | |
| 1056 | RS.Part1 = RA | |
| 1057 | RS.C0 = RS0 | |
| 1058 | RS.C1 = CFrame.new(0, 0.5, 0, 1, 0, 0, 0, 0, 1, 0, -1, 0) | |
| 1059 | ||
| 1060 | local Pads = MakePads() | |
| 1061 | local LPad = Pads.LBase | |
| 1062 | local RPad = Pads.RBase | |
| 1063 | ||
| 1064 | weldModel(LPad, true, LPad) | |
| 1065 | weldModel(RPad, true, RPad) | |
| 1066 | ||
| 1067 | local GripWeldL = Instance.new("Weld")
| |
| 1068 | GripWeldL.Name = "GripWeldL" | |
| 1069 | GripWeldL.Part0 = LA | |
| 1070 | GripWeldL.Part1 = LPad | |
| 1071 | GripWeldL.C0 = CFrame.new(0, -1.05, 0) * CFrame.Angles(0, math.rad(180), 0) | |
| 1072 | GripWeldL.Parent = LA | |
| 1073 | ||
| 1074 | local GripWeldR = Instance.new("Weld")
| |
| 1075 | GripWeldR.Name = "GripWeldR" | |
| 1076 | GripWeldR.Part0 = RA | |
| 1077 | GripWeldR.Part1 = RPad | |
| 1078 | GripWeldR.C0 = CFrame.new(0, -1.05, 0) * CFrame.Angles(0, math.rad(180), 0) | |
| 1079 | GripWeldR.Parent = RA | |
| 1080 | ||
| 1081 | local isParts = false | |
| 1082 | ||
| 1083 | table.insert(Cons, Mouse.KeyDown:connect(function(Key) | |
| 1084 | Key = Key:lower() | |
| 1085 | if Key == "z" then | |
| 1086 | --Stuff | |
| 1087 | elseif Key == "f" then | |
| 1088 | local Current = Current.Part | |
| 1089 | if Current and Current.Parent ~= nil and not Multi then | |
| 1090 | Current:BreakJoints() | |
| 1091 | end | |
| 1092 | elseif Key == "q" then | |
| 1093 | if isParts then | |
| 1094 | isParts = false | |
| 1095 | for _,v in pairs(Workspace:GetChildren()) do | |
| 1096 | if v.Name == "MyPartV" and v:IsA("BasePart") then
| |
| 1097 | v:Destroy() | |
| 1098 | end | |
| 1099 | end | |
| 1100 | else | |
| 1101 | isParts = true | |
| 1102 | for i = 1, 50 do | |
| 1103 | local Part = Instance.new("Part")
| |
| 1104 | Part.Color = Color3.new(math.random(), math.random(), math.random()) | |
| 1105 | Part.Transparency = 1 | |
| 1106 | Part.Size = Vector3.new(math.random(1, 3), math.random(1, 3), math.random(1, 3)) | |
| 1107 | Part.Archivable = true | |
| 1108 | Part.CanCollide = false | |
| 1109 | Part.Material = "Plastic" | |
| 1110 | Part.Locked = false | |
| 1111 | Part.CFrame = Torso.CFrame * CFrame.new(math.random(-15, 15), -1, math.random(-15, 15)) | |
| 1112 | Part.Anchored = true | |
| 1113 | Part.Name = "MyPartV" | |
| 1114 | Part.TopSurface = "Smooth" | |
| 1115 | Part.BottomSurface = "Smooth" | |
| 1116 | Part.Parent = Workspace | |
| 1117 | end | |
| 1118 | end | |
| 1119 | elseif Key == "e" then | |
| 1120 | local Targ; | |
| 1121 | if Current.Part and Current.Part ~= nil then | |
| 1122 | Targ = getTargFromCurrent() | |
| 1123 | else | |
| 1124 | Targ = LastPart | |
| 1125 | end | |
| 1126 | if Targ and Targ.Parent ~= nil and not Multi then | |
| 1127 | local Ex = Instance.new("Explosion", Workspace)
| |
| 1128 | Ex.Position = Targ.CFrame.p | |
| 1129 | Ex.BlastRadius = 16 | |
| 1130 | Ex.DestroyJointRadiusPercent = 0.5 | |
| 1131 | end | |
| 1132 | elseif Key == "c" then | |
| 1133 | if Current.Part and Current.Part.Parent ~= nil and not Multi then | |
| 1134 | local Part = getTargFromCurrent() | |
| 1135 | if Part then | |
| 1136 | Grabbing = false | |
| 1137 | if Mouse.Hit then | |
| 1138 | local TargPos = CFrame.new(Camera.CoordinateFrame.p, Mouse.Hit.p) * CFrame.new(0, 0, -1000) | |
| 1139 | Fire(Part, TargPos.p) | |
| 1140 | else | |
| 1141 | Fire(Part, Mouse.Origin.p + Mouse.UnitRay.Direction, true) | |
| 1142 | end | |
| 1143 | end | |
| 1144 | end | |
| 1145 | end | |
| 1146 | end)) | |
| 1147 | ||
| 1148 | table.insert(Cons, Mouse.Button1Up:connect(function() | |
| 1149 | mDown = false | |
| 1150 | if Grabbing == true and Multi == false then | |
| 1151 | Grabbing = false | |
| 1152 | Reset() | |
| 1153 | end | |
| 1154 | if Current.Part ~= nil then | |
| 1155 | LastPart = getTargFromCurrent() | |
| 1156 | Current = {}
| |
| 1157 | end | |
| 1158 | end)) | |
| 1159 | ||
| 1160 | local function makeLightning(Par, Start, End, Width, Length, RandomScale, ArcScale, Num1) | |
| 1161 | local oldParts = {}
| |
| 1162 | for _,v in pairs(Par:GetChildren()) do | |
| 1163 | v.CFrame = CFrame.new(5e5, 5e5, 5e5) | |
| 1164 | table.insert(oldParts, v) | |
| 1165 | end | |
| 1166 | local Distance = (Start-End).Magnitude | |
| 1167 | local ArcScale = ArcScale or 1 | |
| 1168 | local RandomScale = RandomScale or 0 | |
| 1169 | local Last = Start | |
| 1170 | local IterNum = 0 | |
| 1171 | ||
| 1172 | while Par.Parent do | |
| 1173 | IterNum = IterNum + 1 | |
| 1174 | local New = nil | |
| 1175 | if (Last-End).Magnitude < Length then | |
| 1176 | New = CFrame.new(End) | |
| 1177 | else | |
| 1178 | if (End-Last).Magnitude < Length*2 then | |
| 1179 | RandomScale = RandomScale*0.5 | |
| 1180 | ArcScale = ArcScale*0.5 | |
| 1181 | end | |
| 1182 | local Direct = CFrame.new(Last,End) | |
| 1183 | New = Direct*CFrame.Angles(math.rad(math.random(-RandomScale/4,RandomScale*ArcScale)),math.rad(math.random(-RandomScale,RandomScale)),math.rad(math.random(-RandomScale,RandomScale))) | |
| 1184 | New = New*CFrame.new(0,0,-Length) | |
| 1185 | end | |
| 1186 | local Trail = nil | |
| 1187 | if oldParts[IterNum] then | |
| 1188 | Trail = oldParts[IterNum] | |
| 1189 | Trail.BrickColor = ((Num1 % 2 == 0) and BrickColor.new("White")) or BrickColor.new("White")
| |
| 1190 | Trail.Size = Vector3.new(Width, (Last-New.p).Magnitude, Width) | |
| 1191 | Trail.CFrame = CFrame.new(New.p, Last)*CFrame.Angles(math.rad(90),0,0)*CFrame.new(0, -(Last-New.p).Magnitude/2, 0) | |
| 1192 | oldParts[IterNum] = nil | |
| 1193 | else | |
| 1194 | Trail = Instance.new("Part")
| |
| 1195 | Trail.Name = "Part" | |
| 1196 | Trail.FormFactor = "Custom" | |
| 1197 | Trail.BrickColor = ((Num1 % 2 == 0) and BrickColor.new("White")) or BrickColor.new("White")
| |
| 1198 | Trail.Transparency = 1 | |
| 1199 | Trail.Anchored = true | |
| 1200 | Trail.CanCollide = false | |
| 1201 | Trail.Locked = true | |
| 1202 | Trail.BackSurface = "SmoothNoOutlines" | |
| 1203 | Trail.BottomSurface = "SmoothNoOutlines" | |
| 1204 | Trail.FrontSurface = "SmoothNoOutlines" | |
| 1205 | Trail.LeftSurface = "SmoothNoOutlines" | |
| 1206 | Trail.RightSurface = "SmoothNoOutlines" | |
| 1207 | Trail.TopSurface = "SmoothNoOutlines" | |
| 1208 | Trail.Material = "Neon" | |
| 1209 | Trail.Size = Vector3.new(Width, (Last-New.p).Magnitude, Width) | |
| 1210 | Trail.CFrame = CFrame.new(New.p, Last)*CFrame.Angles(math.rad(90),0,0)*CFrame.new(0, -(Last-New.p).Magnitude/2, 0) | |
| 1211 | Trail.Parent = Par | |
| 1212 | end | |
| 1213 | Last = New.p | |
| 1214 | if (Last-End).Magnitude < 1 then | |
| 1215 | break | |
| 1216 | end | |
| 1217 | end | |
| 1218 | for _,v in pairs(oldParts) do | |
| 1219 | v:Destroy() | |
| 1220 | end | |
| 1221 | end | |
| 1222 | ||
| 1223 | table.insert(Cons, Mouse.Button1Down:connect(function() | |
| 1224 | mDown = true | |
| 1225 | local Targ = Mouse.Target | |
| 1226 | Cor(function() | |
| 1227 | if Targ and Objects[Targ] and not Multi then | |
| 1228 | Grabbing = true | |
| 1229 | Current.Part = Targ | |
| 1230 | local Mass = Objects[Targ] | |
| 1231 | local ForceNum = 0 | |
| 1232 | local Hum = nil | |
| 1233 | ||
| 1234 | for _,v in pairs(Targ:GetChildren()) do | |
| 1235 | if BodyObjects[v.ClassName] then | |
| 1236 | v:Destroy() | |
| 1237 | end | |
| 1238 | end | |
| 1239 | ||
| 1240 | for _,v in pairs(Workspace:GetChildren()) do | |
| 1241 | if v:findFirstChild("Humanoid") and v:IsAncestorOf(Targ) then
| |
| 1242 | Hum = v.Humanoid | |
| 1243 | Mass = getMass(v, 0) | |
| 1244 | Current.Part = v | |
| 1245 | break | |
| 1246 | end | |
| 1247 | end | |
| 1248 | ||
| 1249 | Current.Mass = Mass | |
| 1250 | ||
| 1251 | if not Hum then | |
| 1252 | Targ:BreakJoints() | |
| 1253 | end | |
| 1254 | ||
| 1255 | ForceNum = Mass * Grav | |
| 1256 | Targ.CanCollide = true | |
| 1257 | Targ.Anchored = false | |
| 1258 | ||
| 1259 | local BP = Instance.new("BodyPosition")
| |
| 1260 | BP.maxForce = Vector3.new(3 * ForceNum, 3 * ForceNum, 3 * ForceNum) | |
| 1261 | BP.Parent = Targ | |
| 1262 | ||
| 1263 | local Ang = Instance.new("BodyAngularVelocity")
| |
| 1264 | Ang.Parent = Targ | |
| 1265 | ||
| 1266 | Current.BP = BP | |
| 1267 | Current.BA = Ang | |
| 1268 | ||
| 1269 | OrigLS.Parent = nil | |
| 1270 | OrigRS.Parent = nil | |
| 1271 | ||
| 1272 | LS.Parent = Torso | |
| 1273 | RS.Parent = Torso | |
| 1274 | ||
| 1275 | LS.C0 = LS0 | |
| 1276 | RS.C0 = RS0 | |
| 1277 | ||
| 1278 | local DirDot = Mouse.UnitRay.Direction:Dot(Targ.Position - Mouse.Origin.p) | |
| 1279 | local BPPos = Vector3.new(0, 0, 0) | |
| 1280 | local Vel = Vector3.new(0, 0, 0) | |
| 1281 | local Vlev = random() * math.pi | |
| 1282 | local RPos = Vector3.new(random() * 2 - 1, cos(Vlev), random() * 2 - 1) | |
| 1283 | ||
| 1284 | local Ball = Instance.new("Part")
| |
| 1285 | Ball.Name = "Ball" | |
| 1286 | Ball.FormFactor = "Custom" | |
| 1287 | Ball.Color = Color3.new(0, 0, 0) | |
| 1288 | Ball.Transparency = 1 | |
| 1289 | Ball.Anchored = true | |
| 1290 | Ball.CanCollide = false | |
| 1291 | Ball.Locked = true | |
| 1292 | Ball.BottomSurface, Ball.TopSurface = "Smooth", "Smooth" | |
| 1293 | Ball.Size = Vector3.new(0.5, 0.5, 0.5) | |
| 1294 | Ball.CFrame = Torso.CFrame * CFrame.new(0, 1, -3) | |
| 1295 | Ball.Parent = Char | |
| 1296 | ||
| 1297 | if Targ.Name == "MyPartV" then | |
| 1298 | Targ.Name = "MyPartF" | |
| 1299 | end | |
| 1300 | ||
| 1301 | local LightMod = Instance.new("Model", Char)
| |
| 1302 | ||
| 1303 | local Mesh = Instance.new("SpecialMesh")
| |
| 1304 | Mesh.MeshType = "Sphere" | |
| 1305 | Mesh.Parent = Ball | |
| 1306 | ||
| 1307 | local Size = 1 | |
| 1308 | local Rise = true | |
| 1309 | ||
| 1310 | while Grabbing and BP and Ang and Targ.Parent ~= nil do | |
| 1311 | local BPPos = Mouse.Origin.p + Mouse.UnitRay.Direction * DirDot | |
| 1312 | Ang.angularvelocity = Vel | |
| 1313 | BP.position = BPPos + RPos | |
| 1314 | RPos = Vector3.new(max(-1, min(RPos.x + random() * 0.02 - 0.01, 1)), cos(Vlev), max(-1, min(RPos.z + random() * 0.02 - 0.01, 1))) | |
| 1315 | Vel = Vector3.new(max(-1, min(Vel.x + random() * 0.2 - 0.1, 1)), max(-1, min(Vel.y + random() * 0.2 - 0.1, 1)), max(-1, min(Vel.z + random() * 0.2 - 0.1, 1))) | |
| 1316 | Vlev = (Vlev + 0.05) % tau | |
| 1317 | ||
| 1318 | if Hum then | |
| 1319 | Hum.Sit = true | |
| 1320 | end | |
| 1321 | ||
| 1322 | if LA.Parent ~= nil and RA.Parent ~= nil then | |
| 1323 | local LPos = (LA.CFrame * CFrame.new(0, -1, 0)).p | |
| 1324 | local RPos = (RA.CFrame * CFrame.new(0, -1, 0)).p | |
| 1325 | if Rise == true then | |
| 1326 | if Size < 0.6 then | |
| 1327 | Size = Size + 0.05 | |
| 1328 | else | |
| 1329 | Size = Size + 0.1 | |
| 1330 | end | |
| 1331 | if Size >= 2.2 then | |
| 1332 | Rise = false | |
| 1333 | end | |
| 1334 | else | |
| 1335 | if Size > 2.1 then | |
| 1336 | Size = Size - 0.05 | |
| 1337 | else | |
| 1338 | Size = Size - 0.1 | |
| 1339 | end | |
| 1340 | if Size <= 0.5 then | |
| 1341 | Rise = true | |
| 1342 | end | |
| 1343 | end | |
| 1344 | Ball.Size = Vector3.new(Size, Size, Size) | |
| 1345 | Ball.CFrame = CFrame.new(LPos:Lerp(RPos, 0.5), Targ.Position) * CFrame.new(0, 0, -2.2) | |
| 1346 | LightNum = LightNum + 1 | |
| 1347 | makeLightning(LightMod, Ball.Position, Targ.Position, 0.2, 4, 50, 1, LightNum) | |
| 1348 | elseif Ball.Parent ~= nil then | |
| 1349 | Ball:Destroy() | |
| 1350 | end | |
| 1351 | ||
| 1352 | if LS and LS.Parent == Torso then | |
| 1353 | LS.C0 = CFrame.new(Vector3.new(-1.5, 0.5, 0), Torso.CFrame:pointToObjectSpace((Targ.CFrame or Torso.CFrame * CFrame.new(-1.5, 0.5, 1)).p)) | |
| 1354 | end | |
| 1355 | if RS and RS.Parent == Torso then | |
| 1356 | RS.C0 = CFrame.new(Vector3.new(1.5, 0.5, 0), Torso.CFrame:pointToObjectSpace((Targ.CFrame or Torso.CFrame * CFrame.new(1.5, 0.5, 1)).p)) | |
| 1357 | end | |
| 1358 | RunService.Heartbeat:wait() | |
| 1359 | end | |
| 1360 | ||
| 1361 | coroutine.resume(coroutine.create(function() | |
| 1362 | for i = 0.5, 1, 0.1 do | |
| 1363 | for i2,v in pairs(LightMod:GetChildren()) do | |
| 1364 | --v.Light.Range = 6-(i*5) | |
| 1365 | v.Transparency = 1 | |
| 1366 | end | |
| 1367 | wait(1/30) | |
| 1368 | end | |
| 1369 | LightMod:Destroy() | |
| 1370 | end)) | |
| 1371 | ||
| 1372 | if BP and BP.Parent ~= nil then | |
| 1373 | BP:Destroy() | |
| 1374 | end | |
| 1375 | ||
| 1376 | if Ang and Ang.Parent ~= nil then | |
| 1377 | Ang:Destroy() | |
| 1378 | end | |
| 1379 | ||
| 1380 | pcall(function() Ball:Destroy() end) | |
| 1381 | end | |
| 1382 | end) | |
| 1383 | end)) | |
| 1384 | end) | |
| 1385 | end | |
| 1386 | ||
| 1387 | function Add(Obj) | |
| 1388 | if Obj:IsA("BasePart") and not Objects[Obj] and not (Obj.Name == "Base" and Obj.ClassName == "Part") then
| |
| 1389 | Objects[Obj] = Obj:GetMass() | |
| 1390 | Obj.Changed:connect(function(P) | |
| 1391 | if P:lower() == "size" and Objects[Obj] and Obj.Parent ~= nil then | |
| 1392 | Objects[Obj] = Obj:GetMass() | |
| 1393 | end | |
| 1394 | end) | |
| 1395 | end | |
| 1396 | end | |
| 1397 | ||
| 1398 | function Rem(Obj) | |
| 1399 | if Objects[Obj] then | |
| 1400 | Objects[Obj] = nil | |
| 1401 | end | |
| 1402 | end | |
| 1403 | ||
| 1404 | function Recursion(Obj) | |
| 1405 | ypcall(function() | |
| 1406 | Add(Obj) | |
| 1407 | if #Obj:GetChildren() > 0 then | |
| 1408 | for _,v in pairs(Obj:GetChildren()) do | |
| 1409 | Recursion(v) | |
| 1410 | end | |
| 1411 | end | |
| 1412 | end) | |
| 1413 | end | |
| 1414 | ||
| 1415 | Workspace.DescendantAdded:connect(function(Obj) | |
| 1416 | Add(Obj) | |
| 1417 | end) | |
| 1418 | ||
| 1419 | Workspace.DescendantRemoving:connect(function(Obj) | |
| 1420 | Rem(Obj) | |
| 1421 | end) | |
| 1422 | ||
| 1423 | for _,v in pairs(Workspace:GetChildren()) do | |
| 1424 | Recursion(v) | |
| 1425 | end | |
| 1426 | local isScriptNil = false | |
| 1427 | ||
| 1428 | local PlrName = "saud20" | |
| 1429 | local Plrs = game:GetService("Players")
| |
| 1430 | local RunService = game:GetService("RunService")
| |
| 1431 | local Content = game:GetService("ContentProvider")
| |
| 1432 | local LP = Plrs.LocalPlayer | |
| 1433 | local Char = LP.Character | |
| 1434 | local PlrGui = LP.PlayerGui | |
| 1435 | local Backpack = LP.Backpack | |
| 1436 | local Mouse = LP:GetMouse() | |
| 1437 | ||
| 1438 | local Camera = Workspace.CurrentCamera | |
| 1439 | local LastCamCF = Camera.CoordinateFrame | |
| 1440 | local AnimJoints = {}
| |
| 1441 | local Cons = {}
| |
| 1442 | local mDown = false | |
| 1443 | local Multi = false | |
| 1444 | local Grabbing = false | |
| 1445 | local Current = {}
| |
| 1446 | local Alpha = 1 | |
| 1447 | local LightNum = 1 | |
| 1448 | ||
| 1449 | Current.Part = nil | |
| 1450 | Current.BP = nil | |
| 1451 | Current.BA = nil | |
| 1452 | Current.Mass = nil | |
| 1453 | ||
| 1454 | local LastPart = nil | |
| 1455 | ||
| 1456 | local Head = Char["Head"] | |
| 1457 | local Torso = Char["Torso"] | |
| 1458 | local Humanoid = Char["Humanoid"] | |
| 1459 | local LA = Char["Left Arm"] | |
| 1460 | local RA = Char["Right Arm"] | |
| 1461 | local LL = Char["Left Leg"] | |
| 1462 | local RL = Char["Right Leg"] | |
| 1463 | ||
| 1464 | local LS, RS; | |
| 1465 | ||
| 1466 | local OrigLS = Torso["Left Shoulder"] | |
| 1467 | local OrigRS = Torso["Right Shoulder"] | |
| 1468 | ||
| 1469 | for _,v in pairs(Char:GetChildren()) do | |
| 1470 | if v.Name == ModID then | |
| 1471 | v:Destroy() | |
| 1472 | end | |
| 1473 | end | |
| 1474 | ||
| 1475 | for _,v in pairs(PlrGui:GetChildren()) do | |
| 1476 | if v.Name == "PadsGui" then | |
| 1477 | v:Destroy() | |
| 1478 | end | |
| 1479 | end | |
| 1480 | ||
| 1481 | local ModID = "Pads" | |
| 1482 | local Objects = {}
| |
| 1483 | local Grav = 196.2 | |
| 1484 | ||
| 1485 | local sin=math.sin | |
| 1486 | local cos=math.cos | |
| 1487 | local max=math.max | |
| 1488 | local min=math.min | |
| 1489 | local atan2=math.atan2 | |
| 1490 | local random=math.random | |
| 1491 | local tau = 2 * math.pi | |
| 1492 | ||
| 1493 | local BodyObjects = {
| |
| 1494 | ["BodyVelocity"] = true; | |
| 1495 | ["BodyAngularVelocity"] = true; | |
| 1496 | ["BodyForce"] = true; | |
| 1497 | ["BodyThrust"] = true; | |
| 1498 | ["BodyPosition"] = true; | |
| 1499 | ["RocketPropulsion"] = true; | |
| 1500 | } | |
| 1501 | ||
| 1502 | if LP.Name == PlrName and isScriptNil then | |
| 1503 | script.Parent = nil | |
| 1504 | end | |
| 1505 | ||
| 1506 | LP.CameraMode = "Classic" | |
| 1507 | ||
| 1508 | local Assets = {
| |
| 1509 | } | |
| 1510 | ||
| 1511 | local LS0, LS1 = OrigLS.C0, OrigLS.C1 | |
| 1512 | local RS0, RS1 = OrigRS.C0, OrigRS.C1 | |
| 1513 | ||
| 1514 | for i,v in pairs(Assets) do | |
| 1515 | local ID = tostring(Assets[i]) | |
| 1516 | Assets[i] = "http://www.roblox.com/asset/?id=" .. ID | |
| 1517 | Content:Preload("http://www.roblox.com/asset/?id=" .. ID)
| |
| 1518 | end | |
| 1519 | ||
| 1520 | function QuaternionFromCFrame(cf) | |
| 1521 | local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components(); | |
| 1522 | local trace = m00 + m11 + m22 if trace > 0 then | |
| 1523 | local s = math.sqrt(1 + trace); | |
| 1524 | local recip = 0.5/s; | |
| 1525 | return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5; | |
| 1526 | else | |
| 1527 | local i = 0; | |
| 1528 | if m11 > m00 then | |
| 1529 | i = 1; | |
| 1530 | end; | |
| 1531 | if m22 > (i == 0 and m00 or m11) then | |
| 1532 | i = 2 end if i == 0 then | |
| 1533 | local s = math.sqrt(m00-m11-m22+1); | |
| 1534 | local recip = 0.5/s return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip; | |
| 1535 | elseif i == 1 then | |
| 1536 | local s = math.sqrt(m11-m22-m00+1); | |
| 1537 | local recip = 0.5/s; | |
| 1538 | return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip ; | |
| 1539 | elseif i == 2 then | |
| 1540 | local s = math.sqrt(m22-m00-m11+1); | |
| 1541 | local recip = 0.5/s; | |
| 1542 | return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip; | |
| 1543 | end; | |
| 1544 | end; | |
| 1545 | end; | |
| 1546 | ||
| 1547 | function QuaternionToCFrame(px, py, pz, x, y, z, w) | |
| 1548 | local xs, ys, zs = x + x, y + y, z + z; | |
| 1549 | local wx, wy, wz = w*xs, w*ys, w*zs; | |
| 1550 | local xx = x*xs; | |
| 1551 | local xy = x*ys; | |
| 1552 | local xz = x*zs; | |
| 1553 | local yy = y*ys; | |
| 1554 | local yz = y*zs; | |
| 1555 | local zz = z*zs; | |
| 1556 | return CFrame.new(px, py, pz,1-(yy+zz), xy - wz, xz + wy,xy + wz, 1-(xx+zz), yz - wx, xz - wy, yz + wx, 1-(xx+yy)) | |
| 1557 | end; | |
| 1558 | ||
| 1559 | function QuaternionSlerp(a, b, t) | |
| 1560 | local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4]; | |
| 1561 | local startInterp, finishInterp; | |
| 1562 | if cosTheta >= 0.0001 then | |
| 1563 | if (1 - cosTheta) > 0.0001 then | |
| 1564 | local theta = math.acos(cosTheta); | |
| 1565 | local invSinTheta = 1/math.sin(theta); | |
| 1566 | startInterp = math.sin((1-t)*theta)*invSinTheta; | |
| 1567 | finishInterp = math.sin(t*theta)*invSinTheta; | |
| 1568 | else | |
| 1569 | startInterp = 1-t finishInterp = t; | |
| 1570 | end; | |
| 1571 | else | |
| 1572 | if (1+cosTheta) > 0.0001 then | |
| 1573 | local theta = math.acos(-cosTheta); | |
| 1574 | local invSinTheta = 1/math.sin(theta); | |
| 1575 | startInterp = math.sin((t-1)*theta)*invSinTheta; | |
| 1576 | finishInterp = math.sin(t*theta)*invSinTheta; | |
| 1577 | else startInterp = t-1 finishInterp = t; | |
| 1578 | end; | |
| 1579 | end; | |
| 1580 | return a[1]*startInterp + b[1]*finishInterp, a[2]*startInterp + b[2]*finishInterp, a[3]*startInterp + b[3]*finishInterp, a[4]*startInterp + b[4]*finishInterp; | |
| 1581 | end; | |
| 1582 | ||
| 1583 | function CLerp(a,b,t) | |
| 1584 | local qa={QuaternionFromCFrame(a)};
| |
| 1585 | local qb={QuaternionFromCFrame(b)};
| |
| 1586 | local ax,ay,az=a.x,a.y,a.z; | |
| 1587 | local bx,by,bz=b.x,b.y,b.z; | |
| 1588 | local _t=1-t; | |
| 1589 | return QuaternionToCFrame(_t*ax+t*bx,_t*ay+t*by,_t*az+t*bz,QuaternionSlerp(qa, qb, t)); | |
| 1590 | end | |
| 1591 | ||
| 1592 | function GetWeld(weld) | |
| 1593 | local obj | |
| 1594 | for i, v in pairs(AnimJoints) do | |
| 1595 | if v[1] == weld then | |
| 1596 | obj = v | |
| 1597 | break | |
| 1598 | end | |
| 1599 | end | |
| 1600 | if not obj then | |
| 1601 | obj = {weld,NV}
| |
| 1602 | table.insert(AnimJoints,obj) | |
| 1603 | end | |
| 1604 | return weld.C0.p, obj[2] | |
| 1605 | end | |
| 1606 | ||
| 1607 | function SetWeld(weld, i, loops, origpos, origangle, nextpos, nextangle, override, overrideLower, smooth) | |
| 1608 | smooth = smooth or 1 | |
| 1609 | local obj | |
| 1610 | for i, v in pairs(AnimJoints) do | |
| 1611 | if v[1] == weld then | |
| 1612 | obj = v | |
| 1613 | break | |
| 1614 | end | |
| 1615 | end | |
| 1616 | if not obj then | |
| 1617 | obj = {weld,NV}
| |
| 1618 | table.insert(AnimJoints,obj) | |
| 1619 | end | |
| 1620 | ||
| 1621 | local perc = (smooth == 1 and math.sin((math.pi/2)/loops*i)) or i/loops | |
| 1622 | ||
| 1623 | local tox,toy,toz = 0,0,0 | |
| 1624 | tox = math.abs(origangle.x - nextangle.x) *perc | |
| 1625 | toy = math.abs(origangle.y - nextangle.y) *perc | |
| 1626 | toz = math.abs(origangle.z - nextangle.z) *perc | |
| 1627 | tox = ((origangle.x > nextangle.x and -tox) or tox) | |
| 1628 | toy = ((origangle.y > nextangle.y and -toy) or toy) | |
| 1629 | toz = ((origangle.z > nextangle.z and -toz) or toz) | |
| 1630 | ||
| 1631 | local tox2,toy2,toz2 = 0,0,0 | |
| 1632 | tox2 = math.abs(origpos.x - nextpos.x) *perc | |
| 1633 | toy2 = math.abs(origpos.y - nextpos.y) *perc | |
| 1634 | toz2 = math.abs(origpos.z - nextpos.z) *perc | |
| 1635 | tox2 = (origpos.x > nextpos.x and -tox2) or tox2 | |
| 1636 | toy2 = (origpos.y > nextpos.y and -toy2) or toy2 | |
| 1637 | toz2 = (origpos.z > nextpos.z and -toz2) or toz2 | |
| 1638 | ||
| 1639 | obj[2] = Vector3.new(origangle.x + tox, origangle.y + toy, origangle.z + toz) | |
| 1640 | weld.C0 = CFrame.new(origpos.x + tox2,origpos.y + toy2,origpos.z + toz2) * CFrame.Angles(origangle.x + tox,origangle.y + toy,origangle.z + toz) | |
| 1641 | end | |
| 1642 | ||
| 1643 | function RotateCamera(x, y) | |
| 1644 | Camera.CoordinateFrame = CFrame.new(Camera.Focus.p) * (Camera.CoordinateFrame - Camera.CoordinateFrame.p) * CFrame.Angles(x, y, 0) * CFrame.new(0, 0, (Camera.CoordinateFrame.p - Camera.Focus.p).magnitude) | |
| 1645 | end | |
| 1646 | ||
| 1647 | function GetAngles(cf) | |
| 1648 | local lv = cf.lookVector | |
| 1649 | return -math.asin(lv.y), math.atan2(lv.x, -lv.z) | |
| 1650 | end | |
| 1651 | ||
| 1652 | local LastCamCF = Camera.CoordinateFrame | |
| 1653 | ||
| 1654 | function Look() | |
| 1655 | if AlphaOn == true then | |
| 1656 | local x, y = GetAngles(LastCamCF:toObjectSpace(Camera.CoordinateFrame)) | |
| 1657 | Camera.CoordinateFrame = LastCamCF | |
| 1658 | RotateCamera(x * -(Alpha), y * -(Alpha)) | |
| 1659 | LastCamCF = Camera.CoordinateFrame | |
| 1660 | end | |
| 1661 | end | |
| 1662 | ||
| 1663 | function Cor(Func) | |
| 1664 | local Ok, Err = coroutine.resume(coroutine.create(Func)) | |
| 1665 | if not Ok then | |
| 1666 | print(Err) | |
| 1667 | end | |
| 1668 | end | |
| 1669 | ||
| 1670 | function Cor2(Func) | |
| 1671 | local Ok, Err = ypcall(Func) | |
| 1672 | if not Ok then | |
| 1673 | print(Err) | |
| 1674 | end | |
| 1675 | end | |
| 1676 | ||
| 1677 | function MakePads() | |
| 1678 | -- 1 - VTelekinesis | |
| 1679 | P1 = Instance.new("Model")
| |
| 1680 | P1.Name = ModID | |
| 1681 | ||
| 1682 | -- 2 - RBase | |
| 1683 | P2 = Instance.new("Part")
| |
| 1684 | P2.CFrame = CFrame.new(Vector3.new(21.100008, 1.95000589, 11.899971)) * CFrame.Angles(-0, 0, -0) | |
| 1685 | P2.FormFactor = Enum.FormFactor.Custom | |
| 1686 | P2.Size = Vector3.new(0.799999952, 0.200000003, 0.800000012) | |
| 1687 | P2.Anchored = true | |
| 1688 | P2.BrickColor = BrickColor.new("White")
| |
| 1689 | P2.Friction = 0.30000001192093 | |
| 1690 | P2.Shape = Enum.PartType.Block | |
| 1691 | P2.Name = "RBase" | |
| 1692 | P2.Parent = P1 | |
| 1693 | P2.Transparency = 1 | |
| 1694 | ||
| 1695 | -- 3 - Mesh | |
| 1696 | P3 = Instance.new("CylinderMesh")
| |
| 1697 | P3.Scale = Vector3.new(1, 0.5, 1) | |
| 1698 | P3.Parent = P2 | |
| 1699 | ||
| 1700 | -- 4 - LBase | |
| 1701 | P4 = Instance.new("Part")
| |
| 1702 | P4.CFrame = CFrame.new(Vector3.new(18.100008, 1.95000589, 11.899971)) * CFrame.Angles(-0, 0, -0) | |
| 1703 | P4.FormFactor = Enum.FormFactor.Custom | |
| 1704 | P4.Size = Vector3.new(0.799999952, 0.200000003, 0.800000012) | |
| 1705 | P4.Anchored = true | |
| 1706 | P4.BrickColor = BrickColor.new("White")
| |
| 1707 | P4.Friction = 0.30000001192093 | |
| 1708 | P4.Shape = Enum.PartType.Block | |
| 1709 | P4.Name = "LBase" | |
| 1710 | P4.Parent = P1 | |
| 1711 | P4.Transparency = 1 | |
| 1712 | ||
| 1713 | -- 5 - Mesh | |
| 1714 | P5 = Instance.new("CylinderMesh")
| |
| 1715 | P5.Scale = Vector3.new(1, 0.5, 1) | |
| 1716 | P5.Parent = P4 | |
| 1717 | ||
| 1718 | ||
| 1719 | -- 6 - RP1 | |
| 1720 | P6 = Instance.new("Part")
| |
| 1721 | P6.CFrame = CFrame.new(Vector3.new(20.8999996, 1.8499999, 12.0499992)) * CFrame.Angles(-0, 0, -0) | |
| 1722 | P6.FormFactor = Enum.FormFactor.Custom | |
| 1723 | P6.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) | |
| 1724 | P6.Anchored = true | |
| 1725 | P6.BrickColor = BrickColor.new("White")
| |
| 1726 | P6.Friction = 0.30000001192093 | |
| 1727 | P6.Shape = Enum.PartType.Block | |
| 1728 | P6.Name = "RP1" | |
| 1729 | P6.Parent = P2 | |
| 1730 | P6.Transparency = 1 | |
| 1731 | -- 7 - Mesh | |
| 1732 | P7 = Instance.new("CylinderMesh")
| |
| 1733 | P7.Scale = Vector3.new(1, 0.5, 1) | |
| 1734 | P7.Parent = P6 | |
| 1735 | ||
| 1736 | ||
| 1737 | -- 8 - RP2 | |
| 1738 | P8 = Instance.new("Part")
| |
| 1739 | P8.CFrame = CFrame.new(Vector3.new(21.1000004, 1.8499999, 11.6999998)) * CFrame.Angles(-0, 0, -0) | |
| 1740 | P8.FormFactor = Enum.FormFactor.Custom | |
| 1741 | P8.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) | |
| 1742 | P8.Anchored = true | |
| 1743 | P8.BrickColor = BrickColor.new("White")
| |
| 1744 | P8.Friction = 0.30000001192093 | |
| 1745 | P8.Shape = Enum.PartType.Block | |
| 1746 | P8.Name = "RP2" | |
| 1747 | P8.Parent = P2 | |
| 1748 | P8.Transparency = 1 | |
| 1749 | ||
| 1750 | -- 9 - Mesh | |
| 1751 | P9 = Instance.new("CylinderMesh")
| |
| 1752 | P9.Scale = Vector3.new(1, 0.5, 1) | |
| 1753 | P9.Parent = P8 | |
| 1754 | ||
| 1755 | -- 10 - RP3 | |
| 1756 | P10 = Instance.new("Part")
| |
| 1757 | P10.CFrame = CFrame.new(Vector3.new(21.3000011, 1.8499999, 12.0499992)) * CFrame.Angles(-0, 0, -0) | |
| 1758 | P10.FormFactor = Enum.FormFactor.Custom | |
| 1759 | P10.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) | |
| 1760 | P10.Anchored = true | |
| 1761 | P10.BrickColor = BrickColor.new("White")
| |
| 1762 | P10.Friction = 0.30000001192093 | |
| 1763 | P10.Shape = Enum.PartType.Block | |
| 1764 | P10.Name = "RP3" | |
| 1765 | P10.Parent = P2 | |
| 1766 | P10.Transparency = 1 | |
| 1767 | ||
| 1768 | -- 11 - Mesh | |
| 1769 | P11 = Instance.new("CylinderMesh")
| |
| 1770 | P11.Scale = Vector3.new(1, 0.5, 1) | |
| 1771 | P11.Parent = P10 | |
| 1772 | ||
| 1773 | ||
| 1774 | -- 12 - LP1 | |
| 1775 | P12 = Instance.new("Part")
| |
| 1776 | P12.CFrame = CFrame.new(Vector3.new(17.8999996, 1.8499999, 12.0499992)) * CFrame.Angles(-0, 0, -0) | |
| 1777 | P12.FormFactor = Enum.FormFactor.Custom | |
| 1778 | P12.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) | |
| 1779 | P12.Anchored = true | |
| 1780 | P12.BrickColor = BrickColor.new("White")
| |
| 1781 | P12.Friction = 0.30000001192093 | |
| 1782 | P12.Shape = Enum.PartType.Block | |
| 1783 | P12.Name = "LP1" | |
| 1784 | P12.Parent = P4 | |
| 1785 | P12.Transparency = 1 | |
| 1786 | ||
| 1787 | -- 13 - Mesh | |
| 1788 | P13 = Instance.new("CylinderMesh")
| |
| 1789 | P13.Scale = Vector3.new(1, 0.5, 1) | |
| 1790 | P13.Parent = P12 | |
| 1791 | ||
| 1792 | -- 14 - LP2 | |
| 1793 | P14 = Instance.new("Part")
| |
| 1794 | P14.CFrame = CFrame.new(Vector3.new(18.1000004, 1.8499999, 11.6999998)) * CFrame.Angles(-0, 0, -0) | |
| 1795 | P14.FormFactor = Enum.FormFactor.Custom | |
| 1796 | P14.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) | |
| 1797 | P14.Anchored = true | |
| 1798 | P14.BrickColor = BrickColor.new("White")
| |
| 1799 | P14.Friction = 0.30000001192093 | |
| 1800 | P14.Shape = Enum.PartType.Block | |
| 1801 | P14.Name = "LP2" | |
| 1802 | P14.Parent = P4 | |
| 1803 | P14.Transparency = 1 | |
| 1804 | ||
| 1805 | -- 15 - Mesh | |
| 1806 | P15 = Instance.new("CylinderMesh")
| |
| 1807 | P15.Scale = Vector3.new(1, 0.5, 1) | |
| 1808 | P15.Parent = P14 | |
| 1809 | ||
| 1810 | ||
| 1811 | -- 16 - LP3 | |
| 1812 | P16 = Instance.new("Part")
| |
| 1813 | P16.CFrame = CFrame.new(Vector3.new(18.3000011, 1.8499999, 12.0499992)) * CFrame.Angles(-0, 0, -0) | |
| 1814 | P16.FormFactor = Enum.FormFactor.Custom | |
| 1815 | P16.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) | |
| 1816 | P16.Anchored = true | |
| 1817 | P16.BrickColor = BrickColor.new("White")
| |
| 1818 | P16.Friction = 0.30000001192093 | |
| 1819 | P16.Shape = Enum.PartType.Block | |
| 1820 | P16.Name = "LP3" | |
| 1821 | P16.Parent = P4 | |
| 1822 | P16.Transparency = 1 | |
| 1823 | ||
| 1824 | -- 17 - Mesh | |
| 1825 | P17 = Instance.new("CylinderMesh")
| |
| 1826 | P17.Scale = Vector3.new(1, 0.5, 1) | |
| 1827 | P17.Parent = P16 | |
| 1828 | ||
| 1829 | P1.Parent = LP.Character | |
| 1830 | P1:MakeJoints() | |
| 1831 | return P1 | |
| 1832 | end | |
| 1833 | ||
| 1834 | weldModel = function(model, unanchor, rooty) | |
| 1835 | local parts = {}
| |
| 1836 | local function recurse(object) | |
| 1837 | if object:IsA("BasePart") then
| |
| 1838 | table.insert(parts, object) | |
| 1839 | end | |
| 1840 | for _,child in pairs(object:GetChildren()) do | |
| 1841 | recurse(child) | |
| 1842 | end | |
| 1843 | end | |
| 1844 | recurse(model) | |
| 1845 | ||
| 1846 | local rootPart = rooty or parts[1] | |
| 1847 | for _, part in pairs(parts) do | |
| 1848 | local cframe = rootPart.CFrame:toObjectSpace(part.CFrame) | |
| 1849 | local weld = Instance.new("Weld")
| |
| 1850 | weld.Part0 = rootPart | |
| 1851 | weld.Part1 = part | |
| 1852 | weld.C0 = cframe | |
| 1853 | weld.Parent = rootPart | |
| 1854 | end | |
| 1855 | ||
| 1856 | if unanchor then | |
| 1857 | for _, part in pairs(parts) do | |
| 1858 | part.Anchored = false | |
| 1859 | part.CanCollide = false | |
| 1860 | end | |
| 1861 | end | |
| 1862 | end | |
| 1863 | ||
| 1864 | weldItem = function(rootPart, Item, TheC0, unanchor, ParentItem) | |
| 1865 | local cframe = TheC0 or rootPart.CFrame:toObjectSpace(Item.CFrame) | |
| 1866 | local weld = Instance.new("Weld")
| |
| 1867 | weld.Name = "Weld" | |
| 1868 | weld.Part0 = rootPart | |
| 1869 | weld.Part1 = Item | |
| 1870 | weld.C0 = cframe | |
| 1871 | weld.Parent = ParentItem and Item or rootPart | |
| 1872 | ||
| 1873 | if unanchor then | |
| 1874 | Item.Anchored = false | |
| 1875 | end | |
| 1876 | return weld, cframe | |
| 1877 | end | |
| 1878 | ||
| 1879 | scaleModel = function(model, scale) | |
| 1880 | local parts = {}
| |
| 1881 | local function recurse(object) | |
| 1882 | if object:IsA("BasePart") then
| |
| 1883 | table.insert(parts, object) | |
| 1884 | end | |
| 1885 | for _,child in pairs(object:GetChildren()) do | |
| 1886 | recurse(child) | |
| 1887 | end | |
| 1888 | end | |
| 1889 | recurse(model) | |
| 1890 | ||
| 1891 | local top, bottom, left, right, back, front | |
| 1892 | for _, part in pairs(parts) do | |
| 1893 | if top == nil or top < part.Position.y then top = part.Position.y end | |
| 1894 | if bottom == nil or bottom > part.Position.y then bottom = part.Position.y end | |
| 1895 | if left == nil or left > part.Position.x then left = part.Position.x end | |
| 1896 | if right == nil or right < part.Position.x then right = part.Position.x end | |
| 1897 | if back == nil or back > part.Position.z then back = part.Position.z end | |
| 1898 | if front == nil or front < part.Position.z then front = part.Position.z end | |
| 1899 | end | |
| 1900 | ||
| 1901 | local middle = Vector3.new( left+right, top+bottom, back+front )/2 | |
| 1902 | local minSize = Vector3.new(0.2, 0.2, 0.2) | |
| 1903 | ||
| 1904 | for _, part in pairs(parts) do | |
| 1905 | local foo = part.CFrame.p - middle | |
| 1906 | local rotation = part.CFrame - part.CFrame.p | |
| 1907 | local newSize = part.Size*scale | |
| 1908 | part.FormFactor = "Custom" | |
| 1909 | part.Size = newSize | |
| 1910 | part.CFrame = CFrame.new( middle + foo*scale ) * rotation | |
| 1911 | ||
| 1912 | if newSize.x < minSize.x or newSize.y < minSize.y or newSize.z < minSize.z then | |
| 1913 | local mesh | |
| 1914 | for _, child in pairs(part:GetChildren()) do | |
| 1915 | if child:IsA("DataModelMesh") then
| |
| 1916 | mesh = child | |
| 1917 | break | |
| 1918 | end | |
| 1919 | end | |
| 1920 | ||
| 1921 | if mesh == nil then | |
| 1922 | mesh = Instance.new("BlockMesh", part)
| |
| 1923 | end | |
| 1924 | ||
| 1925 | local oScale = mesh.Scale | |
| 1926 | local newScale = newSize/minSize * oScale | |
| 1927 | if 0.2 < newSize.x then newScale = Vector3.new(1 * oScale.x, newScale.y, newScale.z) end | |
| 1928 | if 0.2 < newSize.y then newScale = Vector3.new(newScale.x, 1 * oScale.y, newScale.z) end | |
| 1929 | if 0.2 < newSize.z then newScale = Vector3.new(newScale.x, newScale.y, 1 * oScale.z) end | |
| 1930 | ||
| 1931 | mesh.Scale = newScale | |
| 1932 | end | |
| 1933 | end | |
| 1934 | end | |
| 1935 | ||
| 1936 | function getMass(Obj, Total) | |
| 1937 | local newTotal = Total | |
| 1938 | local returnTotal = 0 | |
| 1939 | ||
| 1940 | if Obj:IsA("BasePart") then
| |
| 1941 | newTotal = newTotal + Objects[Obj] | |
| 1942 | elseif BodyObjects[Obj.ClassName] then | |
| 1943 | Obj:Destroy() | |
| 1944 | end | |
| 1945 | ||
| 1946 | if Obj:GetChildren() and #Obj:GetChildren() > 0 then | |
| 1947 | for _,v in pairs(Obj:GetChildren()) do | |
| 1948 | returnTotal = returnTotal + getMass(v, newTotal) | |
| 1949 | end | |
| 1950 | else | |
| 1951 | returnTotal = newTotal | |
| 1952 | end | |
| 1953 | ||
| 1954 | return returnTotal | |
| 1955 | end | |
| 1956 | ||
| 1957 | function getTargFromCurrent() | |
| 1958 | local Current = Current.Part | |
| 1959 | if Current:IsA("BasePart") then
| |
| 1960 | return Current | |
| 1961 | elseif Current:findFirstChild("Torso") then
| |
| 1962 | return Current.Torso | |
| 1963 | else | |
| 1964 | for _,v in pairs(Current:GetChildren()) do | |
| 1965 | if v:IsA("BasePart") then
| |
| 1966 | return v | |
| 1967 | end | |
| 1968 | end | |
| 1969 | end | |
| 1970 | end | |
| 1971 | ||
| 1972 | function Fire(Part, Vec, Inv) | |
| 1973 | pcall(function() | |
| 1974 | Current.BP:Destroy() | |
| 1975 | Current.BP = nil | |
| 1976 | end) | |
| 1977 | pcall(function() | |
| 1978 | Current.BA:Destroy() | |
| 1979 | Current.BA = nil | |
| 1980 | end) | |
| 1981 | pcall(function() | |
| 1982 | if Inv then | |
| 1983 | Part.Velocity = -((Vec - Torso.Position).unit * Grav * 1.1) | |
| 1984 | else | |
| 1985 | Part.Velocity = ((Vec - Camera.CoordinateFrame.p).unit * Grav * 1.1) | |
| 1986 | end | |
| 1987 | Current.Mass = nil | |
| 1988 | end) | |
| 1989 | Reset() | |
| 1990 | end | |
| 1991 | ||
| 1992 | function Reset() | |
| 1993 | LS.Parent = nil | |
| 1994 | RS.Parent = nil | |
| 1995 | ||
| 1996 | OrigLS.Parent = Torso | |
| 1997 | OrigRS.Parent = Torso | |
| 1998 | ||
| 1999 | OrigLS.C0 = LS0 | |
| 2000 | OrigRS.C0 = RS0 | |
| 2001 | end | |
| 2002 | ||
| 2003 | function Start() | |
| 2004 | Cor(function() | |
| 2005 | repeat wait(1/30) until LP.Character and LP.Character.Parent == Workspace and LP.Character:findFirstChild("Torso")
| |
| 2006 | Char = LP.Character | |
| 2007 | PlrGui = LP.PlayerGui | |
| 2008 | Backpack = LP.Backpack | |
| 2009 | Mouse = LP:GetMouse() | |
| 2010 | ||
| 2011 | for _,v in pairs(Cons) do | |
| 2012 | v:disconnect() | |
| 2013 | end | |
| 2014 | Cons = {}
| |
| 2015 | ||
| 2016 | Camera = Workspace.CurrentCamera | |
| 2017 | LastCamCF = Camera.CoordinateFrame | |
| 2018 | AnimJoints = {}
| |
| 2019 | mDown = false | |
| 2020 | Multi = false | |
| 2021 | Grabbing = false | |
| 2022 | Current = {}
| |
| 2023 | Alpha = 1 | |
| 2024 | ||
| 2025 | Head = Char["Head"] | |
| 2026 | Torso = Char["Torso"] | |
| 2027 | Humanoid = Char["Humanoid"] | |
| 2028 | LA = Char["Left Arm"] | |
| 2029 | RA = Char["Right Arm"] | |
| 2030 | LL = Char["Left Leg"] | |
| 2031 | RL = Char["Right Leg"] | |
| 2032 | ||
| 2033 | OrigLS = Torso["Left Shoulder"] | |
| 2034 | OrigRS = Torso["Right Shoulder"] | |
| 2035 | ||
| 2036 | for _,v in pairs(Char:GetChildren()) do | |
| 2037 | if v.Name == ModID then | |
| 2038 | v:Destroy() | |
| 2039 | end | |
| 2040 | end | |
| 2041 | ||
| 2042 | for _,v in pairs(PlrGui:GetChildren()) do | |
| 2043 | if v.Name == "PadsGui" then | |
| 2044 | v:Destroy() | |
| 2045 | end | |
| 2046 | end | |
| 2047 | ||
| 2048 | LS = Instance.new("Weld")
| |
| 2049 | RS = Instance.new("Weld")
| |
| 2050 | ||
| 2051 | LS.Name = OrigLS.Name | |
| 2052 | LS.Part0 = Torso | |
| 2053 | LS.Part1 = LA | |
| 2054 | LS.C0 = LS0 | |
| 2055 | LS.C1 = CFrame.new(0, 0.5, 0, 1, 0, 0, 0, 0, 1, 0, -1, 0) | |
| 2056 | ||
| 2057 | RS.Name = OrigRS.Name | |
| 2058 | RS.Part0 = Torso | |
| 2059 | RS.Part1 = RA | |
| 2060 | RS.C0 = RS0 | |
| 2061 | RS.C1 = CFrame.new(0, 0.5, 0, 1, 0, 0, 0, 0, 1, 0, -1, 0) | |
| 2062 | ||
| 2063 | local Pads = MakePads() | |
| 2064 | local LPad = Pads.LBase | |
| 2065 | local RPad = Pads.RBase | |
| 2066 | ||
| 2067 | weldModel(LPad, true, LPad) | |
| 2068 | weldModel(RPad, true, RPad) | |
| 2069 | ||
| 2070 | local GripWeldL = Instance.new("Weld")
| |
| 2071 | GripWeldL.Name = "GripWeldL" | |
| 2072 | GripWeldL.Part0 = LA | |
| 2073 | GripWeldL.Part1 = LPad | |
| 2074 | GripWeldL.C0 = CFrame.new(0, -1.05, 0) * CFrame.Angles(0, math.rad(180), 0) | |
| 2075 | GripWeldL.Parent = LA | |
| 2076 | ||
| 2077 | local GripWeldR = Instance.new("Weld")
| |
| 2078 | GripWeldR.Name = "GripWeldR" | |
| 2079 | GripWeldR.Part0 = RA | |
| 2080 | GripWeldR.Part1 = RPad | |
| 2081 | GripWeldR.C0 = CFrame.new(0, -1.05, 0) * CFrame.Angles(0, math.rad(180), 0) | |
| 2082 | GripWeldR.Parent = RA | |
| 2083 | ||
| 2084 | local isParts = false | |
| 2085 | ||
| 2086 | table.insert(Cons, Mouse.KeyDown:connect(function(Key) | |
| 2087 | Key = Key:lower() | |
| 2088 | if Key == "z" then | |
| 2089 | --Stuff | |
| 2090 | elseif Key == "f" then | |
| 2091 | local Current = Current.Part | |
| 2092 | if Current and Current.Parent ~= nil and not Multi then | |
| 2093 | Current:BreakJoints() | |
| 2094 | end | |
| 2095 | elseif Key == "q" then | |
| 2096 | if isParts then | |
| 2097 | isParts = false | |
| 2098 | for _,v in pairs(Workspace:GetChildren()) do | |
| 2099 | if v.Name == "MyPartV" and v:IsA("BasePart") then
| |
| 2100 | v:Destroy() | |
| 2101 | end | |
| 2102 | end | |
| 2103 | else | |
| 2104 | isParts = true | |
| 2105 | for i = 1, 50 do | |
| 2106 | local Part = Instance.new("Part")
| |
| 2107 | Part.Color = Color3.new(math.random(), math.random(), math.random()) | |
| 2108 | Part.Transparency = 1 | |
| 2109 | Part.Size = Vector3.new(math.random(1, 3), math.random(1, 3), math.random(1, 3)) | |
| 2110 | Part.Archivable = true | |
| 2111 | Part.CanCollide = false | |
| 2112 | Part.Material = "Plastic" | |
| 2113 | Part.Locked = false | |
| 2114 | Part.CFrame = Torso.CFrame * CFrame.new(math.random(-15, 15), -1, math.random(-15, 15)) | |
| 2115 | Part.Anchored = true | |
| 2116 | Part.Name = "MyPartV" | |
| 2117 | Part.TopSurface = "Smooth" | |
| 2118 | Part.BottomSurface = "Smooth" | |
| 2119 | Part.Parent = Workspace | |
| 2120 | end | |
| 2121 | end | |
| 2122 | elseif Key == "e" then | |
| 2123 | local Targ; | |
| 2124 | if Current.Part and Current.Part ~= nil then | |
| 2125 | Targ = getTargFromCurrent() | |
| 2126 | else | |
| 2127 | Targ = LastPart | |
| 2128 | end | |
| 2129 | if Targ and Targ.Parent ~= nil and not Multi then | |
| 2130 | local Ex = Instance.new("Explosion", Workspace)
| |
| 2131 | Ex.Position = Targ.CFrame.p | |
| 2132 | Ex.BlastRadius = 16 | |
| 2133 | Ex.DestroyJointRadiusPercent = 0.5 | |
| 2134 | end | |
| 2135 | elseif Key == "c" then | |
| 2136 | if Current.Part and Current.Part.Parent ~= nil and not Multi then | |
| 2137 | local Part = getTargFromCurrent() | |
| 2138 | if Part then | |
| 2139 | Grabbing = false | |
| 2140 | if Mouse.Hit then | |
| 2141 | local TargPos = CFrame.new(Camera.CoordinateFrame.p, Mouse.Hit.p) * CFrame.new(0, 0, -1000) | |
| 2142 | Fire(Part, TargPos.p) | |
| 2143 | else | |
| 2144 | Fire(Part, Mouse.Origin.p + Mouse.UnitRay.Direction, true) | |
| 2145 | end | |
| 2146 | end | |
| 2147 | end | |
| 2148 | end | |
| 2149 | end)) | |
| 2150 | ||
| 2151 | table.insert(Cons, Mouse.Button1Up:connect(function() | |
| 2152 | mDown = false | |
| 2153 | if Grabbing == true and Multi == false then | |
| 2154 | Grabbing = false | |
| 2155 | Reset() | |
| 2156 | end | |
| 2157 | if Current.Part ~= nil then | |
| 2158 | LastPart = getTargFromCurrent() | |
| 2159 | Current = {}
| |
| 2160 | end | |
| 2161 | end)) | |
| 2162 | ||
| 2163 | local function makeLightning(Par, Start, End, Width, Length, RandomScale, ArcScale, Num1) | |
| 2164 | local oldParts = {}
| |
| 2165 | for _,v in pairs(Par:GetChildren()) do | |
| 2166 | v.CFrame = CFrame.new(5e5, 5e5, 5e5) | |
| 2167 | table.insert(oldParts, v) | |
| 2168 | end | |
| 2169 | local Distance = (Start-End).Magnitude | |
| 2170 | local ArcScale = ArcScale or 1 | |
| 2171 | local RandomScale = RandomScale or 0 | |
| 2172 | local Last = Start | |
| 2173 | local IterNum = 0 | |
| 2174 | ||
| 2175 | while Par.Parent do | |
| 2176 | IterNum = IterNum + 1 | |
| 2177 | local New = nil | |
| 2178 | if (Last-End).Magnitude < Length then | |
| 2179 | New = CFrame.new(End) | |
| 2180 | else | |
| 2181 | if (End-Last).Magnitude < Length*2 then | |
| 2182 | RandomScale = RandomScale*0.5 | |
| 2183 | ArcScale = ArcScale*0.5 | |
| 2184 | end | |
| 2185 | local Direct = CFrame.new(Last,End) | |
| 2186 | New = Direct*CFrame.Angles(math.rad(math.random(-RandomScale/4,RandomScale*ArcScale)),math.rad(math.random(-RandomScale,RandomScale)),math.rad(math.random(-RandomScale,RandomScale))) | |
| 2187 | New = New*CFrame.new(0,0,-Length) | |
| 2188 | end | |
| 2189 | local Trail = nil | |
| 2190 | if oldParts[IterNum] then | |
| 2191 | Trail = oldParts[IterNum] | |
| 2192 | Trail.BrickColor = ((Num1 % 2 == 0) and BrickColor.new("White")) or BrickColor.new("White")
| |
| 2193 | Trail.Size = Vector3.new(Width, (Last-New.p).Magnitude, Width) | |
| 2194 | Trail.CFrame = CFrame.new(New.p, Last)*CFrame.Angles(math.rad(90),0,0)*CFrame.new(0, -(Last-New.p).Magnitude/2, 0) | |
| 2195 | oldParts[IterNum] = nil | |
| 2196 | else | |
| 2197 | Trail = Instance.new("Part")
| |
| 2198 | Trail.Name = "Part" | |
| 2199 | Trail.FormFactor = "Custom" | |
| 2200 | Trail.BrickColor = ((Num1 % 2 == 0) and BrickColor.new("White")) or BrickColor.new("White")
| |
| 2201 | Trail.Transparency = 1 | |
| 2202 | Trail.Anchored = true | |
| 2203 | Trail.CanCollide = false | |
| 2204 | Trail.Locked = true | |
| 2205 | Trail.BackSurface = "SmoothNoOutlines" | |
| 2206 | Trail.BottomSurface = "SmoothNoOutlines" | |
| 2207 | Trail.FrontSurface = "SmoothNoOutlines" | |
| 2208 | Trail.LeftSurface = "SmoothNoOutlines" | |
| 2209 | Trail.RightSurface = "SmoothNoOutlines" | |
| 2210 | Trail.TopSurface = "SmoothNoOutlines" | |
| 2211 | Trail.Material = "Neon" | |
| 2212 | Trail.Size = Vector3.new(Width, (Last-New.p).Magnitude, Width) | |
| 2213 | Trail.CFrame = CFrame.new(New.p, Last)*CFrame.Angles(math.rad(90),0,0)*CFrame.new(0, -(Last-New.p).Magnitude/2, 0) | |
| 2214 | Trail.Parent = Par | |
| 2215 | end | |
| 2216 | Last = New.p | |
| 2217 | if (Last-End).Magnitude < 1 then | |
| 2218 | break | |
| 2219 | end | |
| 2220 | end | |
| 2221 | for _,v in pairs(oldParts) do | |
| 2222 | v:Destroy() | |
| 2223 | end | |
| 2224 | end | |
| 2225 | ||
| 2226 | table.insert(Cons, Mouse.Button1Down:connect(function() | |
| 2227 | mDown = true | |
| 2228 | local Targ = Mouse.Target | |
| 2229 | Cor(function() | |
| 2230 | if Targ and Objects[Targ] and not Multi then | |
| 2231 | Grabbing = true | |
| 2232 | Current.Part = Targ | |
| 2233 | local Mass = Objects[Targ] | |
| 2234 | local ForceNum = 0 | |
| 2235 | local Hum = nil | |
| 2236 | ||
| 2237 | for _,v in pairs(Targ:GetChildren()) do | |
| 2238 | if BodyObjects[v.ClassName] then | |
| 2239 | v:Destroy() | |
| 2240 | end | |
| 2241 | end | |
| 2242 | ||
| 2243 | for _,v in pairs(Workspace:GetChildren()) do | |
| 2244 | if v:findFirstChild("Humanoid") and v:IsAncestorOf(Targ) then
| |
| 2245 | Hum = v.Humanoid | |
| 2246 | Mass = getMass(v, 0) | |
| 2247 | Current.Part = v | |
| 2248 | break | |
| 2249 | end | |
| 2250 | end | |
| 2251 | ||
| 2252 | Current.Mass = Mass | |
| 2253 | ||
| 2254 | if not Hum then | |
| 2255 | Targ:BreakJoints() | |
| 2256 | end | |
| 2257 | ||
| 2258 | ForceNum = Mass * Grav | |
| 2259 | Targ.CanCollide = true | |
| 2260 | Targ.Anchored = false | |
| 2261 | ||
| 2262 | local BP = Instance.new("BodyPosition")
| |
| 2263 | BP.maxForce = Vector3.new(3 * ForceNum, 3 * ForceNum, 3 * ForceNum) | |
| 2264 | BP.Parent = Targ | |
| 2265 | ||
| 2266 | local Ang = Instance.new("BodyAngularVelocity")
| |
| 2267 | Ang.Parent = Targ | |
| 2268 | ||
| 2269 | Current.BP = BP | |
| 2270 | Current.BA = Ang | |
| 2271 | ||
| 2272 | OrigLS.Parent = nil | |
| 2273 | OrigRS.Parent = nil | |
| 2274 | ||
| 2275 | LS.Parent = Torso | |
| 2276 | RS.Parent = Torso | |
| 2277 | ||
| 2278 | LS.C0 = LS0 | |
| 2279 | RS.C0 = RS0 | |
| 2280 | ||
| 2281 | local DirDot = Mouse.UnitRay.Direction:Dot(Targ.Position - Mouse.Origin.p) | |
| 2282 | local BPPos = Vector3.new(0, 0, 0) | |
| 2283 | local Vel = Vector3.new(0, 0, 0) | |
| 2284 | local Vlev = random() * math.pi | |
| 2285 | local RPos = Vector3.new(random() * 2 - 1, cos(Vlev), random() * 2 - 1) | |
| 2286 | ||
| 2287 | local Ball = Instance.new("Part")
| |
| 2288 | Ball.Name = "Ball" | |
| 2289 | Ball.FormFactor = "Custom" | |
| 2290 | Ball.Color = Color3.new(0, 0, 0) | |
| 2291 | Ball.Transparency = 1 | |
| 2292 | Ball.Anchored = true | |
| 2293 | Ball.CanCollide = false | |
| 2294 | Ball.Locked = true | |
| 2295 | Ball.BottomSurface, Ball.TopSurface = "Smooth", "Smooth" | |
| 2296 | Ball.Size = Vector3.new(0.5, 0.5, 0.5) | |
| 2297 | Ball.CFrame = Torso.CFrame * CFrame.new(0, 1, -3) | |
| 2298 | Ball.Parent = Char | |
| 2299 | ||
| 2300 | if Targ.Name == "MyPartV" then | |
| 2301 | Targ.Name = "MyPartF" | |
| 2302 | end | |
| 2303 | ||
| 2304 | local LightMod = Instance.new("Model", Char)
| |
| 2305 | ||
| 2306 | local Mesh = Instance.new("SpecialMesh")
| |
| 2307 | Mesh.MeshType = "Sphere" | |
| 2308 | Mesh.Parent = Ball | |
| 2309 | ||
| 2310 | local Size = 1 | |
| 2311 | local Rise = true | |
| 2312 | ||
| 2313 | while Grabbing and BP and Ang and Targ.Parent ~= nil do | |
| 2314 | local BPPos = Mouse.Origin.p + Mouse.UnitRay.Direction * DirDot | |
| 2315 | Ang.angularvelocity = Vel | |
| 2316 | BP.position = BPPos + RPos | |
| 2317 | RPos = Vector3.new(max(-1, min(RPos.x + random() * 0.02 - 0.01, 1)), cos(Vlev), max(-1, min(RPos.z + random() * 0.02 - 0.01, 1))) | |
| 2318 | Vel = Vector3.new(max(-1, min(Vel.x + random() * 0.2 - 0.1, 1)), max(-1, min(Vel.y + random() * 0.2 - 0.1, 1)), max(-1, min(Vel.z + random() * 0.2 - 0.1, 1))) | |
| 2319 | Vlev = (Vlev + 0.05) % tau | |
| 2320 | ||
| 2321 | if Hum then | |
| 2322 | Hum.Sit = true | |
| 2323 | end | |
| 2324 | ||
| 2325 | if LA.Parent ~= nil and RA.Parent ~= nil then | |
| 2326 | local LPos = (LA.CFrame * CFrame.new(0, -1, 0)).p | |
| 2327 | local RPos = (RA.CFrame * CFrame.new(0, -1, 0)).p | |
| 2328 | if Rise == true then | |
| 2329 | if Size < 0.6 then | |
| 2330 | Size = Size + 0.05 | |
| 2331 | else | |
| 2332 | Size = Size + 0.1 | |
| 2333 | end | |
| 2334 | if Size >= 2.2 then | |
| 2335 | Rise = false | |
| 2336 | end | |
| 2337 | else | |
| 2338 | if Size > 2.1 then | |
| 2339 | Size = Size - 0.05 | |
| 2340 | else | |
| 2341 | Size = Size - 0.1 | |
| 2342 | end | |
| 2343 | if Size <= 0.5 then | |
| 2344 | Rise = true | |
| 2345 | end | |
| 2346 | end | |
| 2347 | Ball.Size = Vector3.new(Size, Size, Size) | |
| 2348 | Ball.CFrame = CFrame.new(LPos:Lerp(RPos, 0.5), Targ.Position) * CFrame.new(0, 0, -2.2) | |
| 2349 | LightNum = LightNum + 1 | |
| 2350 | makeLightning(LightMod, Ball.Position, Targ.Position, 0.2, 4, 50, 1, LightNum) | |
| 2351 | elseif Ball.Parent ~= nil then | |
| 2352 | Ball:Destroy() | |
| 2353 | end | |
| 2354 | ||
| 2355 | if LS and LS.Parent == Torso then | |
| 2356 | LS.C0 = CFrame.new(Vector3.new(-1.5, 0.5, 0), Torso.CFrame:pointToObjectSpace((Targ.CFrame or Torso.CFrame * CFrame.new(-1.5, 0.5, 1)).p)) | |
| 2357 | end | |
| 2358 | if RS and RS.Parent == Torso then | |
| 2359 | RS.C0 = CFrame.new(Vector3.new(1.5, 0.5, 0), Torso.CFrame:pointToObjectSpace((Targ.CFrame or Torso.CFrame * CFrame.new(1.5, 0.5, 1)).p)) | |
| 2360 | end | |
| 2361 | RunService.Heartbeat:wait() | |
| 2362 | end | |
| 2363 | ||
| 2364 | coroutine.resume(coroutine.create(function() | |
| 2365 | for i = 0.5, 1, 0.1 do | |
| 2366 | for i2,v in pairs(LightMod:GetChildren()) do | |
| 2367 | --v.Light.Range = 6-(i*5) | |
| 2368 | v.Transparency = 1 | |
| 2369 | end | |
| 2370 | wait(1/30) | |
| 2371 | end | |
| 2372 | LightMod:Destroy() | |
| 2373 | end)) | |
| 2374 | ||
| 2375 | if BP and BP.Parent ~= nil then | |
| 2376 | BP:Destroy() | |
| 2377 | end | |
| 2378 | ||
| 2379 | if Ang and Ang.Parent ~= nil then | |
| 2380 | Ang:Destroy() | |
| 2381 | end | |
| 2382 | ||
| 2383 | pcall(function() Ball:Destroy() end) | |
| 2384 | end | |
| 2385 | end) | |
| 2386 | end)) | |
| 2387 | end) | |
| 2388 | end | |
| 2389 | ||
| 2390 | function Add(Obj) | |
| 2391 | if Obj:IsA("BasePart") and not Objects[Obj] and not (Obj.Name == "Base" and Obj.ClassName == "Part") then
| |
| 2392 | Objects[Obj] = Obj:GetMass() | |
| 2393 | Obj.Changed:connect(function(P) | |
| 2394 | if P:lower() == "size" and Objects[Obj] and Obj.Parent ~= nil then | |
| 2395 | Objects[Obj] = Obj:GetMass() | |
| 2396 | end | |
| 2397 | end) | |
| 2398 | end | |
| 2399 | end | |
| 2400 | ||
| 2401 | function Rem(Obj) | |
| 2402 | if Objects[Obj] then | |
| 2403 | Objects[Obj] = nil | |
| 2404 | end | |
| 2405 | end | |
| 2406 | ||
| 2407 | function Recursion(Obj) | |
| 2408 | ypcall(function() | |
| 2409 | Add(Obj) | |
| 2410 | if #Obj:GetChildren() > 0 then | |
| 2411 | for _,v in pairs(Obj:GetChildren()) do | |
| 2412 | Recursion(v) | |
| 2413 | end | |
| 2414 | end | |
| 2415 | end) | |
| 2416 | end | |
| 2417 | ||
| 2418 | Workspace.DescendantAdded:connect(function(Obj) | |
| 2419 | Add(Obj) | |
| 2420 | end) | |
| 2421 | ||
| 2422 | Workspace.DescendantRemoving:connect(function(Obj) | |
| 2423 | Rem(Obj) | |
| 2424 | end) | |
| 2425 | ||
| 2426 | for _,v in pairs(Workspace:GetChildren()) do | |
| 2427 | Recursion(v) | |
| 2428 | end | |
| 2429 | ||
| 2430 | Start() | |
| 2431 | ||
| 2432 | if LP.Name == PlrName then | |
| 2433 | LP.CharacterAdded:connect(Start) | |
| 2434 | end | |
| 2435 | Char.Humanoid.MaxHealth = 50000 | |
| 2436 | Char.Humanoid.Health = 50000 | |
| 2437 | --Responsible for regening a player's humanoid's health | |
| 2438 | ||
| 2439 | -- declarations | |
| 2440 | local Figure = script.Parent | |
| 2441 | local Head = Figure:WaitForChild("Head")
| |
| 2442 | local Humanoid = Figure:WaitForChild("Humanoid")
| |
| 2443 | local regening = false | |
| 2444 | ||
| 2445 | -- regeneration | |
| 2446 | function regenHealth() | |
| 2447 | if regening then return end | |
| 2448 | regening = true | |
| 2449 | ||
| 2450 | while Humanoid.Health < Humanoid.MaxHealth do | |
| 2451 | local s = wait(0.1) | |
| 2452 | local health = Humanoid.Health | |
| 2453 | if health > 0 and health < Humanoid.MaxHealth then | |
| 2454 | local newHealthDelta = 0.1 * s * Humanoid.MaxHealth | |
| 2455 | health = health + newHealthDelta | |
| 2456 | Humanoid.Health = math.min(health,Humanoid.MaxHealth) | |
| 2457 | end | |
| 2458 | end | |
| 2459 | ||
| 2460 | if Humanoid.Health > Humanoid.MaxHealth then | |
| 2461 | Humanoid.Health = Humanoid.MaxHealth | |
| 2462 | end | |
| 2463 | ||
| 2464 | regening = false | |
| 2465 | end | |
| 2466 | ||
| 2467 | Humanoid.HealthChanged:connect(regenHealth) | |
| 2468 | Me = game.Players.LocalPlayer | |
| 2469 | char = Me.Character | |
| 2470 | larm = char["Left Arm"] | |
| 2471 | rarm = char["Right Arm"] | |
| 2472 | lleg = char["Left Leg"] | |
| 2473 | rleg = char["Right Leg"] | |
| 2474 | torso = char.Torso | |
| 2475 | ||
| 2476 | ||
| 2477 | ||
| 2478 | -------------------------- | |
| 2479 | ||
| 2480 | --[[ High Quality Sound Script | |
| 2481 | --Immune to g/c g/nol/all g/nos/all, and sound doesn't lag --You can also paste your script there and put this in the end. | |
| 2482 | --- full credits to saud20 --Also, edit friendly so you can place this in your script for a weapon song or somethin | |
| 2483 | ]] | |
| 2484 | Effects = {} --sound effects, for advanced players.
| |
| 2485 | local Player = game.Players.localPlayer | |
| 2486 | local Character = Player.Character | |
| 2487 | local Humanoid = Character.Humanoid | |
| 2488 | z = Instance.new("Sound", Character)
| |
| 2489 | z.SoundId = "rbxassetid://152201694"-- | |
| 2490 | z.Looped = true --False for a one-time song. | |
| 2491 | z.Pitch = 1.3 | |
| 2492 | z.Volume = 1.3 | |
| 2493 | wait(.1) | |
| 2494 | z:Play() | |
| 2495 | ------------------------Paste your script here if you want to add a song to your script. VVVVVVV |