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 | -- pcall(function() | |
| 154 | -- script.DSource.Value = "" | |
| 155 | -- script.DSource:Destroy() | |
| 156 | -- end) | |
| 157 | -- script.Parent = nil | |
| 158 | ||
| 159 | game:service'RunService':UnbindFromRenderStep('Mug_Anims')
| |
| 160 | ply=game:service'Players'.LocalPlayer | |
| 161 | ||
| 162 | repeat wait()until ply~=nil | |
| 163 | ||
| 164 | char=ply.Character | |
| 165 | torso=char.Torso | |
| 166 | ||
| 167 | rarm,larm=char['Right Arm'],char['Left Arm'] | |
| 168 | rleg,lleg=char['Right Leg'],char['Left Leg'] | |
| 169 | rshl,lshl=torso['Right Shoulder'],torso['Left Shoulder'] | |
| 170 | rhip,lhip=torso['Right Hip'],torso['Left Hip'] | |
| 171 | ||
| 172 | bcol=BrickColor.new | |
| 173 | cfn,md,mr,v3n=CFrame.new,math.rad,math.random,Vector3.new | |
| 174 | ang=function(x,y,z)return CFrame.Angles(x or 0,y or 0,z or 0)end | |
| 175 | Debris=game:service'Debris' | |
| 176 | m={}
| |
| 177 | m.tau=math.pi*2 | |
| 178 | m.floatforce = 196.25 | |
| 179 | numkp=NumberSequenceKeypoint.new | |
| 180 | ||
| 181 | hum_root=char.HumanoidRootPart | |
| 182 | ||
| 183 | mouse=ply:GetMouse() | |
| 184 | ||
| 185 | function l(a,x,y,z,xx,yy,zz) | |
| 186 | if string.find(tostring(a),',') == nil then | |
| 187 | return (a.CFrame*CFrame.new(x or 0,y or 0,z or 0))*CFrame.Angles(xx or 0,yy or 0, zz or 0) | |
| 188 | else return (a * CFrame.new(x or 0,y or 0,z or 0))*CFrame.Angles(xx or 0,yy or 0,zz or 0) | |
| 189 | end | |
| 190 | end | |
| 191 | ||
| 192 | pcall(function() char.Stick:Destroy() end) --- Destroys Physical Tool | |
| 193 | Weapon = Instance.new("Model",char) Weapon.Name = 'Stick'
| |
| 194 | Instance.new('BoolValue',Weapon).Name='Mug_Did'
| |
| 195 | do --UTILITIES | |
| 196 | ||
| 197 | function Create(ClassName) | |
| 198 | local obj=Instance.new(ClassName) | |
| 199 | return function(props) | |
| 200 | obj.Parent=Weapon | |
| 201 | for key,val in pairs(props)do | |
| 202 | if key=='_P'then | |
| 203 | obj['Parent']=val | |
| 204 | elseif i=='_C'then | |
| 205 | obj[val[1]]:connect(val[2]) | |
| 206 | else | |
| 207 | obj[key]=val | |
| 208 | end | |
| 209 | end | |
| 210 | return obj | |
| 211 | end | |
| 212 | end | |
| 213 | ||
| 214 | do --CREATION | |
| 215 | ||
| 216 | Weld = function(p0,p1,x,y,z,rx,ry,rz,par) | |
| 217 | p0.Position = p1.Position | |
| 218 | local w = Instance.new('Motor',game:service'JointsService')
| |
| 219 | w.Part0 = p1 | |
| 220 | w.Part1 = p0 | |
| 221 | w.C0 = CFrame.new(x or 0,y or 0,z or 0)*CFrame.Angles(rx or 0,ry or 0,rz or 0) | |
| 222 | w.MaxVelocity = .1 | |
| 223 | return w | |
| 224 | end | |
| 225 | Cur_Parent=nil | |
| 226 | current_mat=nil | |
| 227 | anchor=false | |
| 228 | Part = function(x,y,z,color,tr,cc,an,parent) | |
| 229 | local p = Instance.new('Part',parent or Cur_Parent or Weapon)
| |
| 230 | p.formFactor = 'Custom' | |
| 231 | p.Locked = true | |
| 232 | p.Position=torso.Position | |
| 233 | p.Size = Vector3.new(x,y,z) | |
| 234 | p.BrickColor = BrickColor.new(color or 'White') | |
| 235 | p.CanCollide = cc or false | |
| 236 | p.Anchored = an or anchor or false | |
| 237 | p.Transparency = tr or 0 | |
| 238 | p.Material=current_mat or'SmoothPlastic' | |
| 239 | for i,v in pairs{'TopSurface','BottomSurface','FrontSurface','BackSurface','LeftSurface','RightSurface'}do
| |
| 240 | p[v]=10 | |
| 241 | end | |
| 242 | return p | |
| 243 | end | |
| 244 | Wedge = function(x,y,z,color,tr,cc,an,parent) | |
| 245 | local p = Instance.new('WedgePart',parent or Cur_Parent or Weapon)
| |
| 246 | p.formFactor = 'Custom' | |
| 247 | p.Size = Vector3.new(x,y,z) | |
| 248 | p.BrickColor = BrickColor.new(color or 'White') | |
| 249 | p.CanCollide = cc or false | |
| 250 | p.Anchored = an or false | |
| 251 | p.Transparency = tr or 0 | |
| 252 | p.Material=current_mat or'SmoothPlastic' | |
| 253 | for i,v in pairs{'TopSurface','BottomSurface','FrontSurface','BackSurface','LeftSurface','RightSurface'}do
| |
| 254 | p[v]=10 | |
| 255 | end | |
| 256 | return p | |
| 257 | end | |
| 258 | ||
| 259 | Meshes = {Diamond='9756362';Spikeball='9982590';Table='111868131';
| |
| 260 | Egg='1527559';Ring='3270017';Bullet='2697549';Grass='1080954'; | |
| 261 | Shark='82821384';Sword='12221720';Crown='10688643';Spike='1033714'; | |
| 262 | Leaf='48100239';Fist='65322375';Chakram='19251107';Crown='20329976';Spring='9753878'; | |
| 263 | Tree='8564125';Fireball='10587413';DiamondBall='10917418'} | |
| 264 | ||
| 265 | Textures = {Leaf='rbxassetid://48047287';White='rbxassetid://5736319'}
| |
| 266 | ||
| 267 | Mesh = function(par,num,x,y,z,tex) | |
| 268 | local msh = _ | |
| 269 | if num == 1 then msh = Instance.new("CylinderMesh",par)
| |
| 270 | elseif num == 2 then msh = Instance.new("SpecialMesh",par) msh.MeshType = 3
| |
| 271 | elseif num == 3 then msh = Instance.new("SpecialMesh",par) msh.MeshType = 6
| |
| 272 | elseif num == 4 then msh = Instance.new("SpecialMesh",par) msh.MeshType = 'Wedge'
| |
| 273 | elseif type(num) == 'string' then msh = Instance.new("SpecialMesh",par)
| |
| 274 | if num=='Torso'then msh.MeshType=1 else | |
| 275 | msh.MeshId = string.find(num,'://') == nil and 'rbxassetid://'..Meshes[num] or num end | |
| 276 | end | |
| 277 | msh.Scale = Vector3.new(x or 1,y or 1,z or 1) | |
| 278 | if tex then | |
| 279 | msh.TextureId = Textures[tex] or tex or '' | |
| 280 | end | |
| 281 | return msh | |
| 282 | end | |
| 283 | ||
| 284 | end | |
| 285 | ||
| 286 | function HSVtoRGB(h, s, v) | |
| 287 | h = (h % 1) * 6 | |
| 288 | local f = h % 1 | |
| 289 | local p = v * (1 - s) | |
| 290 | local q = v * (1 - s * f) | |
| 291 | local t = v * (1 - s * (1 - f)) | |
| 292 | if h < 1 then | |
| 293 | return v, t, p | |
| 294 | elseif h < 2 then | |
| 295 | return q, v, p | |
| 296 | elseif h < 3 then | |
| 297 | return p, v, t | |
| 298 | elseif h < 4 then | |
| 299 | return p, q, v | |
| 300 | elseif h < 5 then | |
| 301 | return t, p, v | |
| 302 | else | |
| 303 | return v, p, q | |
| 304 | end | |
| 305 | end | |
| 306 | ||
| 307 | function Edit(obj,props) | |
| 308 | local objects={}
| |
| 309 | if type(obj)=='table'then objects=obj | |
| 310 | return function(props) | |
| 311 | obj.Parent=Weapon | |
| 312 | for _,obj in pairs(objects)do | |
| 313 | for key,val in pairs(props)do | |
| 314 | if key=='_P'then | |
| 315 | obj['Parent']=val | |
| 316 | elseif i=='_F'then | |
| 317 | val(objects)() | |
| 318 | else | |
| 319 | succes,err=pcall(function()return obj[key]end) | |
| 320 | if succes then | |
| 321 | obj[key]=val | |
| 322 | end | |
| 323 | end | |
| 324 | end | |
| 325 | end | |
| 326 | end | |
| 327 | end | |
| 328 | ||
| 329 | end | |
| 330 | ||
| 331 | function calcgrav(obj) | |
| 332 | local total=0 | |
| 333 | local function add(a) | |
| 334 | for i,v in pairs(a:children())do | |
| 335 | if v:IsA'BasePart'then | |
| 336 | total=total+v:GetMass()*m.floatforce | |
| 337 | elseif v:IsA'Hat'then | |
| 338 | total=total+v.Handle:GetMass()*m.floatforce | |
| 339 | else add(v)end | |
| 340 | end | |
| 341 | end | |
| 342 | add(obj or char) | |
| 343 | return total | |
| 344 | end | |
| 345 | ||
| 346 | function findHum(pos,rad,hum2) | |
| 347 | local hums={}
| |
| 348 | function check(a) | |
| 349 | local res=false | |
| 350 | for i,ho in pairs(hums)do | |
| 351 | if a==ho then res=true end | |
| 352 | end | |
| 353 | return res | |
| 354 | end | |
| 355 | for i,v in pairs(Workspace:children())do | |
| 356 | if v:IsA'Model'and v~=char and v~=(hum2 or char) then | |
| 357 | for i,q in pairs(v:children())do | |
| 358 | if q:IsA'Humanoid' and q.Parent:FindFirstChild'Torso'and(q.Torso.Position-pos).magnitude < rad then | |
| 359 | if not check(q)then | |
| 360 | table.insert(hums,q) | |
| 361 | end | |
| 362 | end | |
| 363 | end | |
| 364 | end | |
| 365 | end | |
| 366 | return hums,pos | |
| 367 | end | |
| 368 | ||
| 369 | udim=function(a,b,c,d) | |
| 370 | if type(a)=='string'then | |
| 371 | x,y=tostring(a):match('(%d*%.*%d*),(%d*%.*%d*)')
| |
| 372 | return UDim2.new(x or 0,x2 or 0,y or 0,y2 or 0) | |
| 373 | else | |
| 374 | return UDim2.new(a or 0,c or 0,b or 0,d or 0) | |
| 375 | end end | |
| 376 | ||
| 377 | function getHum(what,b)local res | |
| 378 | for i,v in pairs(what:children())do | |
| 379 | if v:IsA'Humanoid' then | |
| 380 | res=v | |
| 381 | end | |
| 382 | end | |
| 383 | return res | |
| 384 | end | |
| 385 | ||
| 386 | end | |
| 387 | ||
| 388 | do --ANIMATIONSYSTEM DECLARATIONS | |
| 389 | cont_anim=true | |
| 390 | ||
| 391 | rarm,larm=char['Right Arm'],char['Left Arm'] | |
| 392 | rleg,lleg=char['Right Leg'],char['Left Leg'] | |
| 393 | ||
| 394 | torw=char.HumanoidRootPart.RootJoint | |
| 395 | neck=torso.Neck | |
| 396 | rs,ls=torso['Right Shoulder'],torso['Left Shoulder'] | |
| 397 | rh,lh=torso['Right Hip'],torso['Left Hip'] | |
| 398 | ||
| 399 | ort=cfn(0,0,0,-1,0,0,0,0,1,0,1,-0) | |
| 400 | norig=cfn(0,1,0,-1,-0,-0,0,0,1,0,1,0) | |
| 401 | ||
| 402 | rw,lw=nil,nil | |
| 403 | arms=nil | |
| 404 | ||
| 405 | r_shl_c0=cfn(1,0.5,0)--,0,0,1,0,1,0,-1,-0,-0) | |
| 406 | r_shl_c1=cfn(-0.5,0.5,0)--,0,0,1,0,1,0,-1,-0,-0) | |
| 407 | ||
| 408 | l_shl_c0=cfn(-1,0.5,0)--,0,0,1,0,1,0,-1,-0,-0) | |
| 409 | l_shl_c1=cfn(0.5,0.5,0)--,0,0,1,0,1,0,-1,-0,-0) | |
| 410 | ||
| 411 | -- l_shl_c0=cfn(-1,0.5,0)--,-0,-0,-1,0,1,0,1,0,0) | |
| 412 | -- l_shl_c1=cfn(0.5,0.5,0)--,-0,-0,-1,0,1,0,1,0,0) | |
| 413 | ||
| 414 | r_hip_c0=cfn(1,-1,0)--,0,0,1,0,1,0,-1,-0,-0) | |
| 415 | r_hip_c1=cfn(0.5,1,0)--,0,0,1,0,1,0,-1,-0,-0) | |
| 416 | ||
| 417 | l_hip_c0=cfn(-1,-1,0)--,-0,-0,-1,0,1,0,1,0,0) | |
| 418 | l_hip_c1=cfn(-0.5,1,0)--,-0,-0,-1,0,1,0,1,0,0) | |
| 419 | ||
| 420 | ||
| 421 | orig_rhip_c0=cfn(1,-1,0,0,0,1,0,1,0,-1,-0,-0) | |
| 422 | orig_lhip_c0=cfn(-1,-1,0,-0,-0,-1,0,1,0,1,0,0) | |
| 423 | ||
| 424 | rw_cf=r_shl_c0 | |
| 425 | lw_cf=l_shl_c0 | |
| 426 | ||
| 427 | rw2_cf=r_hip_c0 | |
| 428 | lw2_cf=l_hip_c0 | |
| 429 | end | |
| 430 | ||
| 431 | do ---ANIMATIONSYSTEM | |
| 432 | function Lock(which) | |
| 433 | arms={char:FindFirstChild'Right Arm',char:FindFirstChild'Left Arm'}
| |
| 434 | legs={char:FindFirstChild'Right Leg',char:FindFirstChild'Left Leg'}
| |
| 435 | local sh={torso:FindFirstChild'Right Shoulder',torso:FindFirstChild'Left Shoulder'}
| |
| 436 | local sh2={torso:FindFirstChild'Right Hip',torso:FindFirstChild'Left Hip'}
| |
| 437 | -- print(unpack(sh),unpack(arms)) | |
| 438 | if arms and torso and sh and legs and sh2 then | |
| 439 | if which=='R'then | |
| 440 | if not rw then | |
| 441 | sh[1].Part1=nil | |
| 442 | rw=Instance.new('Weld')
| |
| 443 | rw.Part0=torso | |
| 444 | rw.Parent=torso | |
| 445 | rw.Part1=arms[1] | |
| 446 | rw.C0=rw_cf | |
| 447 | rw.C1=r_shl_c1 | |
| 448 | else | |
| 449 | rw:Destroy() rw=nil | |
| 450 | sh[1].Part0=torso sh[1].Part1=arms[1] | |
| 451 | end | |
| 452 | elseif which=='L'then | |
| 453 | if not lw then | |
| 454 | sh[2].Part1=nil | |
| 455 | lw=Instance.new('Weld')
| |
| 456 | lw.Part0=torso | |
| 457 | lw.Parent=torso | |
| 458 | lw.Part1=arms[2] | |
| 459 | lw.C0=lw_cf | |
| 460 | lw.C1=l_shl_c1 | |
| 461 | else | |
| 462 | lw:Destroy()lw=nil | |
| 463 | sh[2].Part0=torso sh[2].Part1=arms[2] | |
| 464 | end | |
| 465 | end | |
| 466 | if which=='RR'then | |
| 467 | if not rw2 then | |
| 468 | sh2[1].Part1=nil | |
| 469 | rw2=Instance.new('Weld')
| |
| 470 | rw2.Part0=torso | |
| 471 | rw2.Parent=torso | |
| 472 | rw2.Part1=legs[1] | |
| 473 | rw2.C0=rw2_cf | |
| 474 | rw2.C1=r_hip_c1 | |
| 475 | else | |
| 476 | rw2.Parent=nil rw2=nil | |
| 477 | sh2[1].Part0=torso sh2[1].Part1=legs[1] | |
| 478 | end | |
| 479 | elseif which=='LL'then | |
| 480 | if not lw2 then | |
| 481 | sh2[2].Part1=nil | |
| 482 | lw2=Instance.new('Weld')
| |
| 483 | lw2.Part0=torso | |
| 484 | lw2.Parent=torso | |
| 485 | lw2.Part1=legs[2] | |
| 486 | lw2.C0=lw2_cf | |
| 487 | lw2.C1=l_hip_c1 | |
| 488 | else | |
| 489 | lw2.Parent=nil lw2=nil | |
| 490 | sh2[2].Part0=torso sh2[2].Part1=legs[2] | |
| 491 | end | |
| 492 | end | |
| 493 | end | |
| 494 | end | |
| 495 | ||
| 496 | function Anim(what) | |
| 497 | local weld=getfenv()[what] | |
| 498 | return function(where) | |
| 499 | if weld then | |
| 500 | target_pos[what]=def_pos[what]*where | |
| 501 | -- waitfor(weld,where) | |
| 502 | end | |
| 503 | end | |
| 504 | end | |
| 505 | ||
| 506 | char_hum=getHum(char) | |
| 507 | ||
| 508 | spd={
| |
| 509 | rw=.1;lw=.1;rw2=.1;lw2=.1;torw=.1;neck=.1;hw=.1; | |
| 510 | } | |
| 511 | setmetatable(spd,{
| |
| 512 | __newindex=function(tab,i,v) | |
| 513 | if i=='all'then | |
| 514 | for o,q in pairs(spd)do | |
| 515 | spd[o]=v | |
| 516 | end | |
| 517 | end end | |
| 518 | }) | |
| 519 | def_pos={
| |
| 520 | rw=rw_cf; | |
| 521 | lw=lw_cf; | |
| 522 | rw2=rw2_cf; | |
| 523 | lw2=lw2_cf; | |
| 524 | torw=ort; | |
| 525 | neck=norig; | |
| 526 | hw=cfn(); | |
| 527 | -- shield_w=cfn(-.25,0,0)*ang(math.pi,math.pi/2); | |
| 528 | } | |
| 529 | target_pos={
| |
| 530 | rw=rw_cf; | |
| 531 | lw=lw_cf; | |
| 532 | rw2=def_pos.rw2; | |
| 533 | lw2=def_pos.lw2; | |
| 534 | torw=def_pos.torw; | |
| 535 | neck=def_pos.neck; | |
| 536 | hw=cfn(); | |
| 537 | } | |
| 538 | can_anim={
| |
| 539 | rw=true;lw=true;rw2=true;lw2=true;torw=true;neck=true; | |
| 540 | } | |
| 541 | game:service'RunService':BindToRenderStep('Mug_Anims',5,function()
| |
| 542 | if cont_anim then | |
| 543 | if rw and can_anim.rw then | |
| 544 | rw.C0=rw.C0:lerp(target_pos.rw,spd.rw) | |
| 545 | end | |
| 546 | if lw and can_anim.lw then | |
| 547 | lw.C0=lw.C0:lerp(target_pos.lw,spd.lw) | |
| 548 | end | |
| 549 | if rw2 and can_anim.rw2 then | |
| 550 | rw2.C0=rw2.C0:lerp(target_pos.rw2,spd.rw2) | |
| 551 | end | |
| 552 | if lw2 and can_anim.lw2 then | |
| 553 | lw2.C0=lw2.C0:lerp(target_pos.lw2,spd.lw2) | |
| 554 | end | |
| 555 | if torw and can_anim.torw then | |
| 556 | torw.C0=torw.C0:lerp(target_pos.torw,spd.torw) | |
| 557 | end | |
| 558 | if neck and can_anim.neck then | |
| 559 | neck.C0=neck.C0:lerp(target_pos.neck,spd.neck) | |
| 560 | end | |
| 561 | if hw then | |
| 562 | hw.C1=hw.C1:lerp(target_pos.hw,spd.hw) | |
| 563 | end | |
| 564 | end | |
| 565 | end) | |
| 566 | end | |
| 567 | ||
| 568 | function tag(a,b) | |
| 569 | if type(b)=='string'then | |
| 570 | if not getfenv()[b]then | |
| 571 | getfenv()[b]={}
| |
| 572 | end | |
| 573 | table.insert(getfenv()[b],a) | |
| 574 | else | |
| 575 | table.insert(b,a) | |
| 576 | end | |
| 577 | end | |
| 578 | hinge=Part(.25,.5,.25)Mesh(hinge,1) | |
| 579 | hw=Weld(hinge,torso,.9,-.85,0,0,-math.pi/2,math.pi/2) | |
| 580 | restpos=hw.C0 | |
| 581 | ||
| 582 | d=Part(.1,.1,.1,'Black')Weld(d,hinge,0,.25)Mesh(d,1,1,.1) | |
| 583 | d=Part(.1,.1,.1,'Black')Weld(d,hinge,0,-.25)Mesh(d,1,1,.1) | |
| 584 | ||
| 585 | p=Part(.75,.5,.1)Mesh(p,3,1,1,.75) | |
| 586 | Create'Motor'{_P=p;Part0=p;Part1=hinge;
| |
| 587 | C0=cfn(.75/2,0,0)*ang(math.pi/2); | |
| 588 | C1=cfn(0,0,0)*ang(math.pi/2); | |
| 589 | MaxVelocity=.1 | |
| 590 | } | |
| 591 | ||
| 592 | p=Part(.75,.5,.1)Mesh(p,3,1,1,.5) | |
| 593 | mo=Create'Motor'{_P=p;Part0=p;Part1=hinge;
| |
| 594 | C0=cfn(-.75/2,0,0)*ang(-math.pi/2,0); | |
| 595 | C1=cfn(0,0,-.15/2)*ang(-math.pi/2,0,md'45'+md'135'); | |
| 596 | MaxVelocity=.15 | |
| 597 | } | |
| 598 | ||
| 599 | local tas={}
| |
| 600 | ||
| 601 | Spawn(function() | |
| 602 | while wait()do | |
| 603 | for e,o in ipairs(tas)do | |
| 604 | if o[2].Parent~=nil then | |
| 605 | o[1]=o[1]*ang(0,md'5') | |
| 606 | for i,v in ipairs(o[2]:children())do | |
| 607 | if v:IsA'Part'then | |
| 608 | v.CFrame=l(o[1],math.cos(i*m.tau/6)*o[2].MVal.Value,0,math.sin(i*m.tau/6)*o[2].MVal.Value) | |
| 609 | end | |
| 610 | end | |
| 611 | else | |
| 612 | table.remove(tas,e) | |
| 613 | end | |
| 614 | end | |
| 615 | end | |
| 616 | end) | |
| 617 | whirr_snd=Create'Sound'{_P=Weapn;SoundId='rbxassetid://278329638';Pitch=1.5;Volume=1}
| |
| 618 | droning_snd=Create'Sound'{_P=Weapon;SoundId='rbxassetid://275641634';Pitch=1.75;Volume=.1;Looped=true}
| |
| 619 | function lol() | |
| 620 | Lock'R' | |
| 621 | ||
| 622 | whirr_snd:Play() | |
| 623 | Anim'rw'(ang(md'75')*ang(0,md'90')) | |
| 624 | hw.Part0=rarm hw.C0=cfn(0,-1.1,0)*ang(-math.pi/2,md'25') | |
| 625 | mo.DesiredAngle=md'-135' | |
| 626 | wait'.25' | |
| 627 | cone=Part(1,1,1,'Cyan',.5)msh=Mesh(cone,'Spike',0,0,0) | |
| 628 | w=Weld(cone,p,0,0,0,math.pi/2) | |
| 629 | for i=0,1,.1 do | |
| 630 | w.C0=cfn(0,0,-1.75*i)*ang(math.pi/2) | |
| 631 | msh.Scale=v3n(i*.75,i*4.5,i*.75) | |
| 632 | wait() | |
| 633 | end | |
| 634 | wait() | |
| 635 | local obj,pos=Workspace:FindPartOnRay(Ray.new(l(cone).p,v3n(0,-10,0)),char) | |
| 636 | if obj and pos then | |
| 637 | local r=.75 | |
| 638 | local ps={}
| |
| 639 | local center=cfn(pos) | |
| 640 | local model=Create'Model'{_P=Weapon}
| |
| 641 | for i=0,m.tau,m.tau/6 do | |
| 642 | local p=Part(.1,.1,.1) p.Anchored=true Mesh(p,2).Name='m' | |
| 643 | p.Color=Color3.new(HSVtoRGB(0,0,1)) | |
| 644 | p.Parent=model | |
| 645 | p.CFrame=l(center,math.cos(i)*r,0,math.sin(i)*r) | |
| 646 | ||
| 647 | end | |
| 648 | local rv=Create'NumberValue'{_P=model;Name='MVal'}rv.Value=r
| |
| 649 | local t={center,model}
| |
| 650 | local snd=Create'Sound'{_P=model;SoundId='http://www.roblox.com/Asset/?id=15666462';
| |
| 651 | Pitch=.5;Looped=true} | |
| 652 | local snd2=Create'Sound'{_P=model;SoundId='http://www.roblox.com/Asset/?id=2101157';Pitch=1.15}
| |
| 653 | local snd3=Create'Sound'{_P=model;SoundId='http://www.roblox.com/Asset/?id=2974249';Pitch=2}
| |
| 654 | ||
| 655 | Edit{snd,snd2,snd3}{Volume=.25}
| |
| 656 | ||
| 657 | Spawn(function() | |
| 658 | snd:Play() | |
| 659 | local ptick=tick() | |
| 660 | repeat | |
| 661 | snd.Pitch=snd.Pitch+(.05*3) | |
| 662 | wait() | |
| 663 | until (tick()-ptick)>1 | |
| 664 | snd:Stop()snd3:Play() | |
| 665 | for i=0,1,.1 do | |
| 666 | for _,v in pairs(model:children())do | |
| 667 | if v:IsA'Part'then | |
| 668 | -- v.Transparency=i | |
| 669 | v.Color=Color3.new(HSVtoRGB(.5,0,1-i)) | |
| 670 | end | |
| 671 | end | |
| 672 | wait() | |
| 673 | end | |
| 674 | snd2:Play() | |
| 675 | for i=0,1,.05 do | |
| 676 | rv.Value=rv.Value+.5 | |
| 677 | local pillar=Part(rv.Value,1,rv.Value,'Black',.75)local msh=Mesh(pillar,1)pillar.Anchored=true | |
| 678 | local cf=center*ang(mr(-5,5),mr(-5,5),mr(-5,5)) | |
| 679 | pillar.CFrame=cf | |
| 680 | Spawn(function() | |
| 681 | for i=0,1,.1 do | |
| 682 | pillar.Size=v3n(rv.Value,10*i,rv.Value) | |
| 683 | pillar.CFrame=cf*cfn(0,pillar.Size.y/2,0) | |
| 684 | pillar.Transparency=.75+i*(1-.75) | |
| 685 | wait() | |
| 686 | end | |
| 687 | end) | |
| 688 | for _,v in pairs(model:children())do | |
| 689 | if v:IsA'Part'then | |
| 690 | v.Transparency=i | |
| 691 | v.m.Scale=v3n(1+i*30,1+i*30,1+i*30) | |
| 692 | -- v.Color=Color3.new(HSVtoRGB(0,.5,1-i*.5)) | |
| 693 | end | |
| 694 | end | |
| 695 | for i,v in pairs(findHum(center.p,rv.Value))do | |
| 696 | v:TakeDamage'10' | |
| 697 | end | |
| 698 | wait() | |
| 699 | end | |
| 700 | model:Destroy() | |
| 701 | end) | |
| 702 | table.insert(tas,t) | |
| 703 | end | |
| 704 | wait(.15) | |
| 705 | for i=1,0,-.1 do | |
| 706 | w.C0=cfn(0,0,-1.75*i)*ang(math.pi/2) | |
| 707 | msh.Scale=v3n(i*.75,i*4.5,i*.75) | |
| 708 | wait() | |
| 709 | end cone:destroy() | |
| 710 | whirr_snd:Play() | |
| 711 | Anim'rw'(cfn()) | |
| 712 | mo.DesiredAngle=0 | |
| 713 | wait'.25' | |
| 714 | hw.Part0=torso hw.C0=cfn(.9,-.85,0)*ang(0,-math.pi/2,math.pi/2) | |
| 715 | Lock'R' | |
| 716 | end | |
| 717 | ||
| 718 | local pd_snd=Create'Sound'{_P=Weapon;SoundId='http://www.roblox.com/Asset/?id=2785493';Pitch=1.35}
| |
| 719 | function lol2() | |
| 720 | Lock'R' | |
| 721 | Anim'rw'(ang(md'135',0,md'15')*ang(0,md'15')) | |
| 722 | hw.Part0=rarm hw.C0=cfn(0,-1.1,0)*ang(math.pi,md'-10') | |
| 723 | wait'.15' | |
| 724 | mo.DesiredAngle=md'-90' | |
| 725 | wait'.5' | |
| 726 | local laz=Part(.5,1,.5,'Cyan',.5)laz.Material='Neon'local msh=Mesh(laz,2) | |
| 727 | pd_snd:Play() | |
| 728 | ||
| 729 | laz.Anchored=true | |
| 730 | spos=l(hinge,0,0) | |
| 731 | laz.CFrame=spos | |
| 732 | ||
| 733 | local ignorelist={}
| |
| 734 | for i=0,1,.25 do spos=l(hinge,0,0) | |
| 735 | table.insert(ignorelist,char) | |
| 736 | local hit,pos=Workspace:FindPartOnRayWithIgnoreList(Ray.new(l(laz,0,0,-laz.Size.z/2).p,l(laz).lookVector*4),ignorelist) | |
| 737 | if hit and pos then | |
| 738 | for lo=1,1 do | |
| 739 | if hit:IsDescendantOf(char)then break end | |
| 740 | local sx,sy,sz=hit.Size.X,hit.Size.y,hit.Size.z | |
| 741 | local as=(sx+sy+sz)/3 | |
| 742 | if as>20 then break end | |
| 743 | table.insert(ignorelist,hit) | |
| 744 | Create'ParticleEmitter'{_P=hit;
| |
| 745 | Size=NumberSequence.new{numkp(0,as*.1);numkp(1,as*.5)};
| |
| 746 | Transparency=NumberSequence.new{numkp(0,0);numkp(1,1)};
| |
| 747 | Color=ColorSequence.new(bcol'Cyan'.Color,bcol'Deep blue'.Color); | |
| 748 | Lifetime=NumberRange.new(.1,.4); | |
| 749 | VelocitySpread=360; | |
| 750 | Speed=NumberRange.new(as*.5); | |
| 751 | } | |
| 752 | Spawn(function() | |
| 753 | for i=hit.Transparency,1,.05 do | |
| 754 | hit.Transparency=i wait() | |
| 755 | end hit:Destroy()end) | |
| 756 | end | |
| 757 | end | |
| 758 | ||
| 759 | tpos=l(torso,0,0,-7) | |
| 760 | local mag=(spos.p-tpos.p).magnitude | |
| 761 | laz.Size=v3n(.5,.5,mag*i) | |
| 762 | laz.CFrame=cfn(spos.p,tpos.p)*cfn(0,0,(-mag/2)*i) | |
| 763 | wait() | |
| 764 | end | |
| 765 | local cf=laz.CFrame | |
| 766 | for i=0,1,.1 do | |
| 767 | msh.Scale=v3n(1-i,1-i,1) | |
| 768 | laz.Transparency=.5+i*.5 | |
| 769 | wait() | |
| 770 | end laz:Destroy() | |
| 771 | mo.DesiredAngle=0 | |
| 772 | wait'.25' | |
| 773 | Anim'rw'(cfn()) | |
| 774 | wait'.25' | |
| 775 | hw.Part0=torso hw.C0=restpos | |
| 776 | Lock'R' | |
| 777 | end | |
| 778 | ||
| 779 | shoot_snd=Create'Sound'{_P=Weapon;SoundId='rbxassetid://384105511';Pitch=1.15}
| |
| 780 | function kiball() | |
| 781 | holding=true | |
| 782 | local ptick=tick() | |
| 783 | local bg=Create'BodyGyro'{_P=torso;maxTorque=v3n(1,1,1)*9e+008;P=9e+006}
| |
| 784 | Lock'L'Anim'lw'(ang(0,0,md'-90'))wait'.25' | |
| 785 | while holding do | |
| 786 | bg.cframe=cfn(l(torso).p,v3n(mouse.hit.x,l(torso).y,mouse.hit.z))*ang(0,-math.pi/2,0) | |
| 787 | ||
| 788 | if (tick()-ptick)>.25 then shoot_snd:Play() | |
| 789 | local ki=Part(1,1,1)ki.Anchored=true ki.CFrame=l(bl) local msh=Mesh(ki,3) | |
| 790 | tar=mouse.hit | |
| 791 | local dir=mr(-1,1) | |
| 792 | Spawn(function() | |
| 793 | for i=0,1,.1 do | |
| 794 | ki.CFrame=ki.CFrame*cfn(-math.abs(math.sin((tick()+1)))*3,0,0) | |
| 795 | ki.CFrame=ki.CFrame:lerp(tar,i) | |
| 796 | wait() | |
| 797 | end | |
| 798 | for i=0,1,.1 do | |
| 799 | Edit{msh,ki}{Transparency=i;Size=v3n(1+i*3,1+i*3,1+i*3)}
| |
| 800 | wait() | |
| 801 | end ki:destroy() | |
| 802 | end) | |
| 803 | ptick=tick() | |
| 804 | end | |
| 805 | wait() | |
| 806 | end bg:Destroy() Anim'lw'(cfn())wait'.5'Lock'L' | |
| 807 | end | |
| 808 | ||
| 809 | function getAverageSize(val) | |
| 810 | local value_is_object=pcall(function()return val.className end) | |
| 811 | local x,y,z | |
| 812 | if value_is_object then | |
| 813 | x,y,z=val.Size.x,val.Size.y,val.Size.z | |
| 814 | else | |
| 815 | x,y,z=val.x,val.y,val.z | |
| 816 | end | |
| 817 | return (x+y+z)/3 | |
| 818 | end | |
| 819 | ||
| 820 | bl=Part(.1,.1,.1,'New Yeller')Mesh(bl,2)Weld(bl,larm,-.25,-.6) | |
| 821 | function lol3() | |
| 822 | Lock'L' | |
| 823 | Anim'lw'(cfn(.2,0,-.15)*ang(md'25',0,md'65')*ang(0,md'-75')) | |
| 824 | wait'.25'bl.Material='Neon' | |
| 825 | local shield=Part(5,5,.1,'New Yeller',.75)shield.Material='Neon'shield.Anchored=true | |
| 826 | shield.CanCollide=true | |
| 827 | -- shield.Parent=Workspace.CurrentCamera | |
| 828 | shield.Touched:connect(function(a) | |
| 829 | if a.Parent and (not a:IsDescendantOf(char)) then | |
| 830 | -- a:BreakJoints() | |
| 831 | for i,v in pairs(a:children())do | |
| 832 | if v:IsA'BodyMover'then v:Destroy()end | |
| 833 | end | |
| 834 | ||
| 835 | end | |
| 836 | end) | |
| 837 | ||
| 838 | local msh=Mesh(shield,3,0,0,0) | |
| 839 | shield.CFrame=l(torso) | |
| 840 | droning_snd:Play() | |
| 841 | for i=0,1,.1 do | |
| 842 | shield.CFrame=shield.CFrame:lerp(l(torso,0,0,-3),.8) | |
| 843 | shield.Velocity=shield.CFrame.lookVector*400 | |
| 844 | msh.Scale=v3n(i,i,i) | |
| 845 | wait() | |
| 846 | end | |
| 847 | holding=true | |
| 848 | local ptick=tick() | |
| 849 | local dir=1 | |
| 850 | local bol=false | |
| 851 | ||
| 852 | while holding do | |
| 853 | if (tick()-ptick)>.5 then dir=dir*-1 ptick=tick()end | |
| 854 | shield.Transparency=shield.Transparency+dir*.005 | |
| 855 | shield.CFrame=shield.CFrame:lerp(l(torso,0,0,-3),.8) | |
| 856 | shield.Velocity=shield.CFrame.lookVector*400 | |
| 857 | local pp=Part(.1,.1,.1,'New Yeller',.75)pp.Material='Neon'Mesh(pp,3,.5,.5,.5) | |
| 858 | pp.CFrame=l(bl) | |
| 859 | Create'BodyPosition'{_P=pp;position=l(shield,mr(-2.5,2.5),mr(-2.5,2.5),0).p}
| |
| 860 | Debris:AddItem(pp,.4) | |
| 861 | ||
| 862 | wait() | |
| 863 | end | |
| 864 | droning_snd:Stop() | |
| 865 | for i=1,0,-.1 do | |
| 866 | shield.CFrame=shield.CFrame:lerp(l(torso,0,0,-3),.8) | |
| 867 | msh.Scale=v3n(i,i,i) | |
| 868 | wait() | |
| 869 | end | |
| 870 | shield:Destroy() | |
| 871 | bl.Material='Plastic' | |
| 872 | Anim'lw'(cfn()) | |
| 873 | wait'.25'Lock'L' | |
| 874 | end | |
| 875 | ||
| 876 | klist={
| |
| 877 | f=lol2; | |
| 878 | e=lol; | |
| 879 | cq=lol3; | |
| 880 | rq=kiball; | |
| 881 | } | |
| 882 | ||
| 883 | local con,con2 | |
| 884 | con=mouse.KeyUp:connect(function(key) | |
| 885 | for i,v in pairs(klist)do | |
| 886 | if key==i:sub(1,1) and i:sub(2,2)=='q'then | |
| 887 | holding=false | |
| 888 | end | |
| 889 | end | |
| 890 | end) | |
| 891 | con2=mouse.KeyDown:connect(function(key) | |
| 892 | if attacking then return end | |
| 893 | attacking=true | |
| 894 | for i,v in pairs(klist)do | |
| 895 | if key==i:sub(1,1) then | |
| 896 | v() | |
| 897 | end | |
| 898 | end | |
| 899 | attacking=false | |
| 900 | end) | |
| 901 | tag(con,'cons')tag(con2,'cons') | |
| 902 | ||
| 903 | char.ChildAdded:connect(function(a) | |
| 904 | if a:IsA'Script'then for i,v in pairs(cons)do v:disconnect()end end end) |