SHOW:
|
|
- or go back to the newest paste.
| 1 | --https://github.com/Mokiros/roblox-FE-compatibility | |
| 2 | if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
| |
| 3 | local Player,game,owner = owner,game | |
| 4 | local RealPlayer = Player | |
| 5 | do | |
| 6 | print("FE Compatibility code V2 by Mokiros")
| |
| 7 | local RealPlayer = RealPlayer | |
| 8 | script.Parent = RealPlayer.Character | |
| 9 | ||
| 10 | --Fake event to make stuff like Mouse.KeyDown work | |
| 11 | local Disconnect_Function = function(this) | |
| 12 | this[1].Functions[this[2]] = nil | |
| 13 | end | |
| 14 | local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
| |
| 15 | local FakeEvent_Metatable = {__index={
| |
| 16 | Connect = function(this,f) | |
| 17 | local i = tostring(math.random(0,10000)) | |
| 18 | while this.Functions[i] do | |
| 19 | i = tostring(math.random(0,10000)) | |
| 20 | end | |
| 21 | this.Functions[i] = f | |
| 22 | return setmetatable({this,i},Disconnect_Metatable)
| |
| 23 | end | |
| 24 | }} | |
| 25 | FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect | |
| 26 | local function fakeEvent() | |
| 27 | return setmetatable({Functions={}},FakeEvent_Metatable)
| |
| 28 | end | |
| 29 | ||
| 30 | --Creating fake input objects with fake variables | |
| 31 | local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
| |
| 32 | FakeMouse.keyUp = FakeMouse.KeyUp | |
| 33 | FakeMouse.keyDown = FakeMouse.KeyDown | |
| 34 | local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
| |
| 35 | local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
| |
| 36 | CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
| |
| 37 | end} | |
| 38 | --Merged 2 functions into one by checking amount of arguments | |
| 39 | CAS.UnbindAction = CAS.BindAction | |
| 40 | ||
| 41 | --This function will trigger the events that have been :Connect()'ed | |
| 42 | local function TriggerEvent(self,ev,...) | |
| 43 | for _,f in pairs(self[ev].Functions) do | |
| 44 | f(...) | |
| 45 | end | |
| 46 | end | |
| 47 | FakeMouse.TriggerEvent = TriggerEvent | |
| 48 | UIS.TriggerEvent = TriggerEvent | |
| 49 | ||
| 50 | --Client communication | |
| 51 | local Event = Instance.new("RemoteEvent")
| |
| 52 | Event.Name = "UserInput_Event" | |
| 53 | Event.OnServerEvent:Connect(function(plr,io) | |
| 54 | if plr~=RealPlayer then return end | |
| 55 | FakeMouse.Target = io.Target | |
| 56 | FakeMouse.Hit = io.Hit | |
| 57 | if not io.isMouse then | |
| 58 | local b = io.UserInputState == Enum.UserInputState.Begin | |
| 59 | if io.UserInputType == Enum.UserInputType.MouseButton1 then | |
| 60 | return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up") | |
| 61 | end | |
| 62 | if io.UserInputType == Enum.UserInputType.MouseButton2 then | |
| 63 | return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up") | |
| 64 | end | |
| 65 | for _,t in pairs(CAS.Actions) do | |
| 66 | for _,k in pairs(t.Keys) do | |
| 67 | if k==io.KeyCode then | |
| 68 | t.Function(t.Name,io.UserInputState,io) | |
| 69 | end | |
| 70 | end | |
| 71 | end | |
| 72 | FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower()) | |
| 73 | UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false) | |
| 74 | end | |
| 75 | end) | |
| 76 | Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
| |
| 77 | local Mouse = owner:GetMouse() | |
| 78 | local UIS = game:GetService("UserInputService")
| |
| 79 | local input = function(io,RobloxHandled) | |
| 80 | if RobloxHandled then return end | |
| 81 | --Since InputObject is a client-side instance, we create and pass table instead | |
| 82 | Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
| |
| 83 | end | |
| 84 | UIS.InputBegan:Connect(input) | |
| 85 | UIS.InputEnded:Connect(input) | |
| 86 | ||
| 87 | local h,t | |
| 88 | --Give the server mouse data every second frame, but only if the values changed | |
| 89 | --If player is not moving their mouse, client won't fire events | |
| 90 | local HB = game:GetService("RunService").Heartbeat
| |
| 91 | while true do | |
| 92 | if h~=Mouse.Hit or t~=Mouse.Target then | |
| 93 | h,t=Mouse.Hit,Mouse.Target | |
| 94 | Event:FireServer({isMouse=true,Target=t,Hit=h})
| |
| 95 | end | |
| 96 | --Wait 2 frames | |
| 97 | for i=1,2 do | |
| 98 | HB:Wait() | |
| 99 | end | |
| 100 | end]==],script) | |
| 101 | ||
| 102 | ----Sandboxed game object that allows the usage of client-side methods and services | |
| 103 | --Real game object | |
| 104 | local RealGame = game | |
| 105 | ||
| 106 | --Metatable for fake service | |
| 107 | local FakeService_Metatable = {
| |
| 108 | __index = function(self,k) | |
| 109 | local s = rawget(self,"_RealService") | |
| 110 | if s then | |
| 111 | return typeof(s[k])=="function" | |
| 112 | and function(_,...)return s[k](s,...)end or s[k] | |
| 113 | end | |
| 114 | end, | |
| 115 | __newindex = function(self,k,v) | |
| 116 | local s = rawget(self,"_RealService") | |
| 117 | if s then s[k]=v end | |
| 118 | end | |
| 119 | } | |
| 120 | local function FakeService(t,RealService) | |
| 121 | t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService | |
| 122 | return setmetatable(t,FakeService_Metatable) | |
| 123 | end | |
| 124 | ||
| 125 | --Fake game object | |
| 126 | local FakeGame = {
| |
| 127 | GetService = function(self,s) | |
| 128 | return rawget(self,s) or RealGame:GetService(s) | |
| 129 | end, | |
| 130 | Players = FakeService({
| |
| 131 | LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
| |
| 132 | },"Players"), | |
| 133 | UserInputService = FakeService(UIS,"UserInputService"), | |
| 134 | ContextActionService = FakeService(CAS,"ContextActionService"), | |
| 135 | RunService = FakeService({
| |
| 136 | _btrs = {},
| |
| 137 | RenderStepped = RealGame:GetService("RunService").Heartbeat,
| |
| 138 | BindToRenderStep = function(self,name,_,fun) | |
| 139 | self._btrs[name] = self.Heartbeat:Connect(fun) | |
| 140 | end, | |
| 141 | UnbindFromRenderStep = function(self,name) | |
| 142 | self._btrs[name]:Disconnect() | |
| 143 | end, | |
| 144 | },"RunService") | |
| 145 | } | |
| 146 | rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer) | |
| 147 | FakeGame.service = FakeGame.GetService | |
| 148 | FakeService(FakeGame,game) | |
| 149 | --Changing owner to fake player object to support owner:GetMouse() | |
| 150 | game,owner = FakeGame,FakeGame.Players.LocalPlayer | |
| 151 | end | |
| 152 | ||
| 153 | local isScriptNil = false | |
| 154 | ||
| 155 | local Hint = Instance.new('Hint', game.Workspace)
| |
| 156 | Hint.Text = "Script Loaded... Made by Cronizete" | |
| 157 | wait(2) | |
| 158 | Hint:Destroy() | |
| 159 | local PlrName = "fennybunny" | |
| 160 | local Plrs = game:GetService("Players")
| |
| 161 | local RunService = game:GetService("RunService")
| |
| 162 | local Content = game:GetService("ContentProvider")
| |
| 163 | local LP = Plrs.LocalPlayer | |
| 164 | local Char = LP.Character | |
| 165 | local PlrGui = LP.PlayerGui | |
| 166 | local Backpack = LP.Backpack | |
| 167 | local Mouse = LP:GetMouse() | |
| 168 | ||
| 169 | local Camera = Workspace.CurrentCamera | |
| 170 | local LastCamCF = Camera.CoordinateFrame | |
| 171 | local AnimJoints = {}
| |
| 172 | local Cons = {}
| |
| 173 | local mDown = false | |
| 174 | local Multi = false | |
| 175 | local Grabbing = false | |
| 176 | local Current = {}
| |
| 177 | local Alpha = 1 | |
| 178 | local LightNum = 1 | |
| 179 | ||
| 180 | Current.Part = nil | |
| 181 | Current.BP = nil | |
| 182 | Current.BA = nil | |
| 183 | Current.Mass = nil | |
| 184 | ||
| 185 | local LastPart = nil | |
| 186 | ||
| 187 | local Head = Char["Head"] | |
| 188 | local Torso = Char["Torso"] | |
| 189 | local Humanoid = Char["Humanoid"] | |
| 190 | local LA = Char["Left Arm"] | |
| 191 | local RA = Char["Right Arm"] | |
| 192 | local LL = Char["Left Leg"] | |
| 193 | local RL = Char["Right Leg"] | |
| 194 | ||
| 195 | local LS, RS; | |
| 196 | ||
| 197 | local OrigLS = Torso["Left Shoulder"] | |
| 198 | local OrigRS = Torso["Right Shoulder"] | |
| 199 | ||
| 200 | for _,v in pairs(Char:GetChildren()) do | |
| 201 | if v.Name == ModID then | |
| 202 | v:Destroy() | |
| 203 | end | |
| 204 | end | |
| 205 | ||
| 206 | for _,v in pairs(PlrGui:GetChildren()) do | |
| 207 | if v.Name == "PadsGui" then | |
| 208 | v:Destroy() | |
| 209 | end | |
| 210 | end | |
| 211 | ||
| 212 | local ModID = "Pads" | |
| 213 | local Objects = {}
| |
| 214 | local Grav = 196.2 | |
| 215 | ||
| 216 | local sin=math.sin | |
| 217 | local cos=math.cos | |
| 218 | local max=math.max | |
| 219 | local min=math.min | |
| 220 | local atan2=math.atan2 | |
| 221 | local random=math.random | |
| 222 | local tau = 2 * math.pi | |
| 223 | ||
| 224 | local BodyObjects = {
| |
| 225 | ["BodyVelocity"] = true; | |
| 226 | ["BodyAngularVelocity"] = true; | |
| 227 | ["BodyForce"] = true; | |
| 228 | ["BodyThrust"] = true; | |
| 229 | ["BodyPosition"] = true; | |
| 230 | ["RocketPropulsion"] = true; | |
| 231 | } | |
| 232 | ||
| 233 | if LP.Name == PlrName and isScriptNil then | |
| 234 | script.Parent = nil | |
| 235 | end | |
| 236 | ||
| 237 | LP.CameraMode = "Classic" | |
| 238 | ||
| 239 | local Assets = {
| |
| 240 | } | |
| 241 | ||
| 242 | local LS0, LS1 = OrigLS.C0, OrigLS.C1 | |
| 243 | local RS0, RS1 = OrigRS.C0, OrigRS.C1 | |
| 244 | ||
| 245 | for i,v in pairs(Assets) do | |
| 246 | local ID = tostring(Assets[i]) | |
| 247 | Assets[i] = "http://www.roblox.com/asset/?id=" .. ID | |
| 248 | Content:Preload("http://www.roblox.com/asset/?id=" .. ID)
| |
| 249 | end | |
| 250 | ||
| 251 | function QuaternionFromCFrame(cf) | |
| 252 | local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components(); | |
| 253 | local trace = m00 + m11 + m22 if trace > 0 then | |
| 254 | local s = math.sqrt(1 + trace); | |
| 255 | local recip = 0.5/s; | |
| 256 | return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5; | |
| 257 | else | |
| 258 | local i = 0; | |
| 259 | if m11 > m00 then | |
| 260 | i = 1; | |
| 261 | end; | |
| 262 | if m22 > (i == 0 and m00 or m11) then | |
| 263 | i = 2 end if i == 0 then | |
| 264 | local s = math.sqrt(m00-m11-m22+1); | |
| 265 | local recip = 0.5/s return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip; | |
| 266 | elseif i == 1 then | |
| 267 | local s = math.sqrt(m11-m22-m00+1); | |
| 268 | local recip = 0.5/s; | |
| 269 | return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip ; | |
| 270 | elseif i == 2 then | |
| 271 | local s = math.sqrt(m22-m00-m11+1); | |
| 272 | local recip = 0.5/s; | |
| 273 | return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip; | |
| 274 | end; | |
| 275 | end; | |
| 276 | end; | |
| 277 | ||
| 278 | function QuaternionToCFrame(px, py, pz, x, y, z, w) | |
| 279 | local xs, ys, zs = x + x, y + y, z + z; | |
| 280 | local wx, wy, wz = w*xs, w*ys, w*zs; | |
| 281 | local xx = x*xs; | |
| 282 | local xy = x*ys; | |
| 283 | local xz = x*zs; | |
| 284 | local yy = y*ys; | |
| 285 | local yz = y*zs; | |
| 286 | local zz = z*zs; | |
| 287 | 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)) | |
| 288 | end; | |
| 289 | ||
| 290 | function QuaternionSlerp(a, b, t) | |
| 291 | local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4]; | |
| 292 | local startInterp, finishInterp; | |
| 293 | if cosTheta >= 0.0001 then | |
| 294 | if (1 - cosTheta) > 0.0001 then | |
| 295 | local theta = math.acos(cosTheta); | |
| 296 | local invSinTheta = 1/math.sin(theta); | |
| 297 | startInterp = math.sin((1-t)*theta)*invSinTheta; | |
| 298 | finishInterp = math.sin(t*theta)*invSinTheta; | |
| 299 | else | |
| 300 | startInterp = 1-t finishInterp = t; | |
| 301 | end; | |
| 302 | else | |
| 303 | if (1+cosTheta) > 0.0001 then | |
| 304 | local theta = math.acos(-cosTheta); | |
| 305 | local invSinTheta = 1/math.sin(theta); | |
| 306 | startInterp = math.sin((t-1)*theta)*invSinTheta; | |
| 307 | finishInterp = math.sin(t*theta)*invSinTheta; | |
| 308 | else startInterp = t-1 finishInterp = t; | |
| 309 | end; | |
| 310 | end; | |
| 311 | 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; | |
| 312 | end; | |
| 313 | ||
| 314 | function CLerp(a,b,t) | |
| 315 | local qa={QuaternionFromCFrame(a)};
| |
| 316 | local qb={QuaternionFromCFrame(b)};
| |
| 317 | local ax,ay,az=a.x,a.y,a.z; | |
| 318 | local bx,by,bz=b.x,b.y,b.z; | |
| 319 | local _t=1-t; | |
| 320 | return QuaternionToCFrame(_t*ax+t*bx,_t*ay+t*by,_t*az+t*bz,QuaternionSlerp(qa, qb, t)); | |
| 321 | end | |
| 322 | ||
| 323 | function GetWeld(weld) | |
| 324 | local obj | |
| 325 | for i, v in pairs(AnimJoints) do | |
| 326 | if v[1] == weld then | |
| 327 | obj = v | |
| 328 | break | |
| 329 | end | |
| 330 | end | |
| 331 | if not obj then | |
| 332 | obj = {weld,NV}
| |
| 333 | table.insert(AnimJoints,obj) | |
| 334 | end | |
| 335 | return weld.C0.p, obj[2] | |
| 336 | end | |
| 337 | ||
| 338 | function SetWeld(weld, i, loops, origpos, origangle, nextpos, nextangle, override, overrideLower, smooth) | |
| 339 | smooth = smooth or 1 | |
| 340 | local obj | |
| 341 | for i, v in pairs(AnimJoints) do | |
| 342 | if v[1] == weld then | |
| 343 | obj = v | |
| 344 | break | |
| 345 | end | |
| 346 | end | |
| 347 | if not obj then | |
| 348 | obj = {weld,NV}
| |
| 349 | table.insert(AnimJoints,obj) | |
| 350 | end | |
| 351 | ||
| 352 | local perc = (smooth == 1 and math.sin((math.pi/2)/loops*i)) or i/loops | |
| 353 | ||
| 354 | local tox,toy,toz = 0,0,0 | |
| 355 | tox = math.abs(origangle.x - nextangle.x) *perc | |
| 356 | toy = math.abs(origangle.y - nextangle.y) *perc | |
| 357 | toz = math.abs(origangle.z - nextangle.z) *perc | |
| 358 | tox = ((origangle.x > nextangle.x and -tox) or tox) | |
| 359 | toy = ((origangle.y > nextangle.y and -toy) or toy) | |
| 360 | toz = ((origangle.z > nextangle.z and -toz) or toz) | |
| 361 | ||
| 362 | local tox2,toy2,toz2 = 0,0,0 | |
| 363 | tox2 = math.abs(origpos.x - nextpos.x) *perc | |
| 364 | toy2 = math.abs(origpos.y - nextpos.y) *perc | |
| 365 | toz2 = math.abs(origpos.z - nextpos.z) *perc | |
| 366 | tox2 = (origpos.x > nextpos.x and -tox2) or tox2 | |
| 367 | toy2 = (origpos.y > nextpos.y and -toy2) or toy2 | |
| 368 | toz2 = (origpos.z > nextpos.z and -toz2) or toz2 | |
| 369 | ||
| 370 | obj[2] = Vector3.new(origangle.x + tox, origangle.y + toy, origangle.z + toz) | |
| 371 | weld.C0 = CFrame.new(origpos.x + tox2,origpos.y + toy2,origpos.z + toz2) * CFrame.Angles(origangle.x + tox,origangle.y + toy,origangle.z + toz) | |
| 372 | end | |
| 373 | ||
| 374 | function RotateCamera(x, y) | |
| 375 | 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) | |
| 376 | end | |
| 377 | ||
| 378 | function GetAngles(cf) | |
| 379 | local lv = cf.lookVector | |
| 380 | return -math.asin(lv.y), math.atan2(lv.x, -lv.z) | |
| 381 | end | |
| 382 | ||
| 383 | local LastCamCF = Camera.CoordinateFrame | |
| 384 | ||
| 385 | function Look() | |
| 386 | if AlphaOn == true then | |
| 387 | local x, y = GetAngles(LastCamCF:toObjectSpace(Camera.CoordinateFrame)) | |
| 388 | Camera.CoordinateFrame = LastCamCF | |
| 389 | RotateCamera(x * -(Alpha), y * -(Alpha)) | |
| 390 | LastCamCF = Camera.CoordinateFrame | |
| 391 | end | |
| 392 | end | |
| 393 | ||
| 394 | function Cor(Func) | |
| 395 | local Ok, Err = coroutine.resume(coroutine.create(Func)) | |
| 396 | if not Ok then | |
| 397 | print(Err) | |
| 398 | end | |
| 399 | end | |
| 400 | ||
| 401 | function Cor2(Func) | |
| 402 | local Ok, Err = ypcall(Func) | |
| 403 | if not Ok then | |
| 404 | print(Err) | |
| 405 | end | |
| 406 | end | |
| 407 | ||
| 408 | function MakePads() | |
| 409 | -- 1 - VTelekinesis | |
| 410 | P1 = Instance.new("Model")
| |
| 411 | P1.Name = ModID | |
| 412 | ||
| 413 | -- 2 - RBase | |
| 414 | P2 = Instance.new("Part")
| |
| 415 | P2.CFrame = CFrame.new(Vector3.new(21.100008, 1.95000589, 11.899971)) * CFrame.Angles(-0, 0, -0) | |
| 416 | P2.FormFactor = Enum.FormFactor.Custom | |
| 417 | P2.Size = Vector3.new(0.799999952, 0.200000003, 0.800000012) | |
| 418 | P2.Anchored = true | |
| 419 | P2.BrickColor = BrickColor.new("Crimson")
| |
| 420 | P2.Friction = 0.30000001192093 | |
| 421 | P2.Shape = Enum.PartType.Block | |
| 422 | P2.Name = "RBase" | |
| 423 | P2.Parent = P1 | |
| 424 | ||
| 425 | -- 3 - Mesh | |
| 426 | P3 = Instance.new("CylinderMesh")
| |
| 427 | P3.Scale = Vector3.new(1, 0.5, 1) | |
| 428 | P3.Parent = P2 | |
| 429 | ||
| 430 | -- 4 - LBase | |
| 431 | P4 = Instance.new("Part")
| |
| 432 | P4.CFrame = CFrame.new(Vector3.new(18.100008, 1.95000589, 11.899971)) * CFrame.Angles(-0, 0, -0) | |
| 433 | P4.FormFactor = Enum.FormFactor.Custom | |
| 434 | P4.Size = Vector3.new(0.799999952, 0.200000003, 0.800000012) | |
| 435 | P4.Anchored = true | |
| 436 | P4.BrickColor = BrickColor.new("Crimson")
| |
| 437 | P4.Friction = 0.30000001192093 | |
| 438 | P4.Shape = Enum.PartType.Block | |
| 439 | P4.Name = "LBase" | |
| 440 | P4.Parent = P1 | |
| 441 | ||
| 442 | -- 5 - Mesh | |
| 443 | P5 = Instance.new("CylinderMesh")
| |
| 444 | P5.Scale = Vector3.new(1, 0.5, 1) | |
| 445 | P5.Parent = P4 | |
| 446 | ||
| 447 | -- 6 - RP1 | |
| 448 | P6 = Instance.new("Part")
| |
| 449 | P6.CFrame = CFrame.new(Vector3.new(20.8999996, 1.8499999, 12.0499992)) * CFrame.Angles(-0, 0, -0) | |
| 450 | P6.FormFactor = Enum.FormFactor.Custom | |
| 451 | P6.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) | |
| 452 | P6.Anchored = true | |
| 453 | P6.BrickColor = BrickColor.new("Black")
| |
| 454 | P6.Friction = 0.30000001192093 | |
| 455 | P6.Shape = Enum.PartType.Block | |
| 456 | P6.Name = "RP1" | |
| 457 | P6.Parent = P2 | |
| 458 | ||
| 459 | -- 7 - Mesh | |
| 460 | P7 = Instance.new("CylinderMesh")
| |
| 461 | P7.Scale = Vector3.new(1, 0.5, 1) | |
| 462 | P7.Parent = P6 | |
| 463 | ||
| 464 | -- 8 - RP2 | |
| 465 | P8 = Instance.new("Part")
| |
| 466 | P8.CFrame = CFrame.new(Vector3.new(21.1000004, 1.8499999, 11.6999998)) * CFrame.Angles(-0, 0, -0) | |
| 467 | P8.FormFactor = Enum.FormFactor.Custom | |
| 468 | P8.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) | |
| 469 | P8.Anchored = true | |
| 470 | P8.BrickColor = BrickColor.new("Black")
| |
| 471 | P8.Friction = 0.30000001192093 | |
| 472 | P8.Shape = Enum.PartType.Block | |
| 473 | P8.Name = "RP2" | |
| 474 | P8.Parent = P2 | |
| 475 | ||
| 476 | -- 9 - Mesh | |
| 477 | P9 = Instance.new("CylinderMesh")
| |
| 478 | P9.Scale = Vector3.new(1, 0.5, 1) | |
| 479 | P9.Parent = P8 | |
| 480 | ||
| 481 | -- 10 - RP3 | |
| 482 | P10 = Instance.new("Part")
| |
| 483 | P10.CFrame = CFrame.new(Vector3.new(21.3000011, 1.8499999, 12.0499992)) * CFrame.Angles(-0, 0, -0) | |
| 484 | P10.FormFactor = Enum.FormFactor.Custom | |
| 485 | P10.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) | |
| 486 | P10.Anchored = true | |
| 487 | P10.BrickColor = BrickColor.new("Black")
| |
| 488 | P10.Friction = 0.30000001192093 | |
| 489 | P10.Shape = Enum.PartType.Block | |
| 490 | P10.Name = "RP3" | |
| 491 | P10.Parent = P2 | |
| 492 | ||
| 493 | -- 11 - Mesh | |
| 494 | P11 = Instance.new("CylinderMesh")
| |
| 495 | P11.Scale = Vector3.new(1, 0.5, 1) | |
| 496 | P11.Parent = P10 | |
| 497 | ||
| 498 | -- 12 - LP1 | |
| 499 | P12 = Instance.new("Part")
| |
| 500 | P12.CFrame = CFrame.new(Vector3.new(17.8999996, 1.8499999, 12.0499992)) * CFrame.Angles(-0, 0, -0) | |
| 501 | P12.FormFactor = Enum.FormFactor.Custom | |
| 502 | P12.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) | |
| 503 | P12.Anchored = true | |
| 504 | P12.BrickColor = BrickColor.new("Black")
| |
| 505 | P12.Friction = 0.30000001192093 | |
| 506 | P12.Shape = Enum.PartType.Block | |
| 507 | P12.Name = "LP1" | |
| 508 | P12.Parent = P4 | |
| 509 | ||
| 510 | -- 13 - Mesh | |
| 511 | P13 = Instance.new("CylinderMesh")
| |
| 512 | P13.Scale = Vector3.new(1, 0.5, 1) | |
| 513 | P13.Parent = P12 | |
| 514 | ||
| 515 | -- 14 - LP2 | |
| 516 | P14 = Instance.new("Part")
| |
| 517 | P14.CFrame = CFrame.new(Vector3.new(18.1000004, 1.8499999, 11.6999998)) * CFrame.Angles(-0, 0, -0) | |
| 518 | P14.FormFactor = Enum.FormFactor.Custom | |
| 519 | P14.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) | |
| 520 | P14.Anchored = true | |
| 521 | P14.BrickColor = BrickColor.new("Black")
| |
| 522 | P14.Friction = 0.30000001192093 | |
| 523 | P14.Shape = Enum.PartType.Block | |
| 524 | P14.Name = "LP2" | |
| 525 | P14.Parent = P4 | |
| 526 | ||
| 527 | -- 15 - Mesh | |
| 528 | P15 = Instance.new("CylinderMesh")
| |
| 529 | P15.Scale = Vector3.new(1, 0.5, 1) | |
| 530 | P15.Parent = P14 | |
| 531 | ||
| 532 | -- 16 - LP3 | |
| 533 | P16 = Instance.new("Part")
| |
| 534 | P16.CFrame = CFrame.new(Vector3.new(18.3000011, 1.8499999, 12.0499992)) * CFrame.Angles(-0, 0, -0) | |
| 535 | P16.FormFactor = Enum.FormFactor.Custom | |
| 536 | P16.Size = Vector3.new(0.200000003, 0.200000003, 0.200000003) | |
| 537 | P16.Anchored = true | |
| 538 | P16.BrickColor = BrickColor.new("Black")
| |
| 539 | P16.Friction = 0.30000001192093 | |
| 540 | P16.Shape = Enum.PartType.Block | |
| 541 | P16.Name = "LP3" | |
| 542 | P16.Parent = P4 | |
| 543 | ||
| 544 | -- 17 - Mesh | |
| 545 | P17 = Instance.new("CylinderMesh")
| |
| 546 | P17.Scale = Vector3.new(1, 0.5, 1) | |
| 547 | P17.Parent = P16 | |
| 548 | ||
| 549 | P1.Parent = LP.Character | |
| 550 | P1:MakeJoints() | |
| 551 | return P1 | |
| 552 | end | |
| 553 | ||
| 554 | weldModel = function(model, unanchor, rooty) | |
| 555 | local parts = {}
| |
| 556 | local function recurse(object) | |
| 557 | if object:IsA("BasePart") then
| |
| 558 | table.insert(parts, object) | |
| 559 | end | |
| 560 | for _,child in pairs(object:GetChildren()) do | |
| 561 | recurse(child) | |
| 562 | end | |
| 563 | end | |
| 564 | recurse(model) | |
| 565 | ||
| 566 | local rootPart = rooty or parts[1] | |
| 567 | for _, part in pairs(parts) do | |
| 568 | local cframe = rootPart.CFrame:toObjectSpace(part.CFrame) | |
| 569 | local weld = Instance.new("Weld")
| |
| 570 | weld.Part0 = rootPart | |
| 571 | weld.Part1 = part | |
| 572 | weld.C0 = cframe | |
| 573 | weld.Parent = rootPart | |
| 574 | end | |
| 575 | ||
| 576 | if unanchor then | |
| 577 | for _, part in pairs(parts) do | |
| 578 | part.Anchored = false | |
| 579 | part.CanCollide = false | |
| 580 | end | |
| 581 | end | |
| 582 | end | |
| 583 | ||
| 584 | weldItem = function(rootPart, Item, TheC0, unanchor, ParentItem) | |
| 585 | local cframe = TheC0 or rootPart.CFrame:toObjectSpace(Item.CFrame) | |
| 586 | local weld = Instance.new("Weld")
| |
| 587 | weld.Name = "Weld" | |
| 588 | weld.Part0 = rootPart | |
| 589 | weld.Part1 = Item | |
| 590 | weld.C0 = cframe | |
| 591 | weld.Parent = ParentItem and Item or rootPart | |
| 592 | ||
| 593 | if unanchor then | |
| 594 | Item.Anchored = false | |
| 595 | end | |
| 596 | return weld, cframe | |
| 597 | end | |
| 598 | ||
| 599 | scaleModel = function(model, scale) | |
| 600 | local parts = {}
| |
| 601 | local function recurse(object) | |
| 602 | if object:IsA("BasePart") then
| |
| 603 | table.insert(parts, object) | |
| 604 | end | |
| 605 | for _,child in pairs(object:GetChildren()) do | |
| 606 | recurse(child) | |
| 607 | end | |
| 608 | end | |
| 609 | recurse(model) | |
| 610 | ||
| 611 | local top, bottom, left, right, back, front | |
| 612 | for _, part in pairs(parts) do | |
| 613 | if top == nil or top < part.Position.y then top = part.Position.y end | |
| 614 | if bottom == nil or bottom > part.Position.y then bottom = part.Position.y end | |
| 615 | if left == nil or left > part.Position.x then left = part.Position.x end | |
| 616 | if right == nil or right < part.Position.x then right = part.Position.x end | |
| 617 | if back == nil or back > part.Position.z then back = part.Position.z end | |
| 618 | if front == nil or front < part.Position.z then front = part.Position.z end | |
| 619 | end | |
| 620 | ||
| 621 | local middle = Vector3.new( left+right, top+bottom, back+front )/2 | |
| 622 | local minSize = Vector3.new(0.2, 0.2, 0.2) | |
| 623 | ||
| 624 | for _, part in pairs(parts) do | |
| 625 | local foo = part.CFrame.p - middle | |
| 626 | local rotation = part.CFrame - part.CFrame.p | |
| 627 | local newSize = part.Size*scale | |
| 628 | part.FormFactor = "Custom" | |
| 629 | part.Size = newSize | |
| 630 | part.CFrame = CFrame.new( middle + foo*scale ) * rotation | |
| 631 | ||
| 632 | if newSize.x < minSize.x or newSize.y < minSize.y or newSize.z < minSize.z then | |
| 633 | local mesh | |
| 634 | for _, child in pairs(part:GetChildren()) do | |
| 635 | if child:IsA("DataModelMesh") then
| |
| 636 | mesh = child | |
| 637 | break | |
| 638 | end | |
| 639 | end | |
| 640 | ||
| 641 | if mesh == nil then | |
| 642 | mesh = Instance.new("BlockMesh", part)
| |
| 643 | end | |
| 644 | ||
| 645 | local oScale = mesh.Scale | |
| 646 | local newScale = newSize/minSize * oScale | |
| 647 | if 0.2 < newSize.x then newScale = Vector3.new(1 * oScale.x, newScale.y, newScale.z) end | |
| 648 | if 0.2 < newSize.y then newScale = Vector3.new(newScale.x, 1 * oScale.y, newScale.z) end | |
| 649 | if 0.2 < newSize.z then newScale = Vector3.new(newScale.x, newScale.y, 1 * oScale.z) end | |
| 650 | ||
| 651 | mesh.Scale = newScale | |
| 652 | end | |
| 653 | end | |
| 654 | end | |
| 655 | ||
| 656 | function getMass(Obj, Total) | |
| 657 | local newTotal = Total | |
| 658 | local returnTotal = 0 | |
| 659 | ||
| 660 | if Obj:IsA("BasePart") then
| |
| 661 | newTotal = newTotal + Objects[Obj] | |
| 662 | elseif BodyObjects[Obj.ClassName] then | |
| 663 | Obj:Destroy() | |
| 664 | end | |
| 665 | ||
| 666 | if Obj:GetChildren() and #Obj:GetChildren() > 0 then | |
| 667 | for _,v in pairs(Obj:GetChildren()) do | |
| 668 | returnTotal = returnTotal + getMass(v, newTotal) | |
| 669 | end | |
| 670 | else | |
| 671 | returnTotal = newTotal | |
| 672 | end | |
| 673 | ||
| 674 | return returnTotal | |
| 675 | end | |
| 676 | ||
| 677 | function getTargFromCurrent() | |
| 678 | local Current = Current.Part | |
| 679 | if Current:IsA("BasePart") then
| |
| 680 | return Current | |
| 681 | elseif Current:findFirstChild("Torso") then
| |
| 682 | return Current.Torso | |
| 683 | else | |
| 684 | for _,v in pairs(Current:GetChildren()) do | |
| 685 | if v:IsA("BasePart") then
| |
| 686 | return v | |
| 687 | end | |
| 688 | end | |
| 689 | end | |
| 690 | end | |
| 691 | ||
| 692 | function Fire(Part, Vec, Inv) | |
| 693 | pcall(function() | |
| 694 | Current.BP:Destroy() | |
| 695 | Current.BP = nil | |
| 696 | end) | |
| 697 | pcall(function() | |
| 698 | Current.BA:Destroy() | |
| 699 | Current.BA = nil | |
| 700 | end) | |
| 701 | pcall(function() | |
| 702 | if Inv then | |
| 703 | Part.Velocity = -((Vec - Torso.Position).unit * Grav * 1.1) | |
| 704 | else | |
| 705 | Part.Velocity = ((Vec - Camera.CoordinateFrame.p).unit * Grav * 1.1) | |
| 706 | end | |
| 707 | Current.Mass = nil | |
| 708 | end) | |
| 709 | Reset() | |
| 710 | end | |
| 711 | ||
| 712 | function Reset() | |
| 713 | LS.Parent = nil | |
| 714 | RS.Parent = nil | |
| 715 | ||
| 716 | OrigLS.Parent = Torso | |
| 717 | OrigRS.Parent = Torso | |
| 718 | ||
| 719 | OrigLS.C0 = LS0 | |
| 720 | OrigRS.C0 = RS0 | |
| 721 | end | |
| 722 | ||
| 723 | function Start() | |
| 724 | Cor(function() | |
| 725 | repeat wait(1/30) until LP.Character and LP.Character.Parent == Workspace and LP.Character:findFirstChild("Torso")
| |
| 726 | Char = LP.Character | |
| 727 | PlrGui = LP.PlayerGui | |
| 728 | Backpack = LP.Backpack | |
| 729 | Mouse = LP:GetMouse() | |
| 730 | ||
| 731 | for _,v in pairs(Cons) do | |
| 732 | v:disconnect() | |
| 733 | end | |
| 734 | Cons = {}
| |
| 735 | ||
| 736 | Camera = Workspace.CurrentCamera | |
| 737 | LastCamCF = Camera.CoordinateFrame | |
| 738 | AnimJoints = {}
| |
| 739 | mDown = false | |
| 740 | Multi = false | |
| 741 | Grabbing = false | |
| 742 | Current = {}
| |
| 743 | Alpha = 1 | |
| 744 | ||
| 745 | Head = Char["Head"] | |
| 746 | Torso = Char["Torso"] | |
| 747 | Humanoid = Char["Humanoid"] | |
| 748 | LA = Char["Left Arm"] | |
| 749 | RA = Char["Right Arm"] | |
| 750 | LL = Char["Left Leg"] | |
| 751 | RL = Char["Right Leg"] | |
| 752 | ||
| 753 | OrigLS = Torso["Left Shoulder"] | |
| 754 | OrigRS = Torso["Right Shoulder"] | |
| 755 | ||
| 756 | for _,v in pairs(Char:GetChildren()) do | |
| 757 | if v.Name == ModID then | |
| 758 | v:Destroy() | |
| 759 | end | |
| 760 | end | |
| 761 | ||
| 762 | for _,v in pairs(PlrGui:GetChildren()) do | |
| 763 | if v.Name == "PadsGui" then | |
| 764 | v:Destroy() | |
| 765 | end | |
| 766 | end | |
| 767 | ||
| 768 | LS = Instance.new("Weld")
| |
| 769 | RS = Instance.new("Weld")
| |
| 770 | ||
| 771 | LS.Name = OrigLS.Name | |
| 772 | LS.Part0 = Torso | |
| 773 | LS.Part1 = LA | |
| 774 | LS.C0 = LS0 | |
| 775 | LS.C1 = CFrame.new(0, 0.5, 0, 1, 0, 0, 0, 0, 1, 0, -1, 0) | |
| 776 | ||
| 777 | RS.Name = OrigRS.Name | |
| 778 | RS.Part0 = Torso | |
| 779 | RS.Part1 = RA | |
| 780 | RS.C0 = RS0 | |
| 781 | RS.C1 = CFrame.new(0, 0.5, 0, 1, 0, 0, 0, 0, 1, 0, -1, 0) | |
| 782 | ||
| 783 | local Pads = MakePads() | |
| 784 | local LPad = Pads.LBase | |
| 785 | local RPad = Pads.RBase | |
| 786 | ||
| 787 | weldModel(LPad, true, LPad) | |
| 788 | weldModel(RPad, true, RPad) | |
| 789 | ||
| 790 | local GripWeldL = Instance.new("Weld")
| |
| 791 | GripWeldL.Name = "GripWeldL" | |
| 792 | GripWeldL.Part0 = LA | |
| 793 | GripWeldL.Part1 = LPad | |
| 794 | GripWeldL.C0 = CFrame.new(0, -1.05, 0) * CFrame.Angles(0, math.rad(180), 0) | |
| 795 | GripWeldL.Parent = LA | |
| 796 | ||
| 797 | local GripWeldR = Instance.new("Weld")
| |
| 798 | GripWeldR.Name = "GripWeldR" | |
| 799 | GripWeldR.Part0 = RA | |
| 800 | GripWeldR.Part1 = RPad | |
| 801 | GripWeldR.C0 = CFrame.new(0, -1.05, 0) * CFrame.Angles(0, math.rad(180), 0) | |
| 802 | GripWeldR.Parent = RA | |
| 803 | ||
| 804 | local isParts = false | |
| 805 | ||
| 806 | table.insert(Cons, Mouse.KeyDown:connect(function(Key) | |
| 807 | Key = Key:lower() | |
| 808 | if Key == "z" then | |
| 809 | --Stuff | |
| 810 | elseif Key == "f" then | |
| 811 | local Current = Current.Part | |
| 812 | if Current and Current.Parent ~= nil and not Multi then | |
| 813 | Current:BreakJoints() | |
| 814 | end | |
| 815 | elseif Key == "q" then | |
| 816 | if isParts then | |
| 817 | isParts = false | |
| 818 | for _,v in pairs(Workspace:GetChildren()) do | |
| 819 | if v.Name == "MyPartV" and v:IsA("BasePart") then
| |
| 820 | v:Destroy() | |
| 821 | end | |
| 822 | end | |
| 823 | else | |
| 824 | isParts = true | |
| 825 | for i = 1, 50 do | |
| 826 | local Part = Instance.new("Part")
| |
| 827 | Part.Color = Color3.new(math.random(), math.random(), math.random()) | |
| 828 | Part.Transparency = 0 | |
| 829 | Part.Size = Vector3.new(math.random(1, 3), math.random(1, 3), math.random(1, 3)) | |
| 830 | Part.Archivable = true | |
| 831 | Part.CanCollide = false | |
| 832 | Part.Material = "Plastic" | |
| 833 | Part.Locked = false | |
| 834 | Part.CFrame = Torso.CFrame * CFrame.new(math.random(-15, 15), -1, math.random(-15, 15)) | |
| 835 | Part.Anchored = true | |
| 836 | Part.Name = "MyPartV" | |
| 837 | Part.TopSurface = "Smooth" | |
| 838 | Part.BottomSurface = "Smooth" | |
| 839 | Part.Parent = Workspace | |
| 840 | end | |
| 841 | end | |
| 842 | elseif Key == "e" then | |
| 843 | local Targ; | |
| 844 | if Current.Part and Current.Part ~= nil then | |
| 845 | Targ = getTargFromCurrent() | |
| 846 | else | |
| 847 | Targ = LastPart | |
| 848 | end | |
| 849 | if Targ and Targ.Parent ~= nil and not Multi then | |
| 850 | local Ex = Instance.new("Explosion", Workspace)
| |
| 851 | Ex.Position = Targ.CFrame.p | |
| 852 | Ex.BlastRadius = 16 | |
| 853 | Ex.DestroyJointRadiusPercent = 0.5 | |
| 854 | game.Players.Targ.ForceField:Destroy() | |
| 855 | end | |
| 856 | elseif Key == "c" then | |
| 857 | if Current.Part and Current.Part.Parent ~= nil and not Multi then | |
| 858 | local Part = getTargFromCurrent() | |
| 859 | if Part then | |
| 860 | Grabbing = false | |
| 861 | if Mouse.Hit then | |
| 862 | local TargPos = CFrame.new(Camera.CoordinateFrame.p, Mouse.Hit.p) * CFrame.new(0, 0, -1000) | |
| 863 | Fire(Part, TargPos.p) | |
| 864 | else | |
| 865 | Fire(Part, Mouse.Origin.p + Mouse.UnitRay.Direction, true) | |
| 866 | end | |
| 867 | end | |
| 868 | end | |
| 869 | end | |
| 870 | end)) | |
| 871 | ||
| 872 | table.insert(Cons, Mouse.Button1Up:connect(function() | |
| 873 | mDown = false | |
| 874 | if Grabbing == true and Multi == false then | |
| 875 | Grabbing = false | |
| 876 | Reset() | |
| 877 | end | |
| 878 | if Current.Part ~= nil then | |
| 879 | LastPart = getTargFromCurrent() | |
| 880 | Current = {}
| |
| 881 | end | |
| 882 | end)) | |
| 883 | ||
| 884 | local function makeLightning(Par, Start, End, Width, Length, RandomScale, ArcScale, Num1) | |
| 885 | local oldParts = {}
| |
| 886 | for _,v in pairs(Par:GetChildren()) do | |
| 887 | v.CFrame = CFrame.new(5e5, 5e5, 5e5) | |
| 888 | table.insert(oldParts, v) | |
| 889 | end | |
| 890 | local Distance = (Start-End).Magnitude | |
| 891 | local ArcScale = ArcScale or 1 | |
| 892 | local RandomScale = RandomScale or 0 | |
| 893 | local Last = Start | |
| 894 | local IterNum = 0 | |
| 895 | ||
| 896 | while Par.Parent do | |
| 897 | IterNum = IterNum + 1 | |
| 898 | local New = nil | |
| 899 | if (Last-End).Magnitude < Length then | |
| 900 | New = CFrame.new(End) | |
| 901 | else | |
| 902 | if (End-Last).Magnitude < Length*2 then | |
| 903 | RandomScale = RandomScale*0.5 | |
| 904 | ArcScale = ArcScale*0.5 | |
| 905 | end | |
| 906 | local Direct = CFrame.new(Last,End) | |
| 907 | New = Direct*CFrame.Angles(math.rad(math.random(-RandomScale/4,RandomScale*ArcScale)),math.rad(math.random(-RandomScale,RandomScale)),math.rad(math.random(-RandomScale,RandomScale))) | |
| 908 | New = New*CFrame.new(0,0,-Length) | |
| 909 | end | |
| 910 | local Trail = nil | |
| 911 | if oldParts[IterNum] then | |
| 912 | Trail = oldParts[IterNum] | |
| 913 | Trail.BrickColor = ((Num1 % 2 == 0) and BrickColor.new("Crimson")) or BrickColor.new("Really black")
| |
| 914 | Trail.Size = Vector3.new(Width, (Last-New.p).Magnitude, Width) | |
| 915 | Trail.CFrame = CFrame.new(New.p, Last)*CFrame.Angles(math.rad(90),0,0)*CFrame.new(0, -(Last-New.p).Magnitude/2, 0) | |
| 916 | oldParts[IterNum] = nil | |
| 917 | else | |
| 918 | Trail = Instance.new("Part")
| |
| 919 | Trail.Name = "Part" | |
| 920 | Trail.FormFactor = "Custom" | |
| 921 | Trail.BrickColor = ((Num1 % 2 == 0) and BrickColor.new("Crimson")) or BrickColor.new("Really black")
| |
| 922 | Trail.Transparency = 0 | |
| 923 | Trail.Anchored = true | |
| 924 | Trail.CanCollide = false | |
| 925 | Trail.Locked = true | |
| 926 | Trail.BackSurface = "SmoothNoOutlines" | |
| 927 | Trail.BottomSurface = "SmoothNoOutlines" | |
| 928 | Trail.FrontSurface = "SmoothNoOutlines" | |
| 929 | Trail.LeftSurface = "SmoothNoOutlines" | |
| 930 | Trail.RightSurface = "SmoothNoOutlines" | |
| 931 | Trail.TopSurface = "SmoothNoOutlines" | |
| 932 | Trail.Material = "Neon" | |
| 933 | Trail.Size = Vector3.new(Width, (Last-New.p).Magnitude, Width) | |
| 934 | Trail.CFrame = CFrame.new(New.p, Last)*CFrame.Angles(math.rad(90),0,0)*CFrame.new(0, -(Last-New.p).Magnitude/2, 0) | |
| 935 | Trail.Parent = Par | |
| 936 | end | |
| 937 | Last = New.p | |
| 938 | if (Last-End).Magnitude < 1 then | |
| 939 | break | |
| 940 | end | |
| 941 | end | |
| 942 | for _,v in pairs(oldParts) do | |
| 943 | v:Destroy() | |
| 944 | end | |
| 945 | end | |
| 946 | ||
| 947 | table.insert(Cons, Mouse.Button1Down:connect(function() | |
| 948 | mDown = true | |
| 949 | local Targ = Mouse.Target | |
| 950 | Cor(function() | |
| 951 | if Targ and Objects[Targ] and not Multi then | |
| 952 | Grabbing = true | |
| 953 | Current.Part = Targ | |
| 954 | local Mass = Objects[Targ] | |
| 955 | local ForceNum = 0 | |
| 956 | local Hum = nil | |
| 957 | ||
| 958 | for _,v in pairs(Targ:GetChildren()) do | |
| 959 | if BodyObjects[v.ClassName] then | |
| 960 | v:Destroy() | |
| 961 | end | |
| 962 | end | |
| 963 | ||
| 964 | for _,v in pairs(Workspace:GetChildren()) do | |
| 965 | if v:findFirstChild("Humanoid") and v:IsAncestorOf(Targ) then
| |
| 966 | Hum = v.Humanoid | |
| 967 | Mass = getMass(v, 0) | |
| 968 | Current.Part = v | |
| 969 | break | |
| 970 | end | |
| 971 | end | |
| 972 | ||
| 973 | Current.Mass = Mass | |
| 974 | ||
| 975 | if not Hum then | |
| 976 | Targ:BreakJoints() | |
| 977 | end | |
| 978 | ||
| 979 | ForceNum = Mass * Grav | |
| 980 | Targ.CanCollide = true | |
| 981 | Targ.Anchored = false | |
| 982 | ||
| 983 | local BP = Instance.new("BodyPosition")
| |
| 984 | BP.maxForce = Vector3.new(3 * ForceNum, 3 * ForceNum, 3 * ForceNum) | |
| 985 | BP.Parent = Targ | |
| 986 | ||
| 987 | local Ang = Instance.new("BodyAngularVelocity")
| |
| 988 | Ang.Parent = Targ | |
| 989 | ||
| 990 | Current.BP = BP | |
| 991 | Current.BA = Ang | |
| 992 | ||
| 993 | OrigLS.Parent = nil | |
| 994 | OrigRS.Parent = nil | |
| 995 | ||
| 996 | LS.Parent = Torso | |
| 997 | RS.Parent = Torso | |
| 998 | ||
| 999 | LS.C0 = LS0 | |
| 1000 | RS.C0 = RS0 | |
| 1001 | ||
| 1002 | local DirDot = Mouse.UnitRay.Direction:Dot(Targ.Position - Mouse.Origin.p) | |
| 1003 | local BPPos = Vector3.new(0, 0, 0) | |
| 1004 | local Vel = Vector3.new(0, 0, 0) | |
| 1005 | local Vlev = random() * math.pi | |
| 1006 | local RPos = Vector3.new(random() * 2 - 1, cos(Vlev), random() * 2 - 1) | |
| 1007 | ||
| 1008 | local Ball = Instance.new("Part")
| |
| 1009 | Ball.Name = "Ball" | |
| 1010 | Ball.FormFactor = "Custom" | |
| 1011 | Ball.Color = Color3.new(255, 0, 0) | |
| 1012 | Ball.Transparency = 0.3 | |
| 1013 | Ball.Anchored = true | |
| 1014 | Ball.CanCollide = false | |
| 1015 | Ball.Locked = true | |
| 1016 | Ball.BottomSurface, Ball.TopSurface = "Smooth", "Smooth" | |
| 1017 | Ball.Size = Vector3.new(0.5, 0.5, 0.5) | |
| 1018 | Ball.CFrame = Torso.CFrame * CFrame.new(0, 1, -3) | |
| 1019 | Ball.Parent = Char | |
| 1020 | ||
| 1021 | if Targ.Name == "MyPartV" then | |
| 1022 | Targ.Name = "MyPartF" | |
| 1023 | end | |
| 1024 | ||
| 1025 | local LightMod = Instance.new("Model", Char)
| |
| 1026 | ||
| 1027 | local Mesh = Instance.new("SpecialMesh")
| |
| 1028 | Mesh.MeshType = "Sphere" | |
| 1029 | Mesh.Parent = Ball | |
| 1030 | ||
| 1031 | local Size = 1 | |
| 1032 | local Rise = true | |
| 1033 | ||
| 1034 | while Grabbing and BP and Ang and Targ.Parent ~= nil do | |
| 1035 | local BPPos = Mouse.Origin.p + Mouse.UnitRay.Direction * DirDot | |
| 1036 | Ang.angularvelocity = Vel | |
| 1037 | BP.position = BPPos + RPos | |
| 1038 | 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))) | |
| 1039 | 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))) | |
| 1040 | Vlev = (Vlev + 0.05) % tau | |
| 1041 | ||
| 1042 | if Hum then | |
| 1043 | Hum.Sit = true | |
| 1044 | end | |
| 1045 | ||
| 1046 | if LA.Parent ~= nil and RA.Parent ~= nil then | |
| 1047 | local LPos = (LA.CFrame * CFrame.new(0, -1, 0)).p | |
| 1048 | local RPos = (RA.CFrame * CFrame.new(0, -1, 0)).p | |
| 1049 | if Rise == true then | |
| 1050 | if Size < 0.6 then | |
| 1051 | Size = Size + 0.05 | |
| 1052 | else | |
| 1053 | Size = Size + 0.1 | |
| 1054 | end | |
| 1055 | if Size >= 2.2 then | |
| 1056 | Rise = false | |
| 1057 | end | |
| 1058 | else | |
| 1059 | if Size > 2.1 then | |
| 1060 | Size = Size - 0.05 | |
| 1061 | else | |
| 1062 | Size = Size - 0.1 | |
| 1063 | end | |
| 1064 | if Size <= 0.5 then | |
| 1065 | Rise = true | |
| 1066 | end | |
| 1067 | end | |
| 1068 | Ball.Size = Vector3.new(Size, Size, Size) | |
| 1069 | Ball.CFrame = CFrame.new(LPos:Lerp(RPos, 0.5), Targ.Position) * CFrame.new(0, 0, -2.2) | |
| 1070 | LightNum = LightNum + 1 | |
| 1071 | makeLightning(LightMod, Ball.Position, Targ.Position, 0.2, 4, 50, 1, LightNum) | |
| 1072 | elseif Ball.Parent ~= nil then | |
| 1073 | Ball:Destroy() | |
| 1074 | end | |
| 1075 | ||
| 1076 | if LS and LS.Parent == Torso then | |
| 1077 | 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)) | |
| 1078 | end | |
| 1079 | if RS and RS.Parent == Torso then | |
| 1080 | 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)) | |
| 1081 | end | |
| 1082 | RunService.Heartbeat:wait() | |
| 1083 | end | |
| 1084 | ||
| 1085 | coroutine.resume(coroutine.create(function() | |
| 1086 | for i = 0.5, 1, 0.1 do | |
| 1087 | for i2,v in pairs(LightMod:GetChildren()) do | |
| 1088 | --v.Light.Range = 6-(i*5) | |
| 1089 | v.Transparency = i | |
| 1090 | end | |
| 1091 | wait(1/30) | |
| 1092 | end | |
| 1093 | LightMod:Destroy() | |
| 1094 | end)) | |
| 1095 | ||
| 1096 | if BP and BP.Parent ~= nil then | |
| 1097 | BP:Destroy() | |
| 1098 | end | |
| 1099 | ||
| 1100 | if Ang and Ang.Parent ~= nil then | |
| 1101 | Ang:Destroy() | |
| 1102 | end | |
| 1103 | ||
| 1104 | pcall(function() Ball:Destroy() end) | |
| 1105 | end | |
| 1106 | end) | |
| 1107 | end)) | |
| 1108 | end) | |
| 1109 | end | |
| 1110 | ||
| 1111 | function Add(Obj) | |
| 1112 | if Obj:IsA("BasePart") and not Objects[Obj] and not (Obj.Name == "Base" and Obj.ClassName == "Part") then
| |
| 1113 | Objects[Obj] = Obj:GetMass() | |
| 1114 | Obj.Changed:connect(function(P) | |
| 1115 | if P:lower() == "size" and Objects[Obj] and Obj.Parent ~= nil then | |
| 1116 | Objects[Obj] = Obj:GetMass() | |
| 1117 | end | |
| 1118 | end) | |
| 1119 | end | |
| 1120 | end | |
| 1121 | ||
| 1122 | function Rem(Obj) | |
| 1123 | if Objects[Obj] then | |
| 1124 | Objects[Obj] = nil | |
| 1125 | end | |
| 1126 | end | |
| 1127 | ||
| 1128 | function Recursion(Obj) | |
| 1129 | ypcall(function() | |
| 1130 | Add(Obj) | |
| 1131 | if #Obj:GetChildren() > 0 then | |
| 1132 | for _,v in pairs(Obj:GetChildren()) do | |
| 1133 | Recursion(v) | |
| 1134 | end | |
| 1135 | end | |
| 1136 | end) | |
| 1137 | end | |
| 1138 | ||
| 1139 | Workspace.DescendantAdded:connect(function(Obj) | |
| 1140 | Add(Obj) | |
| 1141 | end) | |
| 1142 | ||
| 1143 | Workspace.DescendantRemoving:connect(function(Obj) | |
| 1144 | Rem(Obj) | |
| 1145 | end) | |
| 1146 | ||
| 1147 | for _,v in pairs(Workspace:GetChildren()) do | |
| 1148 | Recursion(v) | |
| 1149 | end | |
| 1150 | ||
| 1151 | Start() | |
| 1152 | ||
| 1153 | if LP.Name == PlrName then | |
| 1154 | LP.CharacterAdded:connect(Start) | |
| 1155 | end |