Advertisement
Idkrandomthingyyyy

blackben reanims ( patchma )

Jul 13th, 2024 (edited)
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 88.96 KB | None | 0 0
  1. game=workspace.Parent
  2. local osclock=os.clock
  3. local tspawn=task.spawn
  4. local twait=task.wait
  5. local schar=string.char
  6. local ssub=string.sub
  7. local sfind=string.find
  8. local supper=string.upper
  9. local mrandom=math.random
  10. local sin=math.sin
  11. local cos=math.cos
  12. local abs=math.abs
  13. local rad=math.rad
  14. local min=math.min
  15. local clamp=math.clamp
  16. local tinsert=table.insert
  17. local tclear=table.clear
  18. local tclone=table.clone
  19. local tfind=table.find
  20. local tunpack=table.unpack
  21.  
  22. --the script doesnt have to read global varaibles every time to get them
  23. --why not have them saved in local varaibles for faster access times
  24. local next=next
  25. local pcall=pcall
  26. local xpcall=xpcall
  27. local type=type
  28. local typeof=typeof
  29. local game=game
  30.  
  31. local i=Instance.new
  32. local v2=Vector2.new
  33. local v3=Vector3.new
  34. local c3=Color3.new
  35. local cf=CFrame.new
  36. local cfl=CFrame.lookAt
  37. local angles=CFrame.Angles
  38. local u2=UDim2.new
  39. local e=Enum
  40. local rp=RaycastParams.new
  41. local cs=ColorSequence.new
  42. local csk=ColorSequenceKeypoint.new
  43.  
  44. local sine=osclock()
  45. local deltaTime=0
  46. local v3_0=v3(0,0,0)
  47. local v3_101=v3(1,0,1)
  48. local v3_010=v3(0,1,0)
  49. local v3_001=v3(0,0,1)
  50. local cf_0=cf(0,0,0)
  51. local v3_xz=v3_101*10
  52. local v3_xzL=v3_101*250.1
  53. local v3_net=v3_010*25.01
  54.  
  55. local function rs(l)
  56. l=l or mrandom(8,15)
  57. local s=""
  58. for i=1,l do
  59. if mrandom(1,2)==1 then
  60. s=s..schar(mrandom(65,90))
  61. else
  62. s=s..schar(mrandom(97,122))
  63. end
  64. end
  65. return s
  66. end
  67.  
  68. --it runs even faster if u call __index and __newindex of metatables of userdata directly
  69. local function getMetamethodFromErrorStack(userdata,f,test)
  70. local ret=nil
  71. xpcall(f,function()
  72. ret=debug.info(2,"f")
  73. end,userdata,nil,0)
  74. if (type(ret)~="function") or not test(ret) then
  75. return f
  76. end
  77. return ret
  78. end
  79. local insSet=getMetamethodFromErrorStack(game,function(a,b,c) a[b]=c end,function(f) local a=i("Folder") local b=rs() f(a,"Name",b) return a.Name==b end)
  80. local insGet=getMetamethodFromErrorStack(game,function(a,b) return a[b] end,function(f) local a=i("Folder") local b=rs() a.Name=b return f(a,"Name")==b end)
  81. local cfGet=getMetamethodFromErrorStack(cf_0,function(a,b) return a[b] end,function(f) return f(cf(1,2,3),"Position")==v3(1,2,3) end)
  82. local cfMul=getMetamethodFromErrorStack(cf_0,function(a,b) return a*b end,function(f) return angles(1,2,3)*angles(1,2,3)==f(angles(1,2,3),angles(1,2,3)) end)
  83. local cfAdd=getMetamethodFromErrorStack(cf_0,function(a,b) return a+b end,function(f) return cf(1,2,3)+v3(1,2,3)==f(cf(1,2,3),v3(1,2,3)) end)
  84. local v3Get=getMetamethodFromErrorStack(v3_0,function(a,b) return a[b] end,function(f) return v3(1,2,3).Unit==f(v3(1,2,3),"Unit") end)
  85. --multiplying and adding vector3 is faster if you use the * and + operators
  86.  
  87. --no need to index instances every time to call their functions
  88. local Clone=insGet(game,"Clone")
  89. local ClearAllChildren=insGet(game,"ClearAllChildren")
  90. local Destroy=insGet(game,"Destroy")
  91. local IsA=insGet(game,"IsA")
  92. local FindFirstChildOfClass=insGet(game,"FindFirstChildOfClass")
  93. local FindFirstChildWhichIsA=insGet(game,"FindFirstChildWhichIsA")
  94. local GetChildren=insGet(game,"GetChildren")
  95. local GetDescendants=insGet(game,"GetDescendants")
  96. local IsDescendantOf=insGet(game,"IsDescendantOf")
  97. local GetPropertyChangedSignal=insGet(game,"GetPropertyChangedSignal")
  98.  
  99. --findfirstchildofclass faster than getservice
  100. local plrs=FindFirstChildOfClass(game,"Players")
  101. local rus=FindFirstChildOfClass(game,"RunService")
  102. local ws=FindFirstChildOfClass(game,"Workspace")
  103. local uis=FindFirstChildOfClass(game,"UserInputService")
  104. local gs=FindFirstChildOfClass(game,"GuiService")
  105. local lp=insGet(plrs,"LocalPlayer")
  106. local pg=FindFirstChildOfClass(lp,"PlayerGui")
  107. local mouse=insGet(lp,"GetMouse")(lp)
  108. local stepped=insGet(rus,"Stepped")
  109. local heartbeat=insGet(rus,"Heartbeat")
  110. local renderstepped=insGet(rus,"RenderStepped")
  111.  
  112. local GetPlayers=insGet(plrs,"GetPlayers")
  113. local Raycast=insGet(ws,"Raycast")
  114. local Connect=heartbeat.Connect
  115. local Disconnect=Connect(GetPropertyChangedSignal(game,"CreatorId"),type).Disconnect
  116. local Wait=heartbeat.Wait
  117. local GetMouseLocation=insGet(uis,"GetMouseLocation")
  118. local GetFocusedTextBox=insGet(uis,"GetFocusedTextBox")
  119. local GetMouseDelta=insGet(uis,"GetMouseDelta")
  120. local IsMouseButtonPressed=insGet(uis,"IsMouseButtonPressed")
  121. local IsKeyDown=insGet(uis,"IsKeyDown")
  122.  
  123. local Inverse=cfGet(cf_0,"Inverse")
  124. local Lerp=cfGet(cf_0,"Lerp")
  125.  
  126. local guiTheme={
  127. guiTitle="blackben reanims",
  128. windowTitleColor=c3(0,0,1),
  129. windowTopColor=c3(0,0,0),
  130. windowBottomColor=c3(0,0,1),
  131. windowMinimizedSize={X=220,Y=22},
  132. windowRegularSize={X=220,Y=290},
  133. buttonsTextColor=c3(0.0941177,0.317647,0.878431),
  134. labelsTextColor=c3(0.560784,0.560784,0.560784),
  135. listTopColor=c3(0,0,0),
  136. listBottomColor=c3(0.0705882,0.0705882,0.0705882)
  137. }
  138.  
  139. local accessorylimbs={
  140. {meshid="11263221350",textureid="11263219250",C0=angles(1.5707963267948966,0,1.5707963267948966),Name="Left Arm"},
  141. {meshid="11159370334",textureid="11159284657",C0=angles(-1.5707963267948966,0,1.5707963267948966),Name="Right Arm"},
  142.  
  143. {meshid="14255522247",textureid="",C0=angles(1.5707963267948966,0,1.5707963267948966),Name="Left Arm"},
  144. {meshid="14255522247",textureid="",C0=angles(-1.5707963267948966,0,1.5707963267948966),Name="Right Arm"},
  145.  
  146. {meshid="17374767929",textureid="",C0=angles(1.5707963267948966,0,1.5707963267948966),Name="Left Arm"},
  147. {meshid="17374767929",textureid="",C0=angles(-1.5707963267948966,0,1.5707963267948966),Name="Right Arm"},
  148.  
  149. {meshid="12344207333",textureid="",C0=angles(2,0,0),Name="Left Arm"},
  150. {meshid="12344206657",textureid="",C0=angles(2,0,0),Name="Right Arm"},
  151.  
  152. {meshid="13831073174",textureid="",C0=cfMul(cf(0.017,0,-0.23),angles(-1.4835298641951802,-0.15707963267948966,2.199114857512855)),Name="Left Arm"},
  153. {meshid="13839903766",textureid="",C0=cfMul(cf(0,-0.62,-0.01),angles(1.6580627893946132,0.15707963267948966,-2.199114857512855)),Name="Right Arm"},
  154.  
  155. {meshid="11159370334",textureid="11159285454",C0=angles(1.5707963267948966,0,1.5707963267948966),Name="Left Leg"},
  156. {meshid="12652772399",textureid="12652775021",C0=cf(0,-0.125,0),Name="Right Leg"},
  157.  
  158. {meshid="14768684979",textureid="",C0=angles(0,0,1.5707963267948966),Name="Left Leg"},
  159. {meshid="14768684979",textureid="",C0=angles(0,0,1.5707963267948966),Name="Right Leg"},
  160.  
  161. {meshid="17387586286",textureid="",C0=angles(1.5707963267948966,0,1.5707963267948966),Name="Left Leg"},
  162. {meshid="17387586286",textureid="",C0=angles(-1.5707963267948966,0,1.5707963267948966),Name="Right Leg"},
  163.  
  164. {meshid="14768666349",textureid="",C0=cf_0,Name="Torso"},
  165. {meshid="14241018198",textureid="",C0=cf_0,Name="Torso"},
  166. {meshid="13421774668",textureid="",C0=cf_0,Name="Torso"},
  167.  
  168. {meshid="4324138105",textureid="4324138210",C0=cfMul(angles(-1.6144295580947547,1.5707963267948966,0),cf(-0.125,0.3,0)),Name="Left Arm"},
  169. {meshid="4154474745",textureid="4154474807",C0=cfMul(angles(1.5271630954950384,-1.5707963267948966,0),cf(-0.125,-0.3,0)),Name="Left Arm"},
  170. {meshid="3030546036",textureid="3650191503",C0=cfMul(angles(1.5271630954950384,1.5707963267948966,0),cf(0.125,-0.3,0)),Name="Right Arm"},
  171. {meshid="3030546036",textureid="3443321249",C0=cfMul(angles(-1.6144295580947547,-1.5707963267948966,0),cf(0.125,0.3,0)),Name="Right Arm"},
  172. {meshid="3030546036",textureid="3360974849",C0=cfMul(angles(1.5271630954950384,1.5707963267948966,0),cf(-0.125,-0.35,0)),Name="Left Leg"},
  173. {meshid="3030546036",textureid="3360978739",C0=cfMul(angles(-1.6144295580947547,-1.5707963267948966,0),cf(-0.125,0.3,0)),Name="Left Leg"},
  174. {meshid="3030546036",textureid="3033898741",C0=cfMul(angles(1.5271630954950384,-1.5707963267948966,0),cf(0.125,-0.35,0)),Name="Right Leg"},
  175. {meshid="3030546036",textureid="3409604993",C0=cfMul(angles(-1.6144295580947547,1.5707963267948966,0),cf(0.125,0.3,0)),Name="Right Leg"},
  176. {meshid="4819720316",textureid="4819722776",C0=angles(0,0,0.2617993877991494),Name="Torso"}
  177. }
  178.  
  179. local function gp(p,n,cl)
  180. for i,v in next,GetChildren(p) do
  181. if IsA(v,cl) and (insGet(v,"Name")==n) then
  182. return v
  183. end
  184. end
  185. return nil
  186. end
  187. local function timegp(p,n,c,t)
  188. t=osclock()+t
  189. while t>osclock() do
  190. local r=gp(p,n,c)
  191. if r then
  192. return r
  193. end
  194. Wait(stepped)
  195. end
  196. return nil
  197. end
  198. local function getNetlessVelocity(realVel)
  199. --if true then return v3_0 end
  200. --if true then return realVel end
  201. --if true then return v3_net end
  202. if v3Get(realVel,"Magnitude")>25.01 then
  203. return v3Get(realVel,"Unit")*v3_xzL+v3_net
  204. end
  205. return realVel*v3_xz+v3_net
  206. end
  207. local function getMeshOfPart(v)
  208. if IsA(v,"MeshPart") then
  209. return insGet(v,"MeshId"), insGet(v,"TextureID")
  210. elseif IsA(v,"BasePart") then
  211. v=FindFirstChildOfClass(v,"SpecialMesh")
  212. if v then
  213. return insGet(v,"MeshId"), insGet(v,"TextureId")
  214. end
  215. end
  216. return nil, nil
  217. end
  218. local function makeplaceholder(v)
  219. if typeof(v)~="Instance" then
  220. return nil
  221. end
  222. if not insGet(v,"Archivable") then
  223. insSet(v,"Archivable",true)
  224. end
  225. v=Clone(v)
  226. for i,v in next,GetChildren(v) do
  227. if IsA(v,"SpecialMesh") then
  228. insSet(v,"Name",rs())
  229. ClearAllChildren(v)
  230. else
  231. Destroy(v)
  232. end
  233. end
  234. insSet(v,"Name",rs())
  235. insSet(v,"Anchored",true)
  236. insSet(v,"CanCollide",false)
  237. insSet(v,"Transparency",0.25)
  238. insSet(v,"Parent",ws)
  239. return v
  240. end
  241. local function emptyfunction() end
  242.  
  243. local i1=i("Frame")
  244. local i2=i("Frame")
  245. local i3=i("Frame")
  246. local i4=i("ScrollingFrame")
  247. local i5=i("UIListLayout")
  248. local i6=i("UIGradient")
  249. local i7=i("TextBox")
  250. local i8=i("TextButton")
  251. local i9=i("UIGradient")
  252. local i10=i("ScreenGui")
  253. insSet(i1,"AnchorPoint",v2(0.5,0))
  254. insSet(i1,"Active",true)
  255. insSet(i1,"BorderSizePixel",0)
  256. insSet(i1,"ClipsDescendants",true)
  257. insSet(i1,"Position",u2(0.5,0,0.5,guiTheme.windowRegularSize.Y/-2))
  258. insSet(i1,"Size",u2(0,guiTheme.windowRegularSize.X,0,guiTheme.windowRegularSize.Y))
  259. insSet(i1,"Name",rs())
  260. insSet(i1,"Parent",i10)
  261. insSet(i2,"BackgroundColor3",c3(1,1,1))
  262. insSet(i2,"BorderSizePixel",0)
  263. insSet(i2,"Size",u2(0,guiTheme.windowRegularSize.X,0,guiTheme.windowRegularSize.Y))
  264. insSet(i2,"Name",rs())
  265. insSet(i2,"Parent",i1)
  266. insSet(i3,"BackgroundColor3",c3(1,1,1))
  267. insSet(i3,"BorderSizePixel",0)
  268. insSet(i3,"Position",u2(0,5,0,guiTheme.windowMinimizedSize.Y-2))
  269. insSet(i3,"Size",u2(1,-10,0,guiTheme.windowRegularSize.Y-guiTheme.windowMinimizedSize.Y-3))
  270. insSet(i3,"Name",rs())
  271. insSet(i3,"Parent",i2)
  272. insSet(i4,"Active",true)
  273. insSet(i4,"BackgroundTransparency",1)
  274. insSet(i4,"BorderSizePixel",0)
  275. insSet(i4,"Size",u2(1,-3,1,0))
  276. insSet(i4,"AutomaticCanvasSize",e.AutomaticSize.Y)
  277. insSet(i4,"CanvasSize",u2(0,0,0,0))
  278. insSet(i4,"ScrollBarThickness",7)
  279. insSet(i4,"Name",rs())
  280. insSet(i4,"Parent",i3)
  281. insSet(i5,"Name",rs())
  282. insSet(i5,"Parent",i4)
  283. insSet(i5,"SortOrder",e.SortOrder.LayoutOrder)
  284. insSet(i6,"Name",rs())
  285. insSet(i6,"Parent",i3)
  286. insSet(i6,"Color",cs({csk(0,guiTheme.listTopColor),csk(1,guiTheme.listBottomColor)}))
  287. insSet(i6,"Rotation",90)
  288. insSet(i7,"Font",e.Font.SourceSans)
  289. insSet(i7,"FontSize",e.FontSize.Size18)
  290. insSet(i7,"ClearTextOnFocus",false)
  291. insSet(i7,"Text",guiTheme.guiTitle)
  292. insSet(i7,"TextColor3",guiTheme.windowTitleColor)
  293. insSet(i7,"TextSize",16)
  294. insSet(i7,"AnchorPoint",v2(0.5,0))
  295. insSet(i7,"BackgroundTransparency",1)
  296. insSet(i7,"Position",u2(0.5,0,0,guiTheme.windowMinimizedSize.Y/2))
  297. insSet(i7,"Name",rs())
  298. insSet(i7,"Parent",i2)
  299. insSet(i8,"AnchorPoint",v2(1,0))
  300. insSet(i8,"BackgroundTransparency",1)
  301. insSet(i8,"Position",u2(1,0,0,0))
  302. insSet(i8,"Size",u2(0,40,0,guiTheme.windowMinimizedSize.Y))
  303. insSet(i8,"Name",rs())
  304. insSet(i8,"Parent",i2)
  305. insSet(i8,"Font",e.Font.SourceSans)
  306. insSet(i8,"FontSize",e.FontSize.Size18)
  307. insSet(i8,"Text","-")
  308. insSet(i8,"TextColor3",c3(1,1,1))
  309. insSet(i8,"TextSize",16)
  310. insSet(i9,"Name",rs())
  311. insSet(i9,"Parent",i2)
  312. insSet(i9,"Color",cs({csk(0,guiTheme.windowTopColor),csk(1,guiTheme.windowBottomColor)}))
  313. insSet(i9,"Rotation",90)
  314. insSet(i10,"ZIndexBehavior",e.ZIndexBehavior.Sibling)
  315. insSet(i10,"IgnoreGuiInset",true)
  316. insSet(i10,"ResetOnSpawn",false)
  317. insSet(i10,"DisplayOrder",2147483647)
  318. insSet(i10,"Name",rs())
  319. local guimin=false
  320. local minloop=false
  321. local i1X=guiTheme.windowRegularSize.X
  322. local i1Y=guiTheme.windowRegularSize.Y
  323. local i1Xdest=i1X
  324. local i1Ydest=i1Y
  325. Connect(insGet(i8,"MouseButton1Click"),function()
  326. guimin = not guimin
  327. if guimin then
  328. i1Xdest=guiTheme.windowMinimizedSize.X
  329. i1Ydest=guiTheme.windowMinimizedSize.Y
  330. else
  331. i1Xdest=guiTheme.windowRegularSize.X
  332. i1Ydest=guiTheme.windowRegularSize.Y
  333. end
  334. if minloop then
  335. return
  336. end
  337. minloop=true
  338. insSet(i3,"Visible",true)
  339. sine=osclock()
  340. local lastsine=sine
  341. while true do
  342. sine=osclock()
  343. local deltaTime=(sine-lastsine)*10
  344. lastsine=sine
  345. local difX=i1Xdest-i1X
  346. local difY=i1Ydest-i1Y
  347. if (abs(difY)<=1) and (abs(difX)<=1) then
  348. i1X=i1Xdest
  349. i1Y=i1Ydest
  350. insSet(i1,"Size",u2(0,i1X,0,i1Y))
  351. break
  352. end
  353. i1X=i1X+difX*deltaTime
  354. i1Y=i1Y+difY*deltaTime
  355. insSet(i1,"Size",u2(0,i1X,0,i1Y))
  356. twait()
  357. end
  358. insSet(i3,"Visible",not guimin)
  359. minloop=false
  360. end)
  361. local function Draggable(window,obj)
  362. local MB1enum = e.UserInputType.MouseButton1
  363. local TOUCHenum = e.UserInputType.Touch
  364. obj = obj or window
  365. local activeEntered = 0
  366. local mouseStart = nil
  367. local dragStart = nil
  368. local inputbegancon = nil
  369. local rendersteppedcon = nil
  370. local inputendedcon = nil
  371. local function inputendedf(a)
  372. a=insGet(a,"UserInputType")
  373. if (a==MB1enum) or (a==TOUCHenum) then
  374. Disconnect(rendersteppedcon)
  375. Disconnect(inputendedcon)
  376. end
  377. end
  378. local function rendersteppedf()
  379. local off = GetMouseLocation(uis)-mouseStart
  380. insSet(window,"Position",dragStart+u2(0,off.X,0,off.Y))
  381. end
  382. local function inputbeganf(a)
  383. a=insGet(a,"UserInputType")
  384. if ((a==MB1enum) or (a==TOUCHenum)) and (activeEntered==0) and not GetFocusedTextBox(uis) then
  385. mouseStart=GetMouseLocation(uis)
  386. dragStart=insGet(window,"Position")
  387. if rendersteppedcon then Disconnect(rendersteppedcon) end
  388. rendersteppedcon = Connect(renderstepped,rendersteppedf)
  389. if inputendedcon then Disconnect(inputendedcon) end
  390. inputendedcon = Connect(insGet(uis,"InputEnded"),inputendedf)
  391. end
  392. end
  393. Connect(insGet(obj,"MouseEnter"),function()
  394. if inputbegancon then Disconnect(inputbegancon) end
  395. inputbegancon = Connect(insGet(uis,"InputBegan"),inputbeganf)
  396. end)
  397. Connect(insGet(obj,"MouseLeave"),function()
  398. Disconnect(inputbegancon)
  399. end)
  400. local function ondes(d)
  401. if IsA(d,"GuiObject") then
  402. local thisEntered = false
  403. local thisAdded = false
  404. local con0 = Connect(insGet(d,"MouseEnter"),function()
  405. thisEntered = true
  406. if (not thisAdded) and insGet(d,"Active") then
  407. activeEntered = activeEntered + 1
  408. thisAdded = true
  409. end
  410. end)
  411. local con1 = Connect(insGet(d,"MouseLeave"),function()
  412. thisEntered = false
  413. if thisAdded then
  414. activeEntered = activeEntered - 1
  415. thisAdded = false
  416. end
  417. end)
  418. local con2 = Connect(GetPropertyChangedSignal(d,"Active"),function()
  419. if thisEntered then
  420. if thisAdded and not insGet(d,"Active") then
  421. activeEntered = activeEntered - 1
  422. thisAdded = false
  423. elseif insGet(d,"Active") and not thisAdded then
  424. activeEntered = activeEntered + 1
  425. thisAdded = true
  426. end
  427. end
  428. end)
  429. local con3 = nil
  430. con3 = Connect(insGet(d,"AncestryChanged"),function()
  431. if not IsDescendantOf(d,window) then
  432. if thisEntered then
  433. activeEntered = activeEntered - 1
  434. end
  435. Disconnect(con0)
  436. Disconnect(con1)
  437. Disconnect(con2)
  438. Disconnect(con3)
  439. end
  440. end)
  441. end
  442. end
  443. Connect(insGet(window,"DescendantAdded"),ondes)
  444. for i,v in next,GetDescendants(window) do
  445. ondes(v)
  446. end
  447. end
  448. local function btn(txt, f)
  449. local i1=i("TextBox")
  450. local i2=i("TextButton")
  451. insSet(i1,"Font",e.Font.SourceSans)
  452. insSet(i1,"FontSize",e.FontSize.Size14)
  453. insSet(i1,"Text",txt)
  454. insSet(i1,"ClearTextOnFocus",false)
  455. insSet(i1,"Position",u2(0.5,0,0.5,0))
  456. insSet(i1,"TextColor3",guiTheme.buttonsTextColor)
  457. insSet(i1,"Name",rs())
  458. insSet(i1,"Parent",i2)
  459. insSet(i2,"BackgroundTransparency",0)
  460. insSet(i2,"TextTransparency",1)
  461. insSet(i2,"Size",u2(1,0,0,14))
  462. insSet(i2,"Name",rs())
  463. if f then
  464. Connect(insGet(i2,"MouseButton1Click"),f)
  465. end
  466. insSet(i2,"Parent",i4)
  467. return i1
  468. end
  469. local function lbl(txt)
  470. local i1=i("TextBox")
  471. local i2=i("Frame")
  472. insSet(i1,"Font",e.Font.SourceSans)
  473. insSet(i1,"FontSize",e.FontSize.Size14)
  474. insSet(i1,"Text",txt)
  475. insSet(i1,"ClearTextOnFocus",false)
  476. insSet(i1,"TextColor3",guiTheme.labelsTextColor)
  477. insSet(i1,"Position",u2(0.5,0,0.5))
  478. insSet(i1,"BackgroundTransparency",1)
  479. insSet(i1,"Name",rs())
  480. insSet(i1,"Parent",i2)
  481. insSet(i2,"Size",u2(1,0,0,14))
  482. insSet(i2,"BackgroundTransparency",1)
  483. insSet(i2,"Name",rs())
  484. insSet(i2,"Parent",i4)
  485. return i1
  486. end
  487.  
  488. Draggable(i1)
  489.  
  490. lbl("myworld-all|anims-blackben")
  491. lbl("gg/QMy5f6DrbH Hax Upd")
  492.  
  493. local allowshiftlock=nil
  494. local ctrltp=nil
  495. local placeholders=nil
  496. local clickfling=nil
  497. local highlightflingtargets=nil
  498. local discharscripts=nil
  499. local flingchangestate=nil
  500. local respawntp=nil
  501. local breakjointsmethod=nil
  502. local simrad=false
  503.  
  504. local c=nil
  505. local function stopreanimate()
  506. if c then
  507. c=nil
  508. return true
  509. end
  510. return false
  511. end
  512. local function reanimate()
  513. --[[
  514. FDless reanimate by MyWorld
  515. aka no client sided instances
  516. "what else do i optimize here"
  517. ]]
  518.  
  519. local novoid = true --prevents parts from going under workspace.FallenPartsDestroyHeight if you control them
  520. local speedlimit = 3000 --makes your parts move slower if the magnitude of their velocity is higher than this
  521. local retVelTime = 0.51 --time that claimed parts have velocity to reclaim in case u lose them
  522. local walkSpeed = 16 --your walkspeed (can be changed at runtime)
  523. local jumpPower = 50 --your jump power (can be changed at runtime)
  524. local gravity = 196.2 --how fast the characters velocity decreases while falling (can be changed at runtime)
  525. local ctrlclicktp = ctrltp --makes you teleport where u point ur mouse cursor at when click and hold ctrl down
  526. local clickfling = clickfling --makes you fling the person you clicked when its available to do so
  527. local flingvel = v3(15000,16000,15000) --the rotation velocity that ur character will have while flinging
  528.  
  529. if stopreanimate() then return end
  530. c=insGet(lp,"Character")
  531. if not (c and IsDescendantOf(c,ws)) then return end
  532.  
  533. local rootpart=gp(c,"HumanoidRootPart","BasePart") or gp(c,"Torso","BasePart") or gp(c,"UpperTorso","BasePart") or timegp(c,"HumanoidRootPart","BasePart",0.5) or FindFirstChildWhichIsA(c,"BasePart")
  534. if not rootpart then return end
  535.  
  536. local cam=nil
  537. --theres a way to have ws.currentcamera nil on heartbeat and still have the game run normally
  538. local function refcam()
  539. local newcam=insGet(ws,"CurrentCamera")
  540. while not newcam do
  541. Wait(GetPropertyChangedSignal(ws,"CurrentCamera"))
  542. newcam=insGet(ws,"CurrentCamera")
  543. end
  544. cam=newcam
  545. end
  546. refcam()
  547. local camcf=insGet(cam,"CFrame")
  548. local enumCamS=e.CameraType.Scriptable
  549. local camt=insGet(cam,"CameraType")
  550. local camcon0=nil
  551. local camcon1=nil
  552. local camcon2=nil
  553. local function onnewcamera()
  554. refcam()
  555. if camcon0 then
  556. Disconnect(camcon0)
  557. Disconnect(camcon1)
  558. camcon0=nil
  559. end
  560. if not c then
  561. if insGet(cam,"CameraType")==enumCamS then
  562. insSet(cam,"CameraType",camt)
  563. end
  564. return Disconnect(camcon2)
  565. end
  566. camcon0=Connect(GetPropertyChangedSignal(cam,"CFrame"),function()
  567. if insGet(cam,"CFrame")~=camcf then
  568. insSet(cam,"CFrame",camcf)
  569. end
  570. end)
  571. camcon1=Connect(GetPropertyChangedSignal(cam,"CameraType"),function()
  572. if insGet(cam,"CameraType")~=enumCamS then
  573. insSet(cam,"CameraType",enumCamS)
  574. end
  575. end)
  576. if insGet(cam,"CameraType")~=enumCamS then
  577. insSet(cam,"CameraType",enumCamS)
  578. end
  579. if insGet(cam,"CFrame")~=camcf then
  580. insSet(cam,"CFrame",camcf)
  581. end
  582. end
  583. camcon2=Connect(GetPropertyChangedSignal(ws,"CurrentCamera"),onnewcamera)
  584. onnewcamera()
  585.  
  586. local velYdelta=insGet(ws,"Gravity")*0.025
  587. Connect(GetPropertyChangedSignal(ws,"Gravity"),function()
  588. velYdelta=insGet(ws,"Gravity")*0.025
  589. end)
  590.  
  591. local fpdh=insGet(ws,"FallenPartsDestroyHeight")
  592. novoid=novoid and (fpdh+1)
  593.  
  594. local Yvel=0
  595. local cfr=insGet(rootpart,"CFrame")
  596. local pos=cfGet(cfr,"Position")
  597. cfr=cfl(pos,pos+cfGet(cfr,"LookVector")*v3_101)
  598. local primarypart=nil
  599. local shiftlock=false
  600. local firstperson=false
  601. local xzvel=v3_0
  602. local v3_0150=v3_010*1.5
  603. local camcfLV=cfGet(camcf,"LookVector")
  604. local camrot=cfl(v3_0,camcfLV)
  605. local camcfRV=cfGet(camrot,"RightVector")
  606. local cammag=-v3Get((cfGet(camcf,"Position")-(pos+v3_0150)),"Magnitude")
  607.  
  608. local R6parts={
  609. head={Name="Head"},
  610. torso={Name="Torso"},
  611. root={Name="HumanoidRootPart"},
  612. leftArm={Name="Left Arm"},
  613. rightArm={Name="Right Arm"},
  614. leftLeg={Name="Left Leg"},
  615. rightLeg={Name="Right Leg"}
  616. }
  617. rootpart=R6parts.root
  618. local cframes={}
  619. for i,v in next,R6parts do
  620. cframes[v]=cfr
  621. end
  622. local joints={
  623. {
  624. Name="Neck",
  625. Part0=R6parts.torso,Part1=R6parts.head,
  626. C0=cf(0,1,0,-1,0,0,0,0,1,0,1,-0),
  627. C1=cf(0,-0.5,0,-1,0,0,0,0,1,0,1,-0)
  628. },
  629. {
  630. Name="RootJoint",
  631. Part0=rootpart,Part1=R6parts.torso,
  632. C0=cf(0,0,0,-1,0,0,0,0,1,0,1,-0),
  633. C1=cf(0,0,0,-1,0,0,0,0,1,0,1,-0)
  634. },
  635. {
  636. Name="Right Shoulder",
  637. Part0=R6parts.torso,Part1=R6parts.rightArm,
  638. C0=cf(1,0.5,0,0,0,1,0,1,-0,-1,0,0),
  639. C1=cf(-0.5,0.5,0,0,0,1,0,1,-0,-1,0,0)
  640. },
  641. {
  642. Name="Left Shoulder",
  643. Part0=R6parts.torso,Part1=R6parts.leftArm,
  644. C0=cf(-1,0.5,0,0,0,-1,0,1,0,1,0,0),
  645. C1=cf(0.5,0.5,0,0,0,-1,0,1,0,1,0,0)
  646. },
  647. {
  648. Name="Right Hip",
  649. Part0=R6parts.torso,Part1=R6parts.rightLeg,
  650. C0=cf(1,-1,0,0,0,1,0,1,-0,-1,0,0),
  651. C1=cf(0.5,1,0,0,0,1,0,1,-0,-1,0,0)
  652. },
  653. {
  654. Name="Left Hip",
  655. Part0=R6parts.torso,Part1=R6parts.leftLeg,
  656. C0=cf(-1,-1,0,0,0,-1,0,1,0,1,0,0),
  657. C1=cf(-0.5,1,0,0,0,-1,0,1,0,1,0,0)
  658. }
  659. }
  660.  
  661. local refreshedjoints={}
  662. local refreshjointsI=nil
  663. refreshjointsI=function(part)
  664. tinsert(refreshedjoints,part)
  665. for i,v in next,joints do
  666. local part0=v.Part0
  667. local part1=v.Part1
  668. if part1 and (part0==part) then
  669. cframes[part1]=cfMul(cframes[part],cfMul(v.C0,Inverse(v.C1)))
  670. if not tfind(refreshedjoints,part1) then
  671. refreshjointsI(part1)
  672. end
  673. elseif part0 and (part1==part) then
  674. cframes[part0]=cfMul(cframes[part],cfMul(v.C1,Inverse(v.C0)))
  675. if not tfind(refreshedjoints,part0) then
  676. refreshjointsI(part0)
  677. end
  678. end
  679. end
  680. end
  681. refreshjointsI(rootpart)
  682. tclear(refreshedjoints)
  683.  
  684. local attachments={
  685. RightShoulderAttachment={R6parts.rightArm,cf(0,1,0,1,0,0,0,1,0,0,0,1)},
  686. RightGripAttachment={R6parts.rightArm,cf(0,-1,0,1,0,0,0,1,0,0,0,1)},
  687. LeftFootAttachment={R6parts.leftLeg,cf(0,-1,0,1,0,0,0,1,0,0,0,1)},
  688. LeftShoulderAttachment={R6parts.leftArm,cf(0,1,0,1,0,0,0,1,0,0,0,1)},
  689. LeftGripAttachment={R6parts.leftArm,cf(0,-1,0,1,0,0,0,1,0,0,0,1)},
  690. RootAttachment={rootpart,cf(0,0,0,1,0,0,0,1,0,0,0,1)},
  691. RightFootAttachment={R6parts.rightLeg,cf(0,-1,0,1,0,0,0,1,0,0,0,1)},
  692. NeckAttachment={R6parts.torso,cf(0,1,0,1,0,0,0,1,0,0,0,1)},
  693. BodyFrontAttachment={R6parts.torso,cf(0,0,-0.5,1,0,0,0,1,0,0,0,1)},
  694. BodyBackAttachment={R6parts.torso,cf(0,0,0.5,1,0,0,0,1,0,0,0,1)},
  695. LeftCollarAttachment={R6parts.torso,cf(-1,1,0,1,0,0,0,1,0,0,0,1)},
  696. RightCollarAttachment={R6parts.torso,cf(1,1,0,1,0,0,0,1,0,0,0,1)},
  697. WaistFrontAttachment={R6parts.torso,cf(0,-1,-0.5,1,0,0,0,1,0,0,0,1)},
  698. WaistCenterAttachment={R6parts.torso,cf(0,-1,0,1,0,0,0,1,0,0,0,1)},
  699. WaistBackAttachment={R6parts.torso,cf(0,-1,0.5,1,0,0,0,1,0,0,0,1)},
  700. HairAttachment={R6parts.head,cf(0,0.6,0,1,0,0,0,1,0,0,0,1)},
  701. HatAttachment={R6parts.head,cf(0,0.6,0,1,0,0,0,1,0,0,0,1)},
  702. FaceFrontAttachment={R6parts.head,cf(0,0,-0.6,1,0,0,0,1,0,0,0,1)},
  703. FaceCenterAttachment={R6parts.head,cf(0,0,0,1,0,0,0,1,0,0,0,1)}
  704. }
  705.  
  706. local function getPart(name,blacklist)
  707. for i,v in next,cframes do
  708. if (i.Name==name) and not (blacklist and tfind(blacklist,i)) then
  709. return i
  710. end
  711. end
  712. return nil
  713. end
  714.  
  715. local function getJoint(name)
  716. for i,v in next,joints do
  717. if v.Name==name then
  718. return v
  719. end
  720. end
  721. return {C0=cf_0,C1=cf_0}
  722. end
  723.  
  724. local function getPartFromMesh(m,t,blacklist)
  725. if blacklist then
  726. for v,_ in next,cframes do
  727. if v.m and (not tfind(blacklist,v)) and sfind(v.m,m) and sfind(v.t,t) then
  728. return v
  729. end
  730. end
  731. else
  732. for v,_ in next,cframes do
  733. if v.m and sfind(v.m,m) and sfind(v.t,t) then
  734. return v
  735. end
  736. end
  737. end
  738. local p={m=m,t=t}
  739. cframes[p]=cfr
  740. local j={C0=cf_0,C1=cf_0,Part0=p}
  741. p.j=j
  742. return p
  743. end
  744.  
  745. local function getPartJoint(p)
  746. if cframes[p] then
  747. local j=p.j
  748. if j then
  749. return j
  750. end
  751. for i,v in next,joints do
  752. if v.Part0==p then
  753. return v
  754. end
  755. end
  756. for i,v in next,joints do
  757. if v.Part1==p then
  758. return v
  759. end
  760. end
  761. end
  762. return nil
  763. end
  764.  
  765. local function getAccWeldFromMesh(m,t)
  766. return getPartJoint(getPartFromMesh(m,t))
  767. end
  768.  
  769. local raycastparams=rp()
  770. raycastparams.FilterType=e.RaycastFilterType.Blacklist
  771. raycastparams.RespectCanCollide=true
  772. local rayfilter={}
  773. local characters={}
  774. local function refreshrayfilter()
  775. tclear(rayfilter)
  776. for i,v in next,characters do
  777. tinsert(rayfilter,v)
  778. end
  779. raycastparams.FilterDescendantsInstances=rayfilter
  780. end
  781. local flingtable={}
  782. local rootparts={}
  783. for i,v in next,accessorylimbs do
  784. v.p=getPart(v.Name)
  785. end
  786. local function makePartCons(p,t)
  787. if (t.p==p) and insGet(p,"Anchored") then
  788. t.p=nil
  789. end
  790. local con0=Connect(GetPropertyChangedSignal(p,"Anchored"),function()
  791. if insGet(p,"Anchored") then
  792. if t.p==p then
  793. t.c=nil
  794. t.p=nil
  795. end
  796. elseif not t.p then
  797. t.p=p
  798. end
  799. end)
  800. local con1=nil
  801. con1=Connect(insGet(p,"AncestryChanged"),function()
  802. if not IsDescendantOf(p,ws) then
  803. Disconnect(con0)
  804. Disconnect(con1)
  805. if t.p==p then
  806. t.p=nil
  807. end
  808. end
  809. end)
  810. end
  811. local ondes=nil
  812. ondes=function(v)
  813. if c and IsA(v,"Attachment") and IsDescendantOf(c,ws) then
  814. local v1=attachments[insGet(v,"Name")]
  815. if v1 then
  816. local p=insGet(v,"Parent")
  817. if insGet(p,"Parent")~=c then
  818. local meshid,textureid=getMeshOfPart(p)
  819. if meshid then
  820. local found=false
  821. for i,_ in next,cframes do
  822. if (meshid==i.m) and (textureid==i.t) then
  823. local p1=i.p
  824. if p1 and IsDescendantOf(p1,c) then
  825. if p1==p then
  826. found=true
  827. break
  828. end
  829. else
  830. found=true
  831. i.p=p
  832. makePartCons(p,i)
  833. break
  834. end
  835. else
  836. local j=i.j
  837. if j and sfind(meshid,i.m) and sfind(textureid,i.t) then
  838. i.m=meshid
  839. i.t=textureid
  840. i.l=insGet(p,"Position")
  841. i.p=p
  842. makePartCons(p,i)
  843. i.j=nil
  844. i.Name=insGet(p,"Name")
  845. j.C0=insGet(v,"CFrame")
  846. j.C1=v1[2]
  847. j.Part1=v1[1]
  848. tinsert(joints,j)
  849. found=true
  850. break
  851. end
  852. end
  853. end
  854. if not found then
  855. for i,l in next,accessorylimbs do
  856. if l.p and sfind(meshid,l.meshid) and sfind(textureid,l.textureid) then
  857. local t={Name=insGet(p,"Name"),l=insGet(p,"Position"),m=meshid,t=textureid,p=p}
  858. makePartCons(p,t)
  859. if placeholders then
  860. t.v=makeplaceholder(p)
  861. end
  862. cframes[t]=insGet(p,"CFrame")
  863. tinsert(joints,{Part0=t,Part1=l.p,C0=l.C0,C1=cf_0})
  864. l.p=nil
  865. found=true
  866. break
  867. end
  868. end
  869. if not found then
  870. local t={Name=insGet(p,"Name"),l=insGet(p,"Position"),m=meshid,t=textureid,p=p}
  871. makePartCons(p,t)
  872. if placeholders then
  873. t.v=makeplaceholder(p)
  874. end
  875. cframes[t]=insGet(p,"CFrame")
  876. tinsert(joints,{Part0=t,Part1=v1[1],C0=insGet(v,"CFrame"),C1=v1[2]})
  877. end
  878. end
  879. end
  880. end
  881. end
  882. end
  883. end
  884.  
  885. local simradv=0
  886. local charcons={}
  887. local function onplayer(v)
  888. simradv=simradv+1000
  889. local lastc=nil
  890. local function oncharacter()
  891. local newc=insGet(v,"Character")
  892. if c and newc and (newc~=lastc) then
  893. lastc=newc
  894. characters[v]=newc
  895. refreshrayfilter()
  896. if v==lp then
  897. if discharscripts then
  898. Connect(insGet(newc,"DescendantAdded"),discharscripts)
  899. for i,v in next,GetDescendants(newc) do
  900. if IsA(v,"Script") then
  901. insSet(v,"Disabled",true)
  902. end
  903. end
  904. end
  905. local hrp=timegp(newc,"HumanoidRootPart","BasePart",10)
  906. if not (hrp and c and IsDescendantOf(newc,ws)) then return end
  907. c=newc
  908. local fi,fv=next(flingtable)
  909. if fi then
  910. if flingchangestate then
  911. local hum=FindFirstChildOfClass(c,"Humanoid")
  912. if hum then
  913. insGet(hum,"ChangeState")(hum,e.HumanoidStateType.Physics)
  914. end
  915. end
  916. for i,v in next,tclone(flingtable) do
  917. if not c then
  918. return
  919. end
  920. local startpos=insGet(i,"Position")
  921. local stoptime=sine+3
  922. while true do
  923. twait()
  924. if sine>stoptime then
  925. break
  926. end
  927. if insGet(i,"Anchored") or not IsDescendantOf(i,ws) then
  928. break
  929. end
  930. if v3Get((startpos-insGet(i,"Position")),"Magnitude")>200 then
  931. break
  932. end
  933. local tcf=cfAdd(insGet(i,"CFrame"),insGet(i,"AssemblyLinearVelocity")*(sin(sine*15)+1))
  934. if novoid and (cfGet(tcf,"Y")<novoid) then
  935. tcf=cfAdd(tcf,v3_010*(novoid-cfGet(tcf,"Y")))
  936. end
  937. insSet(hrp,"CFrame",tcf)
  938. insSet(hrp,"AssemblyLinearVelocity",insGet(i,"AssemblyLinearVelocity")*v3_101*75)
  939. insSet(hrp,"AssemblyAngularVelocity",flingvel)
  940. end
  941. if v then
  942. Destroy(v)
  943. end
  944. flingtable[i]=nil
  945. end
  946. insSet(hrp,"AssemblyLinearVelocity",v3_0)
  947. insSet(hrp,"AssemblyAngularVelocity",v3_0)
  948. insSet(hrp,"CFrame",cfr)
  949. twait(0.2501)
  950. end
  951. if respawntp==1 then
  952. local startpos=pos+v3(mrandom(-32,32),0,mrandom(-32,32))
  953. local dir=nil
  954. local poscheck=true
  955. while poscheck do
  956. poscheck=false
  957. for i,v in next,rootparts do
  958. local diff=(startpos-insGet(v,"Position"))*v3_101
  959. if v3Get(diff,"Magnitude")<10 then
  960. poscheck=true
  961. dir=dir or (v3Get(diff,"Unit")*3)
  962. startpos=startpos+dir
  963. end
  964. end
  965. local diff=(startpos-pos)*v3_101
  966. if v3Get(diff,"Magnitude")<10 then
  967. poscheck=true
  968. dir=dir or (v3Get(diff,"Unit")*3)
  969. startpos=startpos+dir
  970. end
  971. end
  972. startpos=cfAdd(cfGet(cfr,"Rotation"),startpos)
  973. insSet(hrp,"CFrame",startpos)
  974. insSet(hrp,"AssemblyLinearVelocity",v3_0)
  975. insSet(hrp,"AssemblyAngularVelocity",v3_0)
  976. twait(0.2501)
  977. elseif respawntp==2 then
  978. insSet(hrp,"CFrame",cfAdd(cfr,cfGet(cfr,"RightVector")*3.5-cfGet(cfr,"LookVector")*3.5))
  979. insSet(hrp,"AssemblyLinearVelocity",v3_0)
  980. insSet(hrp,"AssemblyAngularVelocity",v3_0)
  981. twait(0.2501)
  982. elseif respawntp==3 then
  983. local t=osclock()+0.2501
  984. local startcf=cfAdd(cfMul(cfGet(cfr,"Rotation"),angles(1.5707963267948966,0,0)),pos*v3_101+v3_010*(fpdh+30))
  985. while twait() do
  986. insSet(hrp,"CFrame",startcf)
  987. insSet(hrp,"AssemblyLinearVelocity",v3_0)
  988. insSet(hrp,"AssemblyAngularVelocity",v3_0)
  989. if osclock()>t then
  990. break
  991. end
  992. end
  993. end
  994. if newc~=c then
  995. return
  996. end
  997. primarypart=insGet(newc,"PrimaryPart") or hrp
  998. if breakjointsmethod==1 then
  999. insGet(newc,"BreakJoints")(newc)
  1000. local h=FindFirstChildOfClass(newc,"Humanoid")
  1001. if h then
  1002. insSet(h,"Health",0)
  1003. end
  1004. elseif breakjointsmethod==2 then
  1005. local h=FindFirstChildOfClass(newc,"Humanoid")
  1006. if h then
  1007. insSet(h,"Health",0)
  1008. else
  1009. insGet(newc,"BreakJoints")(newc)
  1010. end
  1011. else
  1012. insGet(newc,"BreakJoints")(newc)
  1013. end
  1014. Connect(insGet(newc,"DescendantAdded"),ondes)
  1015. for i,v in next,GetDescendants(newc) do
  1016. ondes(v)
  1017. end
  1018. else
  1019. local hrp=timegp(newc,"HumanoidRootPart","BasePart",10)
  1020. if hrp and c and IsDescendantOf(newc,ws) then
  1021. rootparts[v]=hrp
  1022. end
  1023. end
  1024. end
  1025. end
  1026. charcons[v]=Connect(GetPropertyChangedSignal(v,"Character"),oncharacter)
  1027. oncharacter()
  1028. end
  1029. for i,v in next,GetPlayers(plrs) do simradv=simradv+1000 if v~=lp then tspawn(onplayer,v) end end
  1030. Connect(insGet(plrs,"PlayerAdded"),onplayer)
  1031. onplayer(lp)
  1032. Connect(insGet(plrs,"PlayerRemoving"),function(v)
  1033. simradv=simradv-1000
  1034. local charcon=charcons[v]
  1035. if charcon then
  1036. Disconnect(charcon)
  1037. end
  1038. characters[v]=nil
  1039. rootparts[v]=nil
  1040. end)
  1041. local setsimrad=emptyfunction
  1042. if simrad then
  1043. setsimrad=function()
  1044. local canset,_=pcall(function()
  1045. insSet(lp,"SimulationRadius",simradv)
  1046. end)
  1047. if canset then
  1048. setsimrad=function()
  1049. insSet(lp,"SimulationRadius",simradv)
  1050. end
  1051. else
  1052. setsimrad=emptyfunction
  1053. end
  1054. end
  1055. end
  1056.  
  1057. local mradN05=rad(-0.5)
  1058. local KeyCode=e.KeyCode
  1059. local enumMB2=e.UserInputType.MouseButton2
  1060. local enumMLCP=e.MouseBehavior.LockCurrentPosition
  1061. local enumMLC=(insGet(uis,"TouchEnabled") and enumMLCP) or e.MouseBehavior.LockCenter
  1062. local enumMD=e.MouseBehavior.Default
  1063. local enumMW=e.UserInputType.MouseWheel
  1064. local enumMM=e.UserInputType.MouseMovement
  1065.  
  1066. local mouseBehavior=nil
  1067. local lastMouseBehavior=insGet(uis,"MouseBehavior")
  1068. Connect(GetPropertyChangedSignal(uis,"MouseBehavior"),function()
  1069. if mouseBehavior and (insGet(uis,"MouseBehavior")~=mouseBehavior) then
  1070. insSet(uis,"MouseBehavior",mouseBehavior)
  1071. end
  1072. end)
  1073.  
  1074. local mode="default"
  1075. local defaultmode={}
  1076. local modes={default=defaultmode}
  1077.  
  1078. local lerpsIdle=emptyfunction
  1079. local lerpsWalk=emptyfunction
  1080. local lerpsJump=emptyfunction
  1081. local lerpsFall=emptyfunction
  1082.  
  1083. local function addmode(key,mode)
  1084. if (type(key)~="string") or (type(mode)~="table") then
  1085. return
  1086. end
  1087. for i,v in next,mode do
  1088. if type(v)~="function" then
  1089. mode[i]=nil
  1090. end
  1091. end
  1092. if key=="default" then
  1093. defaultmode=mode
  1094. modes.default=mode
  1095. lerpsIdle=mode.idle or emptyfunction
  1096. lerpsWalk=mode.walk or emptyfunction
  1097. lerpsJump=mode.jump or emptyfunction
  1098. lerpsFall=mode.fall or emptyfunction
  1099. if mode.modeEntered then
  1100. mode.modeEntered()
  1101. end
  1102. elseif #key==1 then
  1103. key=KeyCode[supper(ssub(key,1,1))]
  1104. modes[key]=mode
  1105. end
  1106. end
  1107.  
  1108. local keyW=KeyCode.W
  1109. local Wpressed=IsKeyDown(uis,keyW)
  1110. local keyA=KeyCode.A
  1111. local Apressed=IsKeyDown(uis,keyA)
  1112. local keyS=KeyCode.S
  1113. local Spressed=IsKeyDown(uis,keyS)
  1114. local keyD=KeyCode.D
  1115. local Dpressed=IsKeyDown(uis,keyD)
  1116. local keySpace=KeyCode.Space
  1117. local jumpingInput=IsKeyDown(uis,keySpace)
  1118.  
  1119. local FWmovement=0
  1120. local RTmovement=0
  1121. local isWalking=false
  1122. local function refreshKeyboardMovement()
  1123. if Wpressed then if Spressed then if Dpressed then if Apressed then isWalking=false else FWmovement=0 RTmovement=1 isWalking=true end else if Apressed then FWmovement=0 RTmovement=-1 isWalking=true else isWalking=false end end else FWmovement=1 if Dpressed then if Apressed then RTmovement=0 else RTmovement=1 end else if Apressed then RTmovement=-1 else RTmovement=0 end end isWalking=true end else if Spressed then FWmovement=-1 if Dpressed then if Apressed then RTmovement=0 else RTmovement=1 end else if Apressed then RTmovement=-1 else RTmovement=0 end end isWalking=true else if Dpressed then if Apressed then isWalking=false else FWmovement=0 RTmovement=1 isWalking=true end else if Apressed then FWmovement=0 RTmovement=-1 isWalking=true else isWalking=false end end end end
  1124. end
  1125. refreshKeyboardMovement()
  1126.  
  1127. local keyShift=KeyCode.LeftShift
  1128. Connect(insGet(uis,"InputBegan"),function(a)
  1129. if insGet(gs,"MenuIsOpen") or GetFocusedTextBox(uis) then
  1130. return
  1131. end
  1132. a=insGet(a,"KeyCode")
  1133. if a==keyW then
  1134. Wpressed=true
  1135. refreshKeyboardMovement()
  1136. elseif a==keyA then
  1137. Apressed=true
  1138. refreshKeyboardMovement()
  1139. elseif a==keyS then
  1140. Spressed=true
  1141. refreshKeyboardMovement()
  1142. elseif a==keyD then
  1143. Dpressed=true
  1144. refreshKeyboardMovement()
  1145. elseif a==keySpace then
  1146. jumpingInput=true
  1147. elseif a==keyShift then
  1148. shiftlock=allowshiftlock and not shiftlock
  1149. elseif modes[a] then
  1150. if modes[mode].modeLeft then
  1151. modes[mode].modeLeft()
  1152. end
  1153. if mode==a then
  1154. mode="default"
  1155. else
  1156. mode=a
  1157. end
  1158. local modet=modes[mode]
  1159. lerpsIdle=modet.idle or defaultmode.idle or emptyfunction
  1160. lerpsWalk=modet.walk or defaultmode.walk or emptyfunction
  1161. lerpsJump=modet.jump or defaultmode.jump or emptyfunction
  1162. lerpsFall=modet.fall or defaultmode.fall or emptyfunction
  1163. if modes[mode].modeEntered then
  1164. modes[mode].modeEntered()
  1165. end
  1166. end
  1167. end)
  1168. Connect(insGet(uis,"InputEnded"),function(a)
  1169. a=insGet(a,"KeyCode")
  1170. if a==keyW then
  1171. Wpressed=false
  1172. refreshKeyboardMovement()
  1173. elseif a==keyA then
  1174. Apressed=false
  1175. refreshKeyboardMovement()
  1176. elseif a==keyS then
  1177. Spressed=false
  1178. refreshKeyboardMovement()
  1179. elseif a==keyD then
  1180. Dpressed=false
  1181. refreshKeyboardMovement()
  1182. elseif a==keySpace then
  1183. jumpingInput=false
  1184. end
  1185. end)
  1186.  
  1187. local thumbstickEndX=0
  1188. local thumbstickStartY=0
  1189.  
  1190. local thumbstickSizeMultiplier=0
  1191.  
  1192. local jumpStartX=0
  1193. local jumpStartY=0
  1194. local jumpEndX=0
  1195. local jumpEndY=0
  1196.  
  1197. local thumbstickInputObject=nil
  1198. local jumpInputObject=nil
  1199. local cameraRotateInputObject=nil
  1200. local cameraZoomInputObject=nil
  1201.  
  1202. local thumbstickTouchStart=v3_0
  1203. local cameraZoomInputMagnitude=0
  1204.  
  1205. Connect(insGet(uis,"TouchStarted"),function(inputObject)
  1206. if insGet(gs,"MenuIsOpen") or GetFocusedTextBox(uis) then
  1207. return
  1208. end
  1209.  
  1210. local touchPos=insGet(inputObject,"Position")
  1211. local touchX=v3Get(touchPos,"X")
  1212. local touchY=v3Get(touchPos,"Y")
  1213.  
  1214. if (not thumbstickInputObject) and touchX<thumbstickEndX and touchY>thumbstickStartY then
  1215. thumbstickInputObject=inputObject
  1216. thumbstickTouchStart=insGet(inputObject,"Position")
  1217. isWalking=false
  1218. elseif (not jumpInputObject) and touchY>jumpStartY and touchX>jumpStartX and touchX<jumpEndX and touchY<jumpEndY then
  1219. jumpInputObject=inputObject
  1220. jumpingInput=true
  1221. elseif not cameraRotateInputObject then
  1222. cameraRotateInputObject=inputObject
  1223. else
  1224. cameraZoomInputObject=inputObject
  1225. cameraZoomInputMagnitude=v3Get(insGet(cameraRotateInputObject,"Position")-insGet(cameraZoomInputObject,"Position"),"Magnitude")
  1226. end
  1227. end)
  1228. Connect(insGet(uis,"TouchMoved"),function(inputObject)
  1229. local touchPos=insGet(inputObject,"Position")
  1230. local touchX=v3Get(touchPos,"X")
  1231. local touchY=v3Get(touchPos,"Y")
  1232. if inputObject==thumbstickInputObject then
  1233. local direction=insGet(inputObject,"Position")-thumbstickTouchStart
  1234. local directionMag=v3Get(direction,"Magnitude")/thumbstickSizeMultiplier
  1235. if directionMag>0.05 then
  1236. isWalking=true
  1237. direction=v3Get(direction,"Unit")*min(1,(directionMag-0.05)/0.95)
  1238. FWmovement=-v3Get(direction,"Y")
  1239. RTmovement=v3Get(direction,"X")
  1240. else
  1241. isWalking=false
  1242. end
  1243. elseif inputObject==jumpInputObject then
  1244. jumpingInput=touchY>jumpStartY and touchX>jumpStartX and touchX<jumpEndX and touchY<jumpEndY
  1245. else
  1246. if cameraZoomInputObject then
  1247. local newMagnitude=v3Get(insGet(cameraRotateInputObject,"Position")-insGet(cameraZoomInputObject,"Position"),"Magnitude")
  1248. cammag=cammag+(newMagnitude-cameraZoomInputMagnitude)*0.04*(0.75-cammag/4)
  1249. cameraZoomInputMagnitude=newMagnitude
  1250. if cammag<0 then
  1251. firstperson=false
  1252. else
  1253. cammag=0
  1254. firstperson=true
  1255. end
  1256. elseif inputObject==cameraRotateInputObject then
  1257. local rotation=GetMouseDelta(uis)*mradN05
  1258. camcfLV=cfGet(cfMul(camrot,angles(rotation.Y,rotation.X,0)),"LookVector")
  1259. camrot=cfl(v3_0,camcfLV)
  1260. camcfRV=cfGet(camrot,"RightVector")
  1261. end
  1262. end
  1263. end)
  1264. Connect(insGet(uis,"TouchEnded"),function(inputObject)
  1265. if inputObject==thumbstickInputObject then
  1266. thumbstickInputObject=nil
  1267. isWalking=false
  1268. elseif inputObject==jumpInputObject then
  1269. jumpInputObject=nil
  1270. jumpingInput=false
  1271. elseif inputObject==cameraRotateInputObject then
  1272. cameraRotateInputObject=nil
  1273. cameraZoomInputObject=nil
  1274. elseif inputObject==cameraZoomInputObject then
  1275. cameraZoomInputObject=nil
  1276. end
  1277. end)
  1278.  
  1279. local function refreshTouchRegions()
  1280. local sX=insGet(mouse,"ViewSizeX")
  1281. local sY=insGet(mouse,"ViewSizeY")
  1282. local isSmallScreen=min(sX,sY)<=500
  1283.  
  1284. sY=sY+insGet(gs,"TopbarInset").Height
  1285.  
  1286. thumbstickEndX=sX*0.4
  1287. thumbstickStartY=(sY+0)*0.333
  1288.  
  1289. if isSmallScreen then
  1290. thumbstickSizeMultiplier=35
  1291. jumpStartX=sX-95
  1292. jumpStartY=sY-90
  1293. jumpEndX=jumpStartX+70
  1294. jumpEndY=jumpStartY+70
  1295. else
  1296. thumbstickSizeMultiplier=60
  1297. jumpStartX=sX-170
  1298. jumpStartY=sY-210
  1299. jumpEndX=jumpStartX+120
  1300. jumpEndY=jumpStartY+120
  1301. end
  1302. end
  1303. Connect(GetPropertyChangedSignal(mouse,"ViewSizeX"),refreshTouchRegions)
  1304. Connect(GetPropertyChangedSignal(mouse,"ViewSizeY"),refreshTouchRegions)
  1305. Connect(GetPropertyChangedSignal(gs,"TopbarInset"),refreshTouchRegions)
  1306. refreshTouchRegions()
  1307.  
  1308. local mouseCameraMove=false
  1309. Connect(insGet(uis,"InputChanged"),function(a,b)
  1310. if b then return end
  1311. local inputType=insGet(a,"UserInputType")
  1312. if mouseCameraMove and inputType==enumMM then
  1313. local rotation=GetMouseDelta(uis)*mradN05
  1314. camcfLV=cfGet(cfMul(camrot,angles(rotation.Y,rotation.X,0)),"LookVector")
  1315. camrot=cfl(v3_0,camcfLV)
  1316. camcfRV=cfGet(camrot,"RightVector")
  1317. elseif inputType==enumMW then
  1318. cammag=cammag+v3Get(insGet(a,"Position"),"Z")*(0.75-cammag/4)
  1319. if cammag<0 then
  1320. firstperson=false
  1321. else
  1322. cammag=0
  1323. firstperson=true
  1324. end
  1325. end
  1326. end)
  1327.  
  1328. local function predictionfling(target)
  1329. if not c then
  1330. return false
  1331. end
  1332. if typeof(target)~="Instance" then
  1333. target=insGet(mouse,"Target")
  1334. if not target then
  1335. return false
  1336. end
  1337. end
  1338. if not IsDescendantOf(target,ws) then
  1339. return false
  1340. end
  1341. if IsA(target,"Humanoid") or IsA(target,"BasePart") then
  1342. target=insGet(target,"Parent")
  1343. if IsA(target,"Accessory") then
  1344. target=insGet(target,"Parent")
  1345. end
  1346. end
  1347. if (target==c) or (not IsA(target,"Model")) then
  1348. return false
  1349. end
  1350. local targetpart=gp(target,"HumanoidRootPart","BasePart") or gp(target,"Torso","BasePart") or gp(target,"UpperTorso","BasePart")
  1351. if (not targetpart) or (flingtable[targetpart]~=nil) then
  1352. return false
  1353. end
  1354. if highlightflingtargets then
  1355. local h=i("Highlight")
  1356. insSet(h,"Name",rs())
  1357. insSet(h,"Adornee",target)
  1358. insSet(h,"FillColor",c3(1,0,0))
  1359. insSet(h,"OutlineColor",c3(1,0,0))
  1360. insSet(h,"FillTransparency",0.5)
  1361. insSet(h,"OutlineTransparency",0)
  1362. insSet(h,"Parent",i10)
  1363. flingtable[targetpart]=h
  1364. else
  1365. flingtable[targetpart]=false
  1366. end
  1367. return true
  1368. end
  1369.  
  1370. local clickConnection=nil
  1371. if ctrlclicktp then
  1372. ctrlclicktp=KeyCode.LeftControl
  1373. local tpoff=v3_010*3
  1374. if clickfling then
  1375. clickConnection=Connect(insGet(mouse,"Button1Down"),function()
  1376. if insGet(mouse,"Target") then
  1377. if IsKeyDown(uis,ctrlclicktp) then
  1378. pos=cfGet(insGet(mouse,"Hit"),"Position")+tpoff
  1379. cfr=cfl(pos,pos+camcfLV*v3_101)
  1380. xzvel=v3_0
  1381. Yvel=0
  1382. else
  1383. predictionfling()
  1384. end
  1385. end
  1386. end)
  1387. else
  1388. clickConnection=Connect(insGet(mouse,"Button1Down"),function()
  1389. if insGet(mouse,"Target") and IsKeyDown(uis,ctrlclicktp) then
  1390. pos=cfGet(insGet(mouse,"Hit"),"Position")+tpoff
  1391. cfr=cfl(pos,pos+camcfLV*v3_101)
  1392. xzvel=v3_0
  1393. Yvel=0
  1394. end
  1395. end)
  1396. end
  1397. elseif clickfling then
  1398. clickConnection=Connect(insGet(mouse,"Button1Down"),predictionfling)
  1399. end
  1400.  
  1401. local noYvelTime=1
  1402. local lastsine=sine
  1403. local con=nil
  1404. local function mainFunction()
  1405. if not c then
  1406. for i,v in next,cframes do
  1407. local p=i.v
  1408. if p then
  1409. Destroy(p)
  1410. end
  1411. end
  1412. for i,v in next,flingtable do
  1413. if v then --it could be false
  1414. Destroy(v)
  1415. end
  1416. end
  1417. for i,v in next,charcons do
  1418. Disconnect(v)
  1419. end
  1420. if clickConnection then
  1421. Disconnect(clickConnection)
  1422. end
  1423. mouseBehavior=nil
  1424. insSet(uis,"MouseBehavior",enumMD)
  1425. onnewcamera()
  1426. local c=insGet(lp,"Character")
  1427. if c then
  1428. insSet(cam,"CameraSubject",FindFirstChildOfClass(c,"Humanoid"))
  1429. end
  1430. return con and Disconnect(con)
  1431. end
  1432.  
  1433. sine=osclock()
  1434. local delta=sine-lastsine
  1435. deltaTime=min(delta*10,1)
  1436. lastsine=sine
  1437.  
  1438. if shiftlock then
  1439. if allowshiftlock then
  1440. mouseBehavior=enumMLC
  1441. mouseCameraMove=true
  1442. else
  1443. shiftlock=false
  1444. end
  1445. elseif firstperson then
  1446. mouseBehavior=enumMLC
  1447. mouseCameraMove=true
  1448. elseif IsMouseButtonPressed(uis,enumMB2) then
  1449. mouseBehavior=enumMLCP
  1450. mouseCameraMove=true
  1451. else
  1452. mouseBehavior=enumMD
  1453. mouseCameraMove=false
  1454. end
  1455. if lastMouseBehavior~=mouseBehavior then
  1456. lastMouseBehavior=mouseBehavior
  1457. insSet(uis,"MouseBehavior",mouseBehavior)
  1458. end
  1459.  
  1460. local raycastresult=Raycast(ws,pos,v3_010*(fpdh-v3Get(pos,"Y")),raycastparams)
  1461. local onground=nil
  1462. if raycastresult then
  1463. raycastresult=v3Get(raycastresult.Position,"Y")
  1464. onground=v3Get(pos,"Y")-raycastresult<3.01
  1465. if onground then
  1466. Yvel=0
  1467. pos=pos+v3_010*(raycastresult+3-v3Get(pos,"Y"))*min(delta*20,1)
  1468. if jumpingInput and (jumpPower>0) then
  1469. Yvel=jumpPower
  1470. onground=false
  1471. end
  1472. else
  1473. Yvel=Yvel-gravity*delta
  1474. if v3Get(pos,"Y")+Yvel*delta<raycastresult then
  1475. Yvel=0
  1476. pos=pos+v3_010*(raycastresult+3-v3Get(pos,"Y"))
  1477. end
  1478. end
  1479. else
  1480. Yvel=0
  1481. onground=false
  1482. end
  1483.  
  1484. if firstperson then
  1485. if isWalking then
  1486. if walkSpeed==0 then
  1487. xzvel=v3_0
  1488. if onground then
  1489. cfr=cfl(pos,pos+camcfLV*v3_101)
  1490. camcf=cfAdd(camrot,pos+v3_0150)
  1491. cframes[rootpart]=cfr
  1492. insSet(cam,"CFrame",camcf)
  1493. lerpsIdle()
  1494. noYvelTime=min(noYvelTime+delta*0.3,1)
  1495. xzvel=xzvel*(1-noYvelTime)
  1496. elseif Yvel>0 then
  1497. pos=pos+v3_010*Yvel*delta
  1498. cfr=cfl(pos,pos+camcfLV*v3_101)
  1499. camcf=cfAdd(camrot,pos+v3_0150)
  1500. cframes[rootpart]=cfr
  1501. insSet(cam,"CFrame",camcf)
  1502. lerpsJump()
  1503. noYvelTime=0
  1504. else
  1505. pos=pos+v3_010*Yvel*delta
  1506. cfr=cfl(pos,pos+camcfLV*v3_101)
  1507. camcf=cfAdd(camrot,pos+v3_0150)
  1508. cframes[rootpart]=cfr
  1509. insSet(cam,"CFrame",camcf)
  1510. lerpsFall()
  1511. noYvelTime=0
  1512. end
  1513. else
  1514. xzvel=v3Get(v3Get(camcfLV*v3_101,"Unit")*FWmovement+v3Get(camcfRV*v3_101,"Unit")*RTmovement,"Unit")*walkSpeed
  1515. if onground then
  1516. pos=pos+xzvel*delta
  1517. cfr=cfl(pos,pos+camcfLV*v3_101)
  1518. camcf=cfAdd(camrot,pos+v3_0150)
  1519. cframes[rootpart]=cfr
  1520. insSet(cam,"CFrame",camcf)
  1521. lerpsWalk()
  1522. noYvelTime=min(noYvelTime+delta*0.3,1)
  1523. xzvel=xzvel*(1-noYvelTime)
  1524. elseif Yvel>0 then
  1525. pos=pos+(xzvel+v3_010*Yvel)*delta
  1526. cfr=cfl(pos,pos+camcfLV*v3_101)
  1527. camcf=cfAdd(camrot,pos+v3_0150)
  1528. cframes[rootpart]=cfr
  1529. insSet(cam,"CFrame",camcf)
  1530. lerpsJump()
  1531. noYvelTime=0
  1532. else
  1533. pos=pos+(xzvel+v3_010*Yvel)*delta
  1534. cfr=cfl(pos,pos+camcfLV*v3_101)
  1535. camcf=cfAdd(camrot,pos+v3_0150)
  1536. cframes[rootpart]=cfr
  1537. insSet(cam,"CFrame",camcf)
  1538. lerpsFall()
  1539. noYvelTime=0
  1540. end
  1541. end
  1542. else
  1543. xzvel=v3_0
  1544. if onground then
  1545. cfr=cfl(pos,pos+camcfLV*v3_101)
  1546. camcf=cfAdd(camrot,pos+v3_0150)
  1547. cframes[rootpart]=cfr
  1548. insSet(cam,"CFrame",camcf)
  1549. lerpsIdle()
  1550. noYvelTime=min(noYvelTime+delta*0.3,1)
  1551. xzvel=xzvel*(1-noYvelTime)
  1552. elseif Yvel>0 then
  1553. pos=pos+v3_010*Yvel*delta
  1554. cfr=cfl(pos,pos+camcfLV*v3_101)
  1555. camcf=cfAdd(camrot,pos+v3_0150)
  1556. cframes[rootpart]=cfr
  1557. insSet(cam,"CFrame",camcf)
  1558. lerpsJump()
  1559. noYvelTime=0
  1560. else
  1561. pos=pos+v3_010*Yvel*delta
  1562. cfr=cfl(pos,pos+camcfLV*v3_101)
  1563. camcf=cfAdd(camrot,pos+v3_0150)
  1564. cframes[rootpart]=cfr
  1565. insSet(cam,"CFrame",camcf)
  1566. lerpsFall()
  1567. noYvelTime=0
  1568. end
  1569. end
  1570. elseif shiftlock then
  1571. if isWalking then
  1572. if walkSpeed==0 then
  1573. xzvel=v3_0
  1574. if onground then
  1575. cfr=cfl(pos,pos+camcfLV*v3_101)
  1576. camcf=cfAdd(camrot,pos+v3_0150+camcfRV*1.75+camcfLV*cammag)
  1577. cframes[rootpart]=cfr
  1578. insSet(cam,"CFrame",camcf)
  1579. lerpsIdle()
  1580. noYvelTime=min(noYvelTime+delta*0.3,1)
  1581. xzvel=xzvel*(1-noYvelTime)
  1582. elseif Yvel>0 then
  1583. pos=pos+v3_010*Yvel*delta
  1584. cfr=cfl(pos,pos+camcfLV*v3_101)
  1585. camcf=cfAdd(camrot,pos+v3_0150+camcfRV*1.75+camcfLV*cammag)
  1586. cframes[rootpart]=cfr
  1587. insSet(cam,"CFrame",camcf)
  1588. lerpsJump()
  1589. noYvelTime=0
  1590. else
  1591. pos=pos+v3_010*Yvel*delta
  1592. cfr=cfl(pos,pos+camcfLV*v3_101)
  1593. camcf=cfAdd(camrot,pos+v3_0150+camcfRV*1.75+camcfLV*cammag)
  1594. cframes[rootpart]=cfr
  1595. insSet(cam,"CFrame",camcf)
  1596. lerpsFall()
  1597. noYvelTime=0
  1598. end
  1599. else
  1600. xzvel=v3Get(v3Get(camcfLV*v3_101,"Unit")*FWmovement+v3Get(camcfRV*v3_101,"Unit")*RTmovement,"Unit")*walkSpeed
  1601. if onground then
  1602. pos=pos+xzvel*delta
  1603. cfr=cfl(pos,pos+camcfLV*v3_101)
  1604. camcf=cfAdd(camrot,pos+v3_0150+camcfRV*1.75+camcfLV*cammag)
  1605. cframes[rootpart]=cfr
  1606. insSet(cam,"CFrame",camcf)
  1607. lerpsWalk()
  1608. noYvelTime=min(noYvelTime+delta*0.3,1)
  1609. xzvel=xzvel*(1-noYvelTime)
  1610. elseif Yvel>0 then
  1611. pos=pos+(xzvel+v3_010*Yvel)*delta
  1612. cfr=cfl(pos,pos+camcfLV*v3_101)
  1613. camcf=cfAdd(camrot,pos+v3_0150+camcfRV*1.75+camcfLV*cammag)
  1614. cframes[rootpart]=cfr
  1615. insSet(cam,"CFrame",camcf)
  1616. lerpsJump()
  1617. noYvelTime=0
  1618. else
  1619. pos=pos+(xzvel+v3_010*Yvel)*delta
  1620. cfr=cfl(pos,pos+camcfLV*v3_101)
  1621. camcf=cfAdd(camrot,pos+v3_0150+camcfRV*1.75+camcfLV*cammag)
  1622. cframes[rootpart]=cfr
  1623. insSet(cam,"CFrame",camcf)
  1624. lerpsFall()
  1625. noYvelTime=0
  1626. end
  1627. end
  1628. else
  1629. xzvel=v3_0
  1630. if onground then
  1631. cfr=cfl(pos,pos+camcfLV*v3_101)
  1632. camcf=cfAdd(camrot,pos+v3_0150+camcfRV*1.75+camcfLV*cammag)
  1633. cframes[rootpart]=cfr
  1634. insSet(cam,"CFrame",camcf)
  1635. lerpsIdle()
  1636. noYvelTime=min(noYvelTime+delta*0.3,1)
  1637. xzvel=xzvel*(1-noYvelTime)
  1638. elseif Yvel>0 then
  1639. pos=pos+v3_010*Yvel*delta
  1640. cfr=cfl(pos,pos+camcfLV*v3_101)
  1641. camcf=cfAdd(camrot,pos+v3_0150+camcfRV*1.75+camcfLV*cammag)
  1642. cframes[rootpart]=cfr
  1643. insSet(cam,"CFrame",camcf)
  1644. lerpsJump()
  1645. noYvelTime=0
  1646. else
  1647. pos=pos+v3_010*Yvel*delta
  1648. cfr=cfl(pos,pos+camcfLV*v3_101)
  1649. camcf=cfAdd(camrot,pos+v3_0150+camcfRV*1.75+camcfLV*cammag)
  1650. cframes[rootpart]=cfr
  1651. insSet(cam,"CFrame",camcf)
  1652. lerpsFall()
  1653. noYvelTime=0
  1654. end
  1655. end
  1656. else
  1657. if isWalking then
  1658. if walkSpeed==0 then
  1659. xzvel=v3_0
  1660. if onground then
  1661. cfr=cfAdd(cfGet(cfr,"Rotation"),pos)
  1662. camcf=cfAdd(camrot,pos+v3_0150+camcfLV*cammag)
  1663. cframes[rootpart]=cfr
  1664. insSet(cam,"CFrame",camcf)
  1665. lerpsIdle()
  1666. noYvelTime=min(noYvelTime+delta*0.3,1)
  1667. xzvel=xzvel*(1-noYvelTime)
  1668. elseif Yvel>0 then
  1669. pos=pos+v3_010*Yvel*delta
  1670. cfr=cfAdd(cfGet(cfr,"Rotation"),pos)
  1671. camcf=cfAdd(camrot,pos+v3_0150+camcfLV*cammag)
  1672. cframes[rootpart]=cfr
  1673. insSet(cam,"CFrame",camcf)
  1674. lerpsJump()
  1675. noYvelTime=0
  1676. else
  1677. pos=pos+v3_010*Yvel*delta
  1678. cfr=cfAdd(cfGet(cfr,"Rotation"),pos)
  1679. camcf=cfAdd(camrot,pos+v3_0150+camcfLV*cammag)
  1680. cframes[rootpart]=cfr
  1681. insSet(cam,"CFrame",camcf)
  1682. lerpsFall()
  1683. noYvelTime=0
  1684. end
  1685. else
  1686. xzvel=v3Get(v3Get(camcfLV*v3_101,"Unit")*FWmovement+v3Get(camcfRV*v3_101,"Unit")*RTmovement,"Unit")*walkSpeed
  1687. if onground then
  1688. pos=pos+xzvel*delta
  1689. cfr=cfAdd(Lerp(cfGet(cfr,"Rotation"),cfl(v3_0,xzvel),deltaTime),pos)
  1690. camcf=cfAdd(camrot,pos+v3_0150+camcfLV*cammag)
  1691. cframes[rootpart]=cfr
  1692. insSet(cam,"CFrame",camcf)
  1693. lerpsWalk()
  1694. noYvelTime=min(noYvelTime+delta*0.3,1)
  1695. xzvel=xzvel*(1-noYvelTime)
  1696. elseif Yvel>0 then
  1697. pos=pos+(xzvel+(v3_010*Yvel))*delta
  1698. cfr=cfAdd(Lerp(cfGet(cfr,"Rotation"),cfl(v3_0,xzvel),deltaTime),pos)
  1699. camcf=cfAdd(camrot,pos+v3_0150+camcfLV*cammag)
  1700. cframes[rootpart]=cfr
  1701. insSet(cam,"CFrame",camcf)
  1702. lerpsJump()
  1703. noYvelTime=0
  1704. else
  1705. pos=pos+(xzvel+(v3_010*Yvel))*delta
  1706. cfr=cfAdd(Lerp(cfGet(cfr,"Rotation"),cfl(v3_0,xzvel),deltaTime),pos)
  1707. camcf=cfAdd(camrot,pos+v3_0150+camcfLV*cammag)
  1708. cframes[rootpart]=cfr
  1709. insSet(cam,"CFrame",camcf)
  1710. lerpsFall()
  1711. noYvelTime=0
  1712. end
  1713. end
  1714. else
  1715. xzvel=v3_0
  1716. if onground then
  1717. cfr=cfAdd(cfGet(cfr,"Rotation"),pos)
  1718. camcf=cfAdd(camrot,pos+v3_0150+camcfLV*cammag)
  1719. cframes[rootpart]=cfr
  1720. insSet(cam,"CFrame",camcf)
  1721. lerpsIdle()
  1722. noYvelTime=min(noYvelTime+delta*0.3,1)
  1723. xzvel=xzvel*(1-noYvelTime)
  1724. elseif Yvel>0 then
  1725. pos=pos+v3_010*Yvel*delta
  1726. cfr=cfAdd(cfGet(cfr,"Rotation"),pos)
  1727. camcf=cfAdd(camrot,pos+v3_0150+camcfLV*cammag)
  1728. cframes[rootpart]=cfr
  1729. insSet(cam,"CFrame",camcf)
  1730. lerpsJump()
  1731. noYvelTime=0
  1732. else
  1733. pos=pos+v3_010*Yvel*delta
  1734. cfr=cfAdd(cfGet(cfr,"Rotation"),pos)
  1735. camcf=cfAdd(camrot,pos+v3_0150+camcfLV*cammag)
  1736. cframes[rootpart]=cfr
  1737. insSet(cam,"CFrame",camcf)
  1738. lerpsFall()
  1739. noYvelTime=0
  1740. end
  1741. end
  1742. end
  1743.  
  1744. refreshjointsI(rootpart)
  1745. tclear(refreshedjoints)
  1746.  
  1747. local idlerv=v3(sin((sine-0.0375)*16),sin(sine*16),sin((sine+0.075)*16))
  1748. local idleoff=idlerv*0.0015
  1749.  
  1750. local claimpos=insGet(primarypart,"Position")
  1751. local claimposY=v3Get(claimpos,"Y")
  1752. for i,v in next,cframes do
  1753. local part=i.p
  1754.  
  1755. if part then
  1756. if insGet(part,"ReceiveAge")==0 then
  1757. local placeholder=i.v
  1758. if novoid and (cfGet(v,"Y")<novoid) then
  1759. v=cfAdd(v,v3_010*(novoid-cfGet(v,"Y")))
  1760. end
  1761. local lastpos=i.l
  1762. local vel=(cfGet(v,"Position")-lastpos)/delta
  1763. local mag=v3Get(vel,"Magnitude")
  1764. if mag<0.15 then
  1765. if placeholder then
  1766. insSet(placeholder,"Parent",nil)
  1767. end
  1768. i.l=cfGet(v,"Position")
  1769. v=cfAdd(v,idleoff)
  1770. elseif mag>speedlimit then
  1771. if placeholder then
  1772. insSet(placeholder,"CFrame",v)
  1773. insSet(placeholder,"Parent",ws)
  1774. end
  1775. vel=v3Get(vel,"Unit")*speedlimit
  1776. local newpos=lastpos+vel*delta
  1777. v=cfAdd(cfGet(v,"Rotation"),newpos)
  1778. i.l=newpos
  1779. elseif placeholder then
  1780. insSet(placeholder,"Parent",nil)
  1781. i.l=cfGet(v,"Position")
  1782. end
  1783. local claimtime=i.c
  1784. if claimtime then
  1785. if sine-claimtime<retVelTime then
  1786. local Ydiff=cfGet(v,"Y")-claimposY
  1787. local velY=25.01
  1788. local fallingTime=0
  1789. while (Ydiff>0) or (velY>0) do
  1790. fallingTime=fallingTime+0.025
  1791. if fallingTime>0.6 then
  1792. break
  1793. end
  1794. velY=velY-velYdelta
  1795. Ydiff=Ydiff+(velY*0.025)
  1796. end
  1797. insSet(part,"AssemblyLinearVelocity",(claimpos-cfGet(v,"Position"))*v3_101/fallingTime+v3_net)
  1798. else
  1799. insSet(part,"AssemblyLinearVelocity",getNetlessVelocity(vel*noYvelTime+xzvel))
  1800. end
  1801. else
  1802. i.c=sine
  1803. insSet(part,"AssemblyLinearVelocity",getNetlessVelocity(vel*noYvelTime+xzvel))
  1804. end
  1805. insSet(part,"CFrame",v)
  1806. insSet(part,"AssemblyAngularVelocity",idlerv)
  1807. else
  1808. i.c=nil
  1809. i.l=insGet(part,"Position")
  1810. local placeholder=i.v
  1811. if placeholder then
  1812. insSet(placeholder,"CFrame",v)
  1813. insSet(placeholder,"Parent",ws)
  1814. end
  1815. end
  1816. else
  1817. local placeholder=i.v
  1818. if placeholder then
  1819. insSet(placeholder,"CFrame",v)
  1820. insSet(placeholder,"Parent",ws)
  1821. end
  1822. end
  1823. end
  1824. setsimrad()
  1825. end
  1826.  
  1827. sine=osclock()
  1828. lastsine=sine
  1829. con=Connect(heartbeat,mainFunction)
  1830. mainFunction()
  1831.  
  1832. local function refreshjoints(v) --use this on the main part if u have parts that
  1833. refreshjointsI(v) --are connected with each other but arent connected to rootpart
  1834. tclear(refreshedjoints)
  1835. end
  1836.  
  1837. local legcfR=cf(1,-1,0)
  1838. local legcfL=cf(-1,-1,0)
  1839. local raydir=v3_010*-2
  1840. local function raycastlegs() --this returns 2 values: right leg raycast offset, left leg raycast offset
  1841. local rY=Raycast(ws,cfGet(cfMul(cfr,legcfR),"Position"),raydir,raycastparams)
  1842. local lY=Raycast(ws,cfGet(cfMul(cfr,legcfL),"Position"),raydir,raycastparams)
  1843. return rY and (v3Get(rY.Position,"Y")-(v3Get(pos,"Y")-3)) or 0,lY and (v3Get(lY.Position,"Y")-(v3Get(pos,"Y")-3)) or 0
  1844. end
  1845.  
  1846. local function velbycfrvec() --this returns 2 values: forward/backwards movement (from -1 to 1), right/left movement (from -1 to 1)
  1847. local fw=cfGet(cfr,"LookVector")*xzvel/walkSpeed
  1848. local rt=cfGet(cfr,"RightVector")*xzvel/walkSpeed
  1849. return v3Get(fw,"X")+v3Get(fw,"Z"),v3Get(rt,"X")+v3Get(rt,"Z")
  1850. end
  1851.  
  1852. local lastvel=v3_0
  1853. local velchg1=v3_0
  1854. local function velchgbycfrvec() --this returns 2 values: forward/backwards velocity change, right/left velocity change
  1855. velchg1=velchg1+(lastvel-xzvel) --i recommend setting velchg1 to v3_0 when u start using this function or it will look worse
  1856. lastvel=xzvel
  1857. velchg1=velchg1-velchg1*(deltaTime/2)
  1858. local fw=cfGet(cfr,"LookVector")*velchg1/32
  1859. local rt=cfGet(cfr,"RightVector")*velchg1/32
  1860. return v3Get(fw,"X")+v3Get(fw,"Z"),v3Get(rt,"X")+v3Get(rt,"Z")
  1861. end
  1862.  
  1863. local lastYvel=0
  1864. local velYchg1=0
  1865. local function velYchg() --this returns Y axis velocity change
  1866. velYchg1=clamp(velYchg1+(lastYvel-Yvel),-50,50) --i recommend setting velYchg1 to 0 when u start using this function or it will look worse
  1867. lastYvel=Yvel
  1868. velYchg1=velYchg1-velYchg1*(deltaTime/2)
  1869. return velYchg1
  1870. end
  1871.  
  1872. local function rotToMouse(alpha) --this rotates ur character towards your mouse hit position
  1873. cfr=Lerp(cfr,cfl(pos,pos*v3_010+cfGet(insGet(mouse,"Hit"),"Position")*v3_101),alpha or deltaTime)
  1874. end
  1875.  
  1876. local function glitchJoint(joint,targetGlitchTime,delayFrom,delayTo,radiansFrom,radiansTo)
  1877. if sine>targetGlitchTime then --local glitchtime=0 addMode("x",{idle=function() glitchtime=glitchJoint(joint,glitchtime,0.2,0.4,-0.1,0.1) end})
  1878. radiansFrom=radiansFrom*100
  1879. radiansTo=radiansTo*100
  1880. joint.C0=cfMul(joint.C0,angles(mrandom(radiansFrom,radiansTo)/100,mrandom(radiansFrom,radiansTo)/100,mrandom(radiansFrom,radiansTo)/100))
  1881. return sine+mrandom(delayFrom*100,delayTo*100)/100
  1882. end
  1883. return targetGlitchTime
  1884. end
  1885.  
  1886. local function setWalkSpeed(n)
  1887. if type(n)~="number" then
  1888. n=16
  1889. end
  1890. walkSpeed=n
  1891. end
  1892. local function setJumpPower(n)
  1893. if type(n)~="number" then
  1894. n=50
  1895. end
  1896. jumpPower=n
  1897. end
  1898. local function setGravity(n)
  1899. if type(n)~="number" then
  1900. n=196.2
  1901. end
  1902. gravity=n
  1903. end
  1904. local function setCfr(v) --sets character cframe
  1905. if typeof(v)=="CFrame" then
  1906. local newpos=cfGet(v,"Position")
  1907. camcf=cfAdd(camcf,newpos-pos)
  1908. insSet(cam,"CFrame",camcf)
  1909. cfr=v
  1910. pos=newpos
  1911. elseif typeof(v)=="Vector3" then
  1912. camcf=cfAdd(camcf,v-pos)
  1913. insSet(cam,"CFrame",camcf)
  1914. cfr=cfAdd(cfGet(cfr,"Rotation"),v)
  1915. pos=v
  1916. end
  1917. end
  1918. local function getVel() --returns character velocity
  1919. return xzvel+v3_010*Yvel --important: use only in lerps or it might not work
  1920. end
  1921. local function getCamCF() --returns camera cframe
  1922. return camcf
  1923. end
  1924. local function isFirstPerson() --returns true if user is in first person camera mode
  1925. return firstperson
  1926. end
  1927.  
  1928. return {
  1929. cframes=cframes,
  1930. joints=joints,
  1931. fling=predictionfling,
  1932. predictionfling=predictionfling,
  1933. refreshjoints=refreshjoints,
  1934. raycastlegs=raycastlegs,
  1935. velbycfrvec=velbycfrvec,
  1936. velchgbycfrvec=velchgbycfrvec,
  1937. velYchg=velYchg,
  1938. addmode=addmode,
  1939. getPart=getPart,
  1940. getPartFromMesh=getPartFromMesh,
  1941. getAccWeldFromMesh=getAccWeldFromMesh,
  1942. getJoint=getJoint,
  1943. getPartJoint=getPartJoint,
  1944. rotToMouse=rotToMouse,
  1945. glitchJoint=glitchJoint,
  1946. setWalkSpeed=setWalkSpeed,
  1947. setJumpPower=setJumpPower,
  1948. setGravity=setGravity,
  1949. setCfr=setCfr,
  1950. getVel=getVel,
  1951. getCamCF=getCamCF,
  1952. isFirstPerson=isFirstPerson
  1953. }
  1954. end
  1955.  
  1956. btn("blackben reanims", function()
  1957. local t=reanimate()
  1958. if type(t)~="table" then return end
  1959. local raycastlegs=t.raycastlegs
  1960. local velbycfrvec=t.velbycfrvec
  1961. local addmode=t.addmode
  1962. local getJoint=t.getJoint
  1963. local getPartFromMesh=t.getPartFromMesh
  1964. local getPartJoint=t.getPartJoint
  1965. local velYchg=t.velYchg
  1966. local setWalkSpeed=t.setWalkSpeed
  1967. local RootJoint=getJoint("RootJoint")
  1968. local RightShoulder=getJoint("Right Shoulder")
  1969. local LeftShoulder=getJoint("Left Shoulder")
  1970. local RightHip=getJoint("Right Hip")
  1971. local LeftHip=getJoint("Left Hip")
  1972. local Neck=getJoint("Neck")
  1973. local broomstick = getPartFromMesh(15172160708,15172162617)
  1974. local BroomWeld = getPartJoint(broomstick)
  1975. local mangatext = getPartFromMesh(14940544757,14940544841)
  1976. local MangaWeld = getPartJoint(mangatext)
  1977.  
  1978.  
  1979. addmode("default", {
  1980. idle = function()
  1981. local rY, lY = raycastlegs()
  1982.  
  1983. local Ychg=velYchg()/20
  1984.  
  1985.  
  1986. LeftShoulder.C0=Lerp(LeftShoulder.C0,cfMul(cf(-1,0.4+0.1*sin(sine*1),0),angles(0,-0.8726646259971648,0)),deltaTime)
  1987. LeftHip.C0=Lerp(LeftHip.C0,cfMul(cf(-1,-1,0),angles(0,-1.5707963267948966,0)),deltaTime)
  1988. RootJoint.C0=Lerp(RootJoint.C0,cfMul(cf(0,0.2+0.2*sin(sine*1),0),angles(-1.5707963267948966,0,3.141592653589793)),deltaTime)
  1989. Neck.C0=Lerp(Neck.C0,cfMul(cf(0,1,0),angles(-1.5707963267948966,0,3.141592653589793)),deltaTime)
  1990. RightHip.C0=Lerp(RightHip.C0,cfMul(cf(1,-1,0),angles(0,1.5707963267948966,0)),deltaTime)
  1991. RightShoulder.C0=Lerp(RightShoulder.C0,cfMul(cf(1,0.4+0.1*sin(sine*1),0),angles(0,0.8726646259971648,0)),deltaTime)
  1992. --MW_animatorProgressSave: LeftArm,-1,0,0,1,0,0,0,1,0.4,0.1,0,1,-50,0,0,1,0,0,0,1,0,0,0,1,LeftLeg,-1,0,0,1,0,0,0,1,-1,0,0,1,-90,0,0,1,0,0,0,1,0,0,0,1,MeshPartAccessory_Handle,-0.018169164657592773,0,0,1,0,0,0,1,-0.1885223388671875,0,0,1,0,0,0,1,0.07818222045898438,0,0,1,0,0,0,1,InternationalFedora_Handle,0.010937333106994629,0,0,1,0,0,0,1,-0.20406198501586914,0,0,1,0,0,0,1,0.11724090576171875,0,0,1,0,0,0,1,InternationalFedora_Handle,0.010937333106994629,0,0,1,0,0,0,1,-0.20406198501586914,0,0,1,0,0,0,1,0.11724090576171875,0,0,1,0,0,0,1,InternationalFedora_Handle,0.010937333106994629,0,0,1,0,0,0,1,-0.20406198501586914,0,0,1,0,0,0,1,0.11724090576171875,0,0,1,0,0,0,1,MeshPartAccessory_Handle,0.020455121994018555,0,0,1,-4,0,0,1,-0.1462111473083496,0,0,1,0,0,0,1,0.02418994903564453,0,0,1,0,0,0,1,Torso,0,0,0,1,-90,0,0,1,0.2,0.2,0,1,0,0,0,1,0,0,0,1,180,0,0,1,Head,0,0,0,1,-90,0,0,1,1,0,0,1,0,0,0,1,0,0,0,1,180,0,0,1,InternationalFedora_Handle,0.010937333106994629,0,0,1,0,0,0,1,-0.20406198501586914,0,0,1,0,0,0,1,0.11724090576171875,0,0,1,0,0,0,1,RightLeg,1,0,0,1,0,0,0,1,-1,0,0,1,90,0,0,1,0,0,0,1,0,0,0,1,InternationalFedora_Handle,0.03254556655883789,0,0,1,0,0,0,1,-0.22381305694580078,0,0,1,0,0,0,1,0.0061435699462890625,0,0,1,0,0,0,1,InternationalFedora_Handle,0.010937333106994629,0,0,1,0,0,0,1,-0.20406198501586914,0,0,1,0,0,0,1,0.11724090576171875,0,0,1,0,0,0,1,RightArm,1,0,0,1,0,0,0,1,0.4,0.1,0,1,50,0,0,1,0,0,0,1,0,0,0,1,MeshPartAccessory_Handle,-0.026152610778808594,0,0,1,0,0,0,1,0.006590843200683594,0,0,1,0,0,0,1,-0.015709877014160156,0,0,1,0,0,0,1
  1993.  
  1994.  
  1995. end,
  1996. walk = function()
  1997. local Vfw, Vrt = velbycfrvec()
  1998.  
  1999. local rY, lY = raycastlegs()
  2000.  
  2001. local Ychg=velYchg()/20
  2002.  
  2003.  
  2004. LeftShoulder.C0=Lerp(LeftShoulder.C0,cfMul(cf(-1,0.4+0.1*sin(sine*1),-0.3),angles(-0.03490658503988659+0.8726646259971648*sin(sine*4),-0.8726646259971648,0)),deltaTime)
  2005. LeftHip.C0=Lerp(LeftHip.C0,cfMul(cf(-1,-1,0.01+0.01*sin(sine*2)),angles(0.08726646259971647,-1.5707963267948966,0.8726646259971648*sin(sine*4))),deltaTime)
  2006. RootJoint.C0=Lerp(RootJoint.C0,angles(-1.6929693744344996,0,3.141592653589793),deltaTime)
  2007. Neck.C0=Lerp(Neck.C0,cfMul(cf(0,1,0),angles(-1.5707963267948966,0,3.141592653589793)),deltaTime)
  2008. RightHip.C0=Lerp(RightHip.C0,cfMul(cf(1,-1,-0.01-0.01*sin(sine*2)),angles(0.08726646259971647,1.5707963267948966,0.8726646259971648*sin(sine*4))),deltaTime)
  2009. RightShoulder.C0=Lerp(RightShoulder.C0,cfMul(cf(1,0.4+0.1*sin(sine*1),-0.3),angles(0.03490658503988659-0.8726646259971648*sin(sine*4),0.8726646259971648,0)),deltaTime)
  2010. --MW_animatorProgressSave: LeftArm,-1,0,2,2,-2,50,0,4,0.4,0.1,0,1,-50,0,0,1,-0.3,0,0,2,,0,0,4,LeftLeg,-1,,0,2,5,,0,4,-1,0,0,2,-90,0,0,3,.01,.01,0,2,0,50,0,4,MeshPartAccessory_Handle,-0.018169164657592773,0,0,1,0,0,0,1,-0.1885223388671875,0,0,1,0,0,0,1,0.07818222045898438,0,0,1,0,0,0,1,InternationalFedora_Handle,0.010937333106994629,0,0,1,0,0,0,1,-0.20406198501586914,0,0,1,0,0,0,1,0.11724090576171875,0,0,1,0,0,0,1,InternationalFedora_Handle,0.010937333106994629,0,0,1,0,0,0,1,-0.20406198501586914,0,0,1,0,0,0,1,0.11724090576171875,0,0,1,0,0,0,1,InternationalFedora_Handle,0.010937333106994629,0,0,1,0,0,0,1,-0.20406198501586914,0,0,1,0,0,0,1,0.11724090576171875,0,0,1,0,0,0,1,MeshPartAccessory_Handle,0.020455121994018555,0,0,1,-4,0,0,1,-0.1462111473083496,0,0,1,0,0,0,1,0.02418994903564453,0,0,1,0,0,0,1,Torso,0,0,0,1,-97,0,0,1,,,0,1,0,0,0,1,0,0,0,1,180,0,0,1,Head,0,0,0,1,-90,0,0,1,1,0,0,1,0,0,0,1,0,0,0,1,180,0,0,1,InternationalFedora_Handle,0.010937333106994629,0,0,1,0,0,0,1,-0.20406198501586914,0,0,1,0,0,0,1,0.11724090576171875,0,0,1,0,0,0,1,RightLeg,1,0,0,1,5,0,0,4,-1,0,0,2,90,0,0,0,-0.01,-0.01,0,2,0,50,0,4,InternationalFedora_Handle,0.03254556655883789,0,0,1,0,0,0,1,-0.22381305694580078,0,0,1,0,0,0,1,0.0061435699462890625,0,0,1,0,0,0,1,InternationalFedora_Handle,0.010937333106994629,0,0,1,0,0,0,1,-0.20406198501586914,0,0,1,0,0,0,1,0.11724090576171875,0,0,1,0,0,0,1,RightArm,1,0,0,2,2,-50,0,4,0.4,0.1,0,1,50,0,0,1,-0.3,0,0,2,0,0,0,4,MeshPartAccessory_Handle,-0.026152610778808594,0,0,1,0,0,0,1,0.006590843200683594,0,0,1,0,0,0,1,-0.015709877014160156,0,0,1,0,0,0,1
  2011. end,
  2012. jump = function()
  2013. velYchg()
  2014. local Vfw, Vrt = velbycfrvec()
  2015.  
  2016. LeftShoulder.C0=Lerp(LeftShoulder.C0,cfMul(cf(-1,0,0),angles(-0.8726646259971648,-1.5707963267948966,0)),deltaTime)
  2017. LeftHip.C0=Lerp(LeftHip.C0,cfMul(cf(-1,-1,0),angles(0,-1.5707963267948966,0)),deltaTime)
  2018. RootJoint.C0=Lerp(RootJoint.C0,angles(-2.007128639793479,0,3.141592653589793),deltaTime)
  2019. RightHip.C0=Lerp(RightHip.C0,cfMul(cf(1,-1,0),angles(0,1.5707963267948966,-0.8726646259971648)),deltaTime)
  2020. Neck.C0=Lerp(Neck.C0,cfMul(cf(0,1,0),angles(-0.8726646259971648,0,3.141592653589793)),deltaTime)
  2021. RightShoulder.C0=Lerp(RightShoulder.C0,cfMul(cf(1,0,0),angles(-0.8726646259971648,1.5707963267948966,0)),deltaTime)
  2022. --MW_animatorProgressSave: LeftArm,-1,0,0,1,-50,0,0,1,0,0,0,1,-90,0,0,1,0,0,0,1,0,0,0,1,MeshPartAccessory_Handle,0.020455121994018555,0,0,1,-4,0,0,1,-0.1462111473083496,0,0,1,0,0,0,1,0.02418994903564453,0,0,1,0,0,0,1,InternationalFedora_Handle,0.03254556655883789,0,0,1,0,0,0,1,-0.22381305694580078,0,0,1,0,0,0,1,0.0061435699462890625,0,0,1,0,0,0,1,InternationalFedora_Handle,0.010937333106994629,0,0,1,0,0,0,1,-0.20406198501586914,0,0,1,0,0,0,1,0.11724090576171875,0,0,1,0,0,0,1,LeftLeg,-1,0,0,1,0,0,0,1,-1,0,0,1,-90,0,0,1,0,0,0,1,0,0,0,1,Torso,0,0,0,1,-115,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,180,0,0,1,InternationalFedora_Handle,0.010937333106994629,0,0,1,0,0,0,1,-0.20406198501586914,0,0,1,0,0,0,1,0.11724090576171875,0,0,1,0,0,0,1,MeshPartAccessory_Handle,-0.018169164657592773,0,0,1,0,0,0,1,-0.1885223388671875,0,0,1,0,0,0,1,0.07818222045898438,0,0,1,0,0,0,1,InternationalFedora_Handle,0.010937333106994629,0,0,1,0,0,0,1,-0.20406198501586914,0,0,1,0,0,0,1,0.11724090576171875,0,0,1,0,0,0,1,MeshPartAccessory_Handle,-0.026152610778808594,0,0,1,0,0,0,1,0.006590843200683594,0,0,1,0,0,0,1,-0.015709877014160156,0,0,1,0,0,0,1,InternationalFedora_Handle,0.010937333106994629,0,0,1,0,0,0,1,-0.20406198501586914,0,0,1,0,0,0,1,0.11724090576171875,0,0,1,0,0,0,1,RightLeg,1,0,0,1,,0,0,1,-1,0,0,1,90,0,0,1,,0,0,1,-50,0,0,1,InternationalFedora_Handle,0.010937333106994629,0,0,1,0,0,0,1,-0.20406198501586914,0,0,1,0,0,0,1,0.11724090576171875,0,0,1,0,0,0,1,Head,0,0,0,1,-50,0,0,1,1,0,0,1,,0,0,1,0,0,0,1,180,0,0,1,RightArm,1,0,0,1,-50,,0,1,0,0,0,1,90,0,0,1,0,0,0,1,,0,0,1
  2023. end,
  2024. fall = function()
  2025. velYchg()
  2026. local Vfw, Vrt = velbycfrvec()
  2027.  
  2028. Neck.C0=Lerp(Neck.C0,cfMul(cf(0,1,0),angles(-1.5707963267948966,0,3.141592653589793)),deltaTime)
  2029. RightShoulder.C0=Lerp(RightShoulder.C0,cfMul(cf(1,0.5,0),angles(1.3089969389957472,1.5707963267948966,0)),deltaTime)
  2030. RootJoint.C0=Lerp(RootJoint.C0,angles(-2.3736477827122884,0,3.141592653589793),deltaTime)
  2031. LeftHip.C0=Lerp(LeftHip.C0,cfMul(cf(-1,-1,0),angles(0,-1.5707963267948966,0)),deltaTime)
  2032. AccessoryWeld.C0=Lerp(AccessoryWeld.C0,cf(0.03254556655883789,-0.22381305694580078,0.0061435699462890625),deltaTime)
  2033. AccessoryWeld.C0=Lerp(AccessoryWeld.C0,cfMul(cf(0.020455121994018555,-0.1462111473083496,0.02418994903564453),angles(-0.06981317007977318,0,0)),deltaTime)
  2034. LeftShoulder.C0=Lerp(LeftShoulder.C0,cfMul(cf(-1,0.5,0),angles(1.3089969389957472,-1.5707963267948966,0)),deltaTime)
  2035. RightHip.C0=Lerp(RightHip.C0,cfMul(cf(1,-1,0),angles(-0.8726646259971648,1.5707963267948966,0)),deltaTime)
  2036. --MW_animatorProgressSave: InternationalFedora_Handle,0.010937333106994629,0,0,1,0,0,0,1,-0.20406198501586914,0,0,1,0,0,0,1,0.11724090576171875,0,0,1,0,0,0,1,MeshPartAccessory_Handle,-0.018169164657592773,0,0,1,0,0,0,1,-0.1885223388671875,0,0,1,0,0,0,1,0.07818222045898438,0,0,1,0,0,0,1,MeshPartAccessory_Handle,-0.026152610778808594,0,0,1,0,0,0,1,0.006590843200683594,0,0,1,0,0,0,1,-0.015709877014160156,0,0,1,0,0,0,1,Head,0,0,0,1,-90,0,0,1,1,0,0,1,0,0,0,1,0,0,0,1,180,0,0,1,RightArm,1,0,0,1,75,0,0,1,0.5,0,0,1,90,0,0,1,0,0,0,1,0,0,0,1,InternationalFedora_Handle,0.010937333106994629,0,0,1,0,0,0,1,-0.20406198501586914,0,0,1,0,0,0,1,0.11724090576171875,0,0,1,0,0,0,1,InternationalFedora_Handle,0.010937333106994629,0,0,1,0,0,0,1,-0.20406198501586914,0,0,1,0,0,0,1,0.11724090576171875,0,0,1,0,0,0,1,Torso,0,0,0,1,-136,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,180,0,0,1,LeftLeg,-1,0,0,1,0,0,0,1,-1,0,0,1,-90,0,0,1,0,0,0,1,0,0,0,1,InternationalFedora_Handle,0.03254556655883789,0,0,1,0,0,0,1,-0.22381305694580078,0,0,1,0,0,0,1,0.0061435699462890625,0,0,1,0,0,0,1,MeshPartAccessory_Handle,0.020455121994018555,0,0,1,-4,0,0,1,-0.1462111473083496,0,0,1,0,0,0,1,0.02418994903564453,0,0,1,0,0,0,1,InternationalFedora_Handle,0.010937333106994629,0,0,1,0,0,0,1,-0.20406198501586914,0,0,1,0,0,0,1,0.11724090576171875,0,0,1,0,0,0,1,InternationalFedora_Handle,0.010937333106994629,0,0,1,0,0,0,1,-0.20406198501586914,0,0,1,0,0,0,1,0.11724090576171875,0,0,1,0,0,0,1,LeftArm,-1,0,0,1,75,0,0,1,0.5,0,0,1,-90,0,0,1,0,0,0,1,0,0,0,1,RightLeg,1,0,0,1,-50,0,0,1,-1,0,0,1,90,0,0,1,0,0,0,1,0,0,0,1
  2037. end
  2038. })
  2039.  
  2040. addmode("q", {
  2041. idle = function()
  2042. velYchg()
  2043.  
  2044. RightShoulder.C0=Lerp(RightShoulder.C0,cfMul(cf(1,0.5,0),angles(0,0.8726646259971648,3.7524578917878086)),deltaTime)
  2045. RightHip.C0=Lerp(RightHip.C0,cfMul(cf(1,-1,0),angles(0,1.5707963267948966,-0.17453292519943295+0.8726646259971648*sin(sine*1))),deltaTime)
  2046. LeftShoulder.C0=Lerp(LeftShoulder.C0,cfMul(cf(-1,0.5,0),angles(0,-0.8726646259971648,-3.7524578917878086)),deltaTime)
  2047. LeftHip.C0=Lerp(LeftHip.C0,cfMul(cf(-1,-1,0),angles(0,-1.5707963267948966,-0.08726646259971647+0.4363323129985824*sin(sine*1))),deltaTime)
  2048. Neck.C0=Lerp(Neck.C0,cfMul(cf(0,1,0),angles(-1.5707963267948966,0,3.141592653589793)),deltaTime)
  2049. RootJoint.C0=Lerp(RootJoint.C0,cfMul(cf(0,5+0.5*sin(sine*1),0),angles(0.17453292519943295*sin(sine*1),0,3.141592653589793)),deltaTime)
  2050. --MW_animatorProgressSave: InternationalFedora_Handle,0.03254556655883789,0,0,1,0,0,0,1,-0.22381305694580078,0,0,1,0,0,0,1,0.0061435699462890625,0,0,1,0,0,0,1,MeshPartAccessory_Handle,0.020455121994018555,0,0,1,-4,0,0,1,-0.1462111473083496,0,0,1,0,0,0,1,0.02418994903564453,0,0,1,0,0,0,1,MeshPartAccessory_Handle,-0.018169164657592773,0,0,1,0,0,0,1,-0.1885223388671875,0,0,1,0,0,0,1,0.07818222045898438,0,0,1,0,0,0,1,InternationalFedora_Handle,0.010937333106994629,0,0,1,0,0,0,1,-0.20406198501586914,0,0,1,0,0,0,1,0.11724090576171875,0,0,1,0,0,0,1,MeshPartAccessory_Handle,-0.026152610778808594,0,0,1,0,0,0,1,0.006590843200683594,0,0,1,0,0,0,1,-0.015709877014160156,0,0,1,0,0,0,1,RightArm,1,0,0,1,0,0,0,1,0.5,0,0,1,50,0,0,1,0,0,0,1,215,0,0,1,RightLeg,1,0,0,1,0,0,0,1,-1,0,0,1,90,0,0,1,0,0,0,1,-10,50,0,1,LeftArm,-1,0,0,1,0,0,0,1,0.5,0,0,1,-50,0,0,1,0,0,0,1,-215,0,0,1,InternationalFedora_Handle,0.010937333106994629,0,0,1,0,0,0,1,-0.20406198501586914,0,0,1,0,0,0,1,0.11724090576171875,0,0,1,0,0,0,1,InternationalFedora_Handle,0.010937333106994629,0,0,1,0,0,0,1,-0.20406198501586914,0,0,1,0,0,0,1,0.11724090576171875,0,0,1,0,0,0,1,InternationalFedora_Handle,0.010937333106994629,0,0,1,0,0,0,1,-0.20406198501586914,0,0,1,0,0,0,1,0.11724090576171875,0,0,1,0,0,0,1,LeftLeg,-1,0,0,1,0,0,0,1,-1,0,0,1,-90,0,0,1,0,0,0,1,-5,25,0,1,Head,0,0,0,1,-90,0,0,1,1,0,0,1,0,0,0,1,0,0,0,1,180,0,0,1,Torso,0,0,0,1,0,10,0,1,5,0.5,0,1,,0,0,1,0,0,0,1,180,,0,1,InternationalFedora_Handle,0.010937333106994629,0,0,1,0,0,0,1,-0.20406198501586914,0,0,1,0,0,0,1,0.11724090576171875,0,0,1,0,0,0,1
  2051. end
  2052. })
  2053. addmode("e", {
  2054. idle = function()
  2055. velYchg()
  2056.  
  2057. RootJoint.C0=Lerp(RootJoint.C0,cfMul(cf(0.1+0.1*sin(sine*1),-2+0.1*sin(sine*0.1),0.1 * sin(sine*0.1)),angles(0,0,-1.3089969389957472)),deltaTime)
  2058. LeftHip.C0=Lerp(LeftHip.C0,cfMul(cf(-1,-1,0),angles(0,-1.5707963267948966,0)),deltaTime)
  2059. Neck.C0=Lerp(Neck.C0,cfMul(cf(0,1,0),angles(-1.5707963267948966,0,3.141592653589793)),deltaTime)
  2060. RightShoulder.C0=Lerp(RightShoulder.C0,cfMul(cf(1,0.5,-1),angles(0.8726646259971648,0,-0.8726646259971648)),deltaTime)
  2061. RightHip.C0=Lerp(RightHip.C0,cfMul(cf(0.8,-0.8,-0.9),angles(0.17453292519943295,1.5707963267948966,0)),deltaTime)
  2062. LeftShoulder.C0=Lerp(LeftShoulder.C0,cfMul(cf(0,0.9,-1),angles(0.8726646259971648,-1.5707963267948966,0)),deltaTime)
  2063. end
  2064. })
  2065. addmode("r", {
  2066. idle = function()
  2067. local Ychg=velYchg()/20
  2068.  
  2069. RootJoint.C0=Lerp(RootJoint.C0,cfMul(cf(0,5+0.2*sin(sine*1),0),angles(0.3490658503988659,0,3.141592653589793)),deltaTime)
  2070. LeftHip.C0=Lerp(LeftHip.C0,cfMul(cf(-1,-1,0),angles(0,-1.5707963267948966-0.17453292519943295*sin(sine*1),0.6108652381980153+0.17453292519943295*sin(sine*1))),deltaTime)
  2071. Neck.C0=Lerp(Neck.C0,cfMul(cf(0,1,0),angles(-1.5707963267948966,0,3.141592653589793)),deltaTime)
  2072. MangaWeld.C0=Lerp(MangaWeld.C0,cfMul(cf(2,0,0),angles(1.7453292519943295,0.2617993877991494,1.5707963267948966)),deltaTime)
  2073. RightHip.C0=Lerp(RightHip.C0,cfMul(cf(1,-1,0),angles(0,1.5707963267948966+0.17453292519943295*sin(sine*1),-0.4363323129985824-0.17453292519943295*sin(sine*1))),deltaTime)
  2074. RightShoulder.C0=Lerp(RightShoulder.C0,cfMul(cf(1,0.5,0.5),angles(-1.7453292519943295+0.17453292519943295*sin(sine*1),1.5707963267948966+0.17453292519943295*sin(sine*1),0)),deltaTime)
  2075. LeftShoulder.C0=Lerp(LeftShoulder.C0,cfMul(cf(-1,0.5,0.5),angles(-2.181661564992912+0.17453292519943295*sin(sine*1),-1.5707963267948966-0.17453292519943295*sin(sine*1),0)),deltaTime) end
  2076. })
  2077. addmode("t", {
  2078. idle = function()
  2079. local Ychg=velYchg()/20
  2080.  
  2081. LeftHip.C0=Lerp(LeftHip.C0,cfMul(cf(-1,-1,0),angles(0,-1.5707963267948966,0)),deltaTime)
  2082. RightHip.C0=Lerp(RightHip.C0,cfMul(cf(1,-1,0),angles(0,1.5707963267948966,0)),deltaTime)
  2083. RightShoulder.C0=Lerp(RightShoulder.C0,cfMul(cf(1,0.5,0),angles(0,1.5707963267948966,0)),deltaTime)
  2084. RootJoint.C0=Lerp(RootJoint.C0,angles(-1.5707963267948966,0,3.141592653589793),deltaTime)
  2085. LeftShoulder.C0=Lerp(LeftShoulder.C0,cfMul(cf(-1,0.5,0),angles(0,-1.5707963267948966,0)),deltaTime)
  2086. Neck.C0=Lerp(Neck.C0,cfMul(cf(0,1,0),angles(-1.5707963267948966,0,3.141592653589793)),deltaTime) end
  2087. })
  2088. addmode("y", {
  2089. idle = function()
  2090. local Ychg=velYchg()/20
  2091.  
  2092. LeftHip.C0=Lerp(LeftHip.C0,cfMul(cf(-1,-1,0),angles(0,-1.5707963267948966,0)),deltaTime)
  2093. RightHip.C0=Lerp(RightHip.C0,cfMul(cf(1,-1,0),angles(0,1.5707963267948966,0)),deltaTime)
  2094. RightShoulder.C0=Lerp(RightShoulder.C0,cfMul(cf(1,0.5,0),angles(0,1.5707963267948966,0)),deltaTime)
  2095. RootJoint.C0=Lerp(RootJoint.C0,angles(-1.5707963267948966,0,3.141592653589793),deltaTime)
  2096. LeftShoulder.C0=Lerp(LeftShoulder.C0,cfMul(cf(-1,0.5,0),angles(0,-1.5707963267948966,0)),deltaTime)
  2097. Neck.C0=Lerp(Neck.C0,cfMul(cf(0,1,0),angles(-1.5707963267948966,0,3.141592653589793)),deltaTime) end
  2098. })
  2099. addmode("u", {
  2100. idle = function()
  2101. velYchg()
  2102.  
  2103. LeftHip.C0=Lerp(LeftHip.C0,cfMul(cf(-1,-1,0),angles(0,-1.5707963267948966,0)),deltaTime)
  2104. RightHip.C0=Lerp(RightHip.C0,cfMul(cf(1,-1,0),angles(0,1.5707963267948966,0)),deltaTime)
  2105. RightShoulder.C0=Lerp(RightShoulder.C0,cfMul(cf(1,0.5,0),angles(0,1.5707963267948966,0)),deltaTime)
  2106. RootJoint.C0=Lerp(RootJoint.C0,angles(-1.5707963267948966,0,3.141592653589793),deltaTime)
  2107. LeftShoulder.C0=Lerp(LeftShoulder.C0,cfMul(cf(-1,0.5,0),angles(0,-1.5707963267948966,0)),deltaTime)
  2108. Neck.C0=Lerp(Neck.C0,cfMul(cf(0,1,0),angles(-1.5707963267948966,0,3.141592653589793)),deltaTime) end
  2109. })
  2110. addmode("i", {
  2111. idle = function()
  2112.  
  2113. LeftHip.C0=Lerp(LeftHip.C0,cfMul(cf(-1,-1,0),angles(0,-1.5707963267948966,0)),deltaTime)
  2114. RightHip.C0=Lerp(RightHip.C0,cfMul(cf(1,-1,0),angles(0,1.5707963267948966,0)),deltaTime)
  2115. RightShoulder.C0=Lerp(RightShoulder.C0,cfMul(cf(1,0.5,0),angles(0,1.5707963267948966,0)),deltaTime)
  2116. RootJoint.C0=Lerp(RootJoint.C0,angles(-1.5707963267948966,0,3.141592653589793),deltaTime)
  2117. LeftShoulder.C0=Lerp(LeftShoulder.C0,cfMul(cf(-1,0.5,0),angles(0,-1.5707963267948966,0)),deltaTime)
  2118. Neck.C0=Lerp(Neck.C0,cfMul(cf(0,1,0),angles(-1.5707963267948966,0,3.141592653589793)),deltaTime) end,
  2119. })
  2120. addmode("o", {
  2121. idle = function()
  2122. local Ychg=velYchg()/20
  2123. local rY, lY = raycastlegs()
  2124.  
  2125.  
  2126. LeftHip.C0=Lerp(LeftHip.C0,cfMul(cf(-1,-1,0),angles(0,-1.5707963267948966,0)),deltaTime)
  2127. RightHip.C0=Lerp(RightHip.C0,cfMul(cf(1,-1,0),angles(0,1.5707963267948966,0)),deltaTime)
  2128. RightShoulder.C0=Lerp(RightShoulder.C0,cfMul(cf(1,0.5,0),angles(0,1.5707963267948966,0)),deltaTime)
  2129. RootJoint.C0=Lerp(RootJoint.C0,angles(-1.5707963267948966,0,3.141592653589793),deltaTime)
  2130. LeftShoulder.C0=Lerp(LeftShoulder.C0,cfMul(cf(-1,0.5,0),angles(0,-1.5707963267948966,0)),deltaTime)
  2131. Neck.C0=Lerp(Neck.C0,cfMul(cf(0,1,0),angles(-1.5707963267948966,0,3.141592653589793)),deltaTime) end,
  2132. walk = function()
  2133. local Ychg=velYchg()/20
  2134. local Vfw, Vrt = velbycfrvec()
  2135.  
  2136. local rY, lY = raycastlegs()
  2137.  
  2138.  
  2139. LeftHip.C0=Lerp(LeftHip.C0,cfMul(cf(-1,-1,0),angles(0,-1.5707963267948966,0)),deltaTime)
  2140. RightHip.C0=Lerp(RightHip.C0,cfMul(cf(1,-1,0),angles(0,1.5707963267948966,0)),deltaTime)
  2141. RightShoulder.C0=Lerp(RightShoulder.C0,cfMul(cf(1,0.5,0),angles(0,1.5707963267948966,0)),deltaTime)
  2142. RootJoint.C0=Lerp(RootJoint.C0,angles(-1.5707963267948966,0,3.141592653589793),deltaTime)
  2143. LeftShoulder.C0=Lerp(LeftShoulder.C0,cfMul(cf(-1,0.5,0),angles(0,-1.5707963267948966,0)),deltaTime)
  2144. Neck.C0=Lerp(Neck.C0,cfMul(cf(0,1,0),angles(-1.5707963267948966,0,3.141592653589793)),deltaTime) end
  2145. })
  2146. addmode("p", {
  2147. idle = function()
  2148. local Ychg=velYchg()/20
  2149.  
  2150. LeftHip.C0=Lerp(LeftHip.C0,cfMul(cf(-1,-1,0),angles(0,-1.5707963267948966,0)),deltaTime)
  2151. RightHip.C0=Lerp(RightHip.C0,cfMul(cf(1,-1,0),angles(0,1.5707963267948966,0)),deltaTime)
  2152. RightShoulder.C0=Lerp(RightShoulder.C0,cfMul(cf(1,0.5,0),angles(0,1.5707963267948966,0)),deltaTime)
  2153. RootJoint.C0=Lerp(RootJoint.C0,angles(-1.5707963267948966,0,3.141592653589793),deltaTime)
  2154. LeftShoulder.C0=Lerp(LeftShoulder.C0,cfMul(cf(-1,0.5,0),angles(0,-1.5707963267948966,0)),deltaTime)
  2155. Neck.C0=Lerp(Neck.C0,cfMul(cf(0,1,0),angles(-1.5707963267948966,0,3.141592653589793)),deltaTime) end
  2156. })
  2157. addmode("f", {
  2158. modeEntered = function()
  2159. setWalkSpeed(25)
  2160. end,
  2161. idle = function()
  2162. velYchg()
  2163.  
  2164. RightHip.C0=Lerp(RightHip.C0,cfMul(cf(1.05,-1,0.55),angles(0,1.5707963267948966,0)),deltaTime)
  2165. RightShoulder.C0=Lerp(RightShoulder.C0,cfMul(cf(0.05,-1.5,-0.55),angles(0,1.5707963267948966,0)),deltaTime)
  2166. LeftShoulder.C0=Lerp(LeftShoulder.C0,cfMul(cf(-0.05,-1.5,-0.55),angles(0,-1.5707963267948966,0)),deltaTime)
  2167. RootJoint.C0=Lerp(RootJoint.C0,cfMul(cf(0,-0.025 * sin(sine*3),0),angles(-1.5707963267948966,0,3.141592653589793)),deltaTime)
  2168. LeftHip.C0=Lerp(LeftHip.C0,cfMul(cf(-1.05,-1,0.55),angles(0,-1.5707963267948966,0)),deltaTime)
  2169. Neck.C0=Lerp(Neck.C0,cfMul(cf(0,1,0),angles(-1.5707963267948966,0,3.141592653589793)),deltaTime) end,
  2170. walk = function()
  2171. velYchg()
  2172. local Vfw, Vrt = velbycfrvec()
  2173.  
  2174. RightHip.C0=Lerp(RightHip.C0,cfMul(cf(1.05,-1,0.55),angles(-0.08726646259971647-0.3490658503988659*sin(sine*5),1.5707963267948966,0)),deltaTime)
  2175. RightShoulder.C0=Lerp(RightShoulder.C0,cfMul(cf(0.05,-1.5,-0.55),angles(0.08726646259971647+0.3490658503988659*sin(sine*5),1.5707963267948966,0)),deltaTime)
  2176. LeftShoulder.C0=Lerp(LeftShoulder.C0,cfMul(cf(-0.05,-1.5,-0.55),angles(0.4363323129985824+0.4363323129985824*sin(sine*5),-1.5707963267948966,0)),deltaTime)
  2177. RootJoint.C0=Lerp(RootJoint.C0,cfMul(cf(0,-0.025 * sin(sine*3),0),angles(-1.5707963267948966,0.08726646259971647*sin(sine*5),3.141592653589793)),deltaTime)
  2178. LeftHip.C0=Lerp(LeftHip.C0,cfMul(cf(-1,-1,0.55),angles(-0.4363323129985824-0.4363323129985824*sin(sine*5),-1.5707963267948966,0)),deltaTime)
  2179. Neck.C0=Lerp(Neck.C0,cfMul(cf(0,1,0),angles(-1.5707963267948966,0,3.141592653589793)),deltaTime) end,
  2180. modeLeft = function()
  2181. setWalkSpeed(16)
  2182. end,
  2183. jump = function()
  2184. velYchg()
  2185. local Vfw, Vrt = velbycfrvec()
  2186. RightHip.C0=Lerp(RightHip.C0,cfMul(cf(1.05,-1,0.55),angles(-0.08726646259971647-0.3490658503988659*sin(sine*5),1.5707963267948966,0)),deltaTime)
  2187. RightShoulder.C0=Lerp(RightShoulder.C0,cfMul(cf(0.05,-1.5,-0.55),angles(0,1.5707963267948966,0)),deltaTime)
  2188. LeftShoulder.C0=Lerp(LeftShoulder.C0,cfMul(cf(-0.05,-1.5,-0.55),angles(0.4363323129985824+0.4363323129985824*sin(sine*5),-1.5707963267948966,0)),deltaTime)
  2189. RootJoint.C0=Lerp(RootJoint.C0,angles(-1.6580627893946132+0.17453292519943295*sin(sine*5),0,3.141592653589793),deltaTime)
  2190. LeftHip.C0=Lerp(LeftHip.C0,cfMul(cf(-1,-1,0.55),angles(-0.4363323129985824-0.4363323129985824*sin(sine*5),-1.5707963267948966,0)),deltaTime)
  2191. Neck.C0=Lerp(Neck.C0,cfMul(cf(0,1,0),angles(-1.5707963267948966,0,3.141592653589793)),deltaTime) end,
  2192. modeLeft = function()
  2193. setWalkSpeed(16)
  2194. end,
  2195. })
  2196. addmode("g", {
  2197. idle = function()
  2198. local Ychg=velYchg()/20
  2199.  
  2200. RightShoulder.C0=Lerp(RightShoulder.C0,cfMul(cf(1,0.5,0),angles(0,1.5707963267948966,0)),deltaTime)
  2201. RootJoint.C0=Lerp(RootJoint.C0,cfMul(cf(2-110*sin(sine*100),5 * sin(sine*523),10 * sin(sine*5235)),angles(-1.5707963267948966+17.453292519943297*sin(sine*522355),0,3.141592653589793+3.141592653589793*sin(sine*3563556))),deltaTime)
  2202. Neck.C0=Lerp(Neck.C0,cfMul(cf(0,1,0),angles(-1.5707963267948966,0,3.141592653589793)),deltaTime)
  2203. LeftHip.C0=Lerp(LeftHip.C0,cfMul(cf(-1,-1,0),angles(0,-1.5707963267948966,0)),deltaTime)
  2204. RightHip.C0=Lerp(RightHip.C0,cfMul(cf(1,-1,0),angles(0,1.5707963267948966,0)),deltaTime)
  2205. LeftShoulder.C0=Lerp(LeftShoulder.C0,cfMul(cf(-1,0.5,0),angles(0,-1.5707963267948966,0)),deltaTime) end,
  2206. walk = function()
  2207. velYchg()
  2208. local Vfw, Vrt = velbycfrvec()
  2209. RightShoulder.C0=Lerp(RightShoulder.C0,cfMul(cf(1,0.5,0),angles(0,1.5707963267948966,0)),deltaTime)
  2210. RootJoint.C0=Lerp(RootJoint.C0,cfMul(cf(2-110*sin(sine*100),5 * sin(sine*523),10 * sin(sine*5235)),angles(-1.5707963267948966+17.453292519943297*sin(sine*522355),0,3.141592653589793+3.141592653589793*sin(sine*3563556))),deltaTime)
  2211. Neck.C0=Lerp(Neck.C0,cfMul(cf(0,1,0),angles(-1.5707963267948966,0,3.141592653589793)),deltaTime)
  2212. LeftHip.C0=Lerp(LeftHip.C0,cfMul(cf(-1,-1,0),angles(0,-1.5707963267948966,0)),deltaTime)
  2213. RightHip.C0=Lerp(RightHip.C0,cfMul(cf(1,-1,0),angles(0,1.5707963267948966,0)),deltaTime)
  2214. LeftShoulder.C0=Lerp(LeftShoulder.C0,cfMul(cf(-1,0.5,0),angles(0,-1.5707963267948966,0)),deltaTime)
  2215. end,
  2216. })
  2217. addmode("h", {
  2218. idle = function()
  2219. local Ychg=velYchg()/20
  2220. Neck.C0=Lerp(Neck.C0,cfMul(cf(0,1,0),angles(-1.5707963267948966,0,3.141592653589793)),deltaTime)
  2221. BroomWeld.C0=Lerp(BroomWeld.C0,cfMul(cf(0.9,0.8,-0.7),angles(0,0,-0.9250245035569946)),deltaTime)
  2222. LeftHip.C0=Lerp(LeftHip.C0,cfMul(cf(-0.5,-1,0),angles(0,0.17453292519943295,0.17453292519943295)),deltaTime)
  2223. RightHip.C0=Lerp(RightHip.C0,cfMul(cf(0.95,-0.5,-0.5),angles(0.7853981633974483,1.5707963267948966,0)),deltaTime)
  2224. RootJoint.C0=Lerp(RootJoint.C0,angles(-1.3962634015954636,0,3.141592653589793),deltaTime)
  2225. LeftShoulder.C0=Lerp(LeftShoulder.C0,cfMul(cf(-1,0.5,0),angles(0,0,2.6179938779914944)),deltaTime)
  2226. RightShoulder.C0=Lerp(RightShoulder.C0,cfMul(cf(1,0.5,0),angles(0,0,-2.6179938779914944)),deltaTime) end,
  2227. walk = function()
  2228. velYchg()
  2229. local Vfw, Vrt = velbycfrvec()
  2230. LeftShoulder.C0=Lerp(LeftShoulder.C0,cfMul(cf(-2.5,1.1+0.1*sin(sine*2.5),0.1),angles(1.5707963267948966,0,1.5707963267948966)),deltaTime)
  2231. RightHip.C0=Lerp(RightHip.C0,cfMul(cf(1,-1,0),angles(-0.17453292519943295,0.9424777960769379,0)),deltaTime)
  2232. Neck.C0=Lerp(Neck.C0,cfMul(cf(0,1,0),angles(-1.5707963267948966,0,3.141592653589793)),deltaTime)
  2233. BroomWeld.C0=Lerp(BroomWeld.C0,cfMul(cf(-2+0.1*sin(sine*1),2.5,0.5),angles(0,0.08726646259971647,0.6981317007977318)),deltaTime)
  2234. LeftHip.C0=Lerp(LeftHip.C0,cfMul(cf(-1.1,-1,-0.1),angles(-0.17453292519943295,-1.6580627893946132,0)),deltaTime)
  2235. RootJoint.C0=Lerp(RootJoint.C0,cfMul(cf(0,5+0.5*sin(sine*1.5),0),angles(-1.5707963267948966,0,-1.5707963267948966)),deltaTime)
  2236. RightShoulder.C0=Lerp(RightShoulder.C0,cfMul(cf(1.5,1.1+0.1*sin(sine*2.5),0.1),angles(1.5707963267948966,0,1.5707963267948966)),deltaTime)
  2237. end,
  2238. })
  2239. addmode("j", {
  2240. idle = function()
  2241. local Ychg=velYchg()/20
  2242.  
  2243. LeftHip.C0=Lerp(LeftHip.C0,cfMul(cf(-1,-1,0),angles(0,-1.5707963267948966,0)),deltaTime)
  2244. RightHip.C0=Lerp(RightHip.C0,cfMul(cf(1,-1,0),angles(0,1.5707963267948966,0)),deltaTime)
  2245. RightShoulder.C0=Lerp(RightShoulder.C0,cfMul(cf(1,0.5,0),angles(0,1.5707963267948966,0)),deltaTime)
  2246. RootJoint.C0=Lerp(RootJoint.C0,angles(-1.5707963267948966,0,3.141592653589793),deltaTime)
  2247. LeftShoulder.C0=Lerp(LeftShoulder.C0,cfMul(cf(-1,0.5,0),angles(0,-1.5707963267948966,0)),deltaTime)
  2248. Neck.C0=Lerp(Neck.C0,cfMul(cf(0,1,0),angles(-1.5707963267948966,0,3.141592653589793)),deltaTime) end
  2249. })
  2250. addmode("k", {
  2251. idle = function()
  2252. local Ychg=velYchg()/20
  2253.  
  2254. LeftHip.C0=Lerp(LeftHip.C0,cfMul(cf(-1,-1,0),angles(0,-1.5707963267948966,0)),deltaTime)
  2255. RightHip.C0=Lerp(RightHip.C0,cfMul(cf(1,-1,0),angles(0,1.5707963267948966,0)),deltaTime)
  2256. RightShoulder.C0=Lerp(RightShoulder.C0,cfMul(cf(1,0.5,0),angles(0,1.5707963267948966,0)),deltaTime)
  2257. RootJoint.C0=Lerp(RootJoint.C0,angles(-1.5707963267948966,0,3.141592653589793),deltaTime)
  2258. LeftShoulder.C0=Lerp(LeftShoulder.C0,cfMul(cf(-1,0.5,0),angles(0,-1.5707963267948966,0)),deltaTime)
  2259. Neck.C0=Lerp(Neck.C0,cfMul(cf(0,1,0),angles(-1.5707963267948966,0,3.141592653589793)),deltaTime) end
  2260. })
  2261. local function idleL()
  2262. local Ychg=velYchg()/20
  2263.  
  2264. LeftHip.C0=Lerp(LeftHip.C0,cfMul(cf(-1,-1,0),angles(0,-1.5707963267948966,0)),deltaTime)
  2265. RightHip.C0=Lerp(RightHip.C0,cfMul(cf(1,-1,0),angles(0,1.5707963267948966,0)),deltaTime)
  2266. RightShoulder.C0=Lerp(RightShoulder.C0,cfMul(cf(1,0.5,0),angles(0,1.5707963267948966,0)),deltaTime)
  2267. RootJoint.C0=Lerp(RootJoint.C0,angles(-1.5707963267948966,0,3.141592653589793),deltaTime)
  2268. LeftShoulder.C0=Lerp(LeftShoulder.C0,cfMul(cf(-1,0.5,0),angles(0,-1.5707963267948966,0)),deltaTime)
  2269. Neck.C0=Lerp(Neck.C0,cfMul(cf(0,1,0),angles(-1.5707963267948966,0,3.141592653589793)),deltaTime) end
  2270. addmode("l", {
  2271. modeEntered = function()
  2272. setWalkSpeed(10)
  2273. end,
  2274. idle = idleL,
  2275. walk = idleL,
  2276. modeLeft = function()
  2277. setWalkSpeed(16)
  2278. end
  2279. })
  2280. end)
  2281.  
  2282.  
  2283. local function swtc(txt,options,onchanged)
  2284. local current=0
  2285. local swtcbtn=nil
  2286. local function btnpressed()
  2287. current=current+1
  2288. if current>#options then
  2289. current=1
  2290. end
  2291. local option=options[current]
  2292. insSet(swtcbtn,"Text",txt..": "..option.text)
  2293. onchanged(option.value)
  2294. end
  2295. swtcbtn=btn("change",btnpressed)
  2296. btnpressed()
  2297. return swtcbtn
  2298. end
  2299.  
  2300. swtc("client sided placeholders",{
  2301. {value=true,text="yes"},
  2302. {value=false,text="no"}
  2303. },function(v)
  2304. placeholders=v
  2305. end)
  2306.  
  2307. swtc("highlight fling targets",{
  2308. {value=true,text="yes"},
  2309. {value=false,text="no"}
  2310. },function(v)
  2311. highlightflingtargets=v
  2312. end)
  2313.  
  2314. swtc("allow shiftlock",{
  2315. {value=true,text="yes"},
  2316. {value=false,text="no"}
  2317. },function(v)
  2318. allowshiftlock=v
  2319. end)
  2320.  
  2321. swtc("ctrl click tp",{
  2322. {value=true,text="yes"},
  2323. {value=false,text="no"}
  2324. },function(v)
  2325. ctrltp=v
  2326. end)
  2327.  
  2328. swtc("click fling",{
  2329. {value=true,text="yes"},
  2330. {value=false,text="no"}
  2331. },function(v)
  2332. clickfling=v
  2333. end)
  2334.  
  2335. swtc("changestate when fling",{
  2336. {value=true,text="yes"},
  2337. {value=false,text="no"}
  2338. },function(v)
  2339. flingchangestate=v
  2340. end)
  2341.  
  2342.  
  2343. swtc("respawn tp",{
  2344. {value=3,text="hide body"},
  2345. {value=0,text="stay at spawn"},
  2346. {value=1,text="random tp close"},
  2347. {value=2,text="behind char"}
  2348. },function(v)
  2349. respawntp=v
  2350. end)
  2351.  
  2352. local disguiscripts=nil
  2353. swtc("new gui scripts",{
  2354. {value=true,text="disable"},
  2355. {value=false,text="keep"}
  2356. },function(v)
  2357. disguiscripts=v
  2358. end)
  2359. Connect(insGet(pg,"DescendantAdded"),function(v)
  2360. if c and disguiscripts and IsA(v,"Script") then --mind Enum.RunContext.Client
  2361. insSet(v,"Disabled",true)
  2362. end
  2363. end)
  2364.  
  2365. swtc("new character scripts",{
  2366. {value=function(v)
  2367. if IsA(v,"Script") then --mind Enum.RunContext.Client
  2368. insSet(v,"Disabled",true)
  2369. end
  2370. end,text="disable"},
  2371. {value=false,text="keep"}
  2372. },function(v)
  2373. discharscripts=v
  2374. end)
  2375.  
  2376. swtc("breakjoints",{
  2377. {value=1,text="breakjoints+health"},
  2378. {value=2,text="health or breakjoints"},
  2379. {value=3,text="breakjoints"}
  2380. },function(v)
  2381. breakjointsmethod=v
  2382. end)
  2383.  
  2384. swtc("set simulation radius",{
  2385. {value=true,text="yes"},
  2386. {value=false,text="no"},
  2387. },function(v)
  2388. simrad=v
  2389. end)
  2390.  
  2391. local iscg,_=pcall(insSet,i10,"Parent",FindFirstChildOfClass(game,"CoreGui"))
  2392. if not iscg then
  2393. insSet(i7,"Text","PLAYERGUI MODE")
  2394. insSet(i10,"Parent",pg)
  2395. twait(3)
  2396. insSet(i7,"Text",guiTheme.guiTitle)
  2397. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement