Advertisement
Guest User

Untitled

a guest
Mar 28th, 2015
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 33.34 KB | None | 0 0
  1. -- Magical Fairy --
  2. local plr = game:service'Players'.LocalPlayer
  3. local m = plr:GetMouse()
  4. local char = plr.Character
  5. local runservice = game:service'RunService'
  6. local modelScale = 1/5
  7.  
  8. pcall(function() local a = script.Parent.FaerieScript if a ~= script then a:Destroy() end end)
  9. pcall(function() local a = char.Animate if a ~= script then a.Disabled = true a:Destroy() end end)
  10. script.Name = "FaerieScript"
  11. function weld(a,b,c,d)
  12. local w = Instance.new("Weld",a)
  13. w.Part0 = a
  14. w.Part1 = b
  15. w.C0 = c or CFrame.new()
  16. w.C1 = d or CFrame.new()
  17. return w
  18. end
  19. function lerp(a,b,c)
  20. return a+(b-a)*c
  21. end
  22. do -- Ignore my clerp stuff stolen from stravvy
  23. local function QuaternionFromCFrame(cf)
  24. local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components()
  25. local trace = m00 + m11 + m22
  26. if trace > 0 then
  27. local s = math.sqrt(1 + trace)
  28. local recip = 0.5/s
  29. return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5
  30. else
  31. local i = 0
  32. if m11 > m00 then
  33. i = 1
  34. end
  35. if m22 > (i == 0 and m00 or m11) then
  36. i = 2
  37. end
  38. if i == 0 then
  39. local s = math.sqrt(m00-m11-m22+1)
  40. local recip = 0.5/s
  41. return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip
  42. elseif i == 1 then
  43. local s = math.sqrt(m11-m22-m00+1)
  44. local recip = 0.5/s
  45. return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip
  46. elseif i == 2 then
  47. local s = math.sqrt(m22-m00-m11+1)
  48. local recip = 0.5/s return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip
  49. end
  50. end
  51. end
  52. local function QuaternionToCFrame(px, py, pz, x, y, z, w)
  53. local xs, ys, zs = x + x, y + y, z + z
  54. local wx, wy, wz = w*xs, w*ys, w*zs
  55. local xx = x*xs
  56. local xy = x*ys
  57. local xz = x*zs
  58. local yy = y*ys
  59. local yz = y*zs
  60. local zz = z*zs
  61. return CFrame.new(px, py, pz,1-(yy+zz), xy - wz, xz + wy,xy + wz, 1-(xx+zz), yz - wx, xz - wy, yz + wx, 1-(xx+yy))
  62. end
  63. local function QuaternionSlerp(a, b, t)
  64. local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4]
  65. local startInterp, finishInterp;
  66. if cosTheta >= 0.0001 then
  67. if (1 - cosTheta) > 0.0001 then
  68. local theta = math.acos(cosTheta)
  69. local invSinTheta = 1/math.sin(theta)
  70. startInterp = math.sin((1-t)*theta)*invSinTheta
  71. finishInterp = math.sin(t*theta)*invSinTheta
  72. else
  73. startInterp = 1-t
  74. finishInterp = t
  75. end
  76. else
  77. if (1+cosTheta) > 0.0001 then
  78. local theta = math.acos(-cosTheta)
  79. local invSinTheta = 1/math.sin(theta)
  80. startInterp = math.sin((t-1)*theta)*invSinTheta
  81. finishInterp = math.sin(t*theta)*invSinTheta
  82. else
  83. startInterp = t-1
  84. finishInterp = t
  85. end
  86. end
  87. return a[1]*startInterp + b[1]*finishInterp, a[2]*startInterp + b[2]*finishInterp, a[3]*startInterp + b[3]*finishInterp, a[4]*startInterp + b[4]*finishInterp
  88. end
  89. function clerp(a,b,t)
  90. local qa = {QuaternionFromCFrame(a)}
  91. local qb = {QuaternionFromCFrame(b)}
  92. local ax, ay, az = a.x, a.y, a.z
  93. local bx, by, bz = b.x, b.y, b.z
  94. local _t = 1-t
  95. return QuaternionToCFrame(_t*ax + t*bx, _t*ay + t*by, _t*az + t*bz,QuaternionSlerp(qa, qb, t))
  96. end
  97. end
  98. for i,v in pairs(char:GetChildren()) do
  99. if v:IsA("Hat") or v:IsA("BodyColors") or v:IsA("Clothing") or v:IsA("ShirtGraphic") then
  100. v:Destroy()
  101. end
  102. end
  103. Instance.new("Hat",char)
  104. local root = char.HumanoidRootPart
  105. local tw = root.RootJoint
  106. local tor = char.Torso
  107. local hd = char.Head
  108. local hum = char.Humanoid
  109. hum.Health = 666
  110. hum.MaxHealth = 666
  111. hum.WalkSpeed = 20
  112. local rl,ll = char["Right Leg"],char["Left Leg"]
  113. local ra,la = char["Right Arm"],char["Left Arm"]
  114. local c0 = {
  115. rs = CFrame.new(1,.5,0),
  116. ls = CFrame.new(-1,.5,0),
  117. rh = CFrame.new(.5,-1,0),
  118. lh = CFrame.new(-.5,-1,0),
  119. nk = CFrame.new(0,1,0),
  120. tw = CFrame.new(0,0,0)*CFrame.Angles(0,0,0),
  121. }
  122. local c1 = {
  123. rs = CFrame.new(-.5,.5,0),
  124. ls = CFrame.new(.5,.5,0),
  125. rh = CFrame.new(0,1,0),
  126. lh = CFrame.new(0,1,0),
  127. nk = CFrame.new(0,-.5,0),
  128. tw = CFrame.new(0,0,0)*CFrame.Angles(0,0,0)
  129. }
  130. local rs = tor["Right Shoulder"]
  131. local ls = tor["Left Shoulder"]
  132. local rh = tor["Right Hip"]
  133. local lh = tor["Left Hip"]
  134. local nk = tor["Neck"]
  135. for i,v in pairs(tor:GetChildren()) do
  136. if v:IsA("Motor6D") then
  137. v.DesiredAngle = 0
  138. v.MaxVelocity = 0
  139. v.CurrentAngle = 0
  140. end
  141. end
  142.  
  143.  
  144. pcall(function() tor.roblox:Destroy() end)
  145. pcall(function() char.Faerie:Destroy() end)
  146. local model = Instance.new("Model",char)
  147. model.Name = "Faerie"
  148. local BasePart = Instance.new("Part")
  149. BasePart.CanCollide = false
  150. BasePart.Anchored = false
  151. BasePart.FormFactor = "Custom"
  152. BasePart.Locked = true
  153. BasePart.Size = Vector3.new()
  154. BasePart.TopSurface,BasePart.BottomSurface,BasePart.LeftSurface,BasePart.RightSurface,BasePart.FrontSurface,BasePart.BackSurface = 10,10,10,10,10,10
  155. BasePart:BreakJoints()
  156. function NP(par)
  157. local p = BasePart:Clone()
  158. p.Parent = par or model
  159. return p
  160. end
  161. local w1 = NP()
  162. w1.Transparency = .1
  163. local w1m = Instance.new("SpecialMesh",w1)
  164. w1m.MeshId = "rbxassetid://19367766"
  165. w1m.TextureId = "rbxassetid://9854798"
  166. w1m.Scale = Vector3.new(1.05, 1.05, 1.05)
  167. local w1 = weld(tor,w1,CFrame.new(-.1,0.55,1.6))
  168. local w2 = NP()
  169. w2.Transparency = .1
  170. local w2m = Instance.new("SpecialMesh",w2)
  171. w2m.MeshId = "rbxassetid://19367766"
  172. w2m.TextureId = "rbxassetid://9854798"
  173. w2m.Scale = Vector3.new(1.05, 1.05, 1.05)
  174. local w2 = weld(tor,w2,CFrame.new(.1,0.55,1.6))
  175. local h = NP()
  176. local hm = Instance.new("SpecialMesh",h)
  177. hm.MeshId = "rbxassetid://62246019"
  178. hm.TextureId = "rbxassetid://91740209"
  179. hm.Scale = Vector3.new(1, 1, 1)
  180. weld(hd,h,CFrame.new(0,0.2,0))
  181. for i,v in pairs(char:GetChildren()) do
  182. if v:IsA("BasePart") then
  183. v.Material = "SmoothPlastic"
  184. v.TopSurface,v.BottomSurface,v.FrontSurface,v.BackSurface,v.LeftSurface,v.RightSurface = 10,10,10,10,10,10
  185. end
  186. end
  187. do
  188. if modelScale ~= 1 then
  189. for i,v in pairs(c0) do
  190. c0[i] = (v-v.p) + v.p*modelScale
  191. end
  192. for i,v in pairs(c1) do
  193. c1[i] = (v-v.p) + v.p*modelScale
  194. end
  195. local Joints = {}
  196. local gtJoints,gtParts;
  197. local function gtCFrame(cf)
  198. return (cf-cf.p) + cf.p * modelScale
  199. end
  200. function gtJoints(p)
  201. for i,v in pairs(p:GetChildren()) do
  202. if v:IsA("JointInstance") then
  203. table.insert(Joints,{v,v.Part0,v.Part1})
  204. v.Part0 = nil
  205. v.Part1 = nil
  206. v.C0 = (v.C0-(v.C0.p)) + (v.C0.p * modelScale)
  207. v.C1 = (v.C1-(v.C1.p)) + (v.C1.p * modelScale)
  208. end
  209. gtJoints(v)
  210. end
  211. end
  212. function gtParts(p)
  213. for i,v in pairs(p:GetChildren()) do
  214. if v:IsA("BasePart") then
  215. pcall(function() v.FormFactor = "Custom" end)
  216. local oldz = v.Size
  217. local cf = tor.CFrame:toObjectSpace(v.CFrame)
  218. v.Size = v.Size * modelScale
  219. v.CFrame = tor.CFrame * gtCFrame(cf)
  220. local mesh = nil
  221. for i,t in pairs(v:GetChildren()) do
  222. if t:IsA("DataModelMesh") then
  223. mesh = t
  224. end
  225. end
  226. if mesh == nil and v:IsA("Part") and v.Shape == Enum.PartType.Ball then
  227. mesh = Instance.new("SpecialMesh",v)
  228. mesh.MeshType = Enum.MeshType.Sphere
  229. end
  230. if mesh == nil and ((v:IsA("Part") and v.Shape == Enum.PartType.Block) or v:IsA("Seat") or v:IsA("VehicleSeat")) then
  231. mesh = Instance.new("BlockMesh",v)
  232. end
  233. if mesh ~= nil then
  234. if mesh:IsA("SpecialMesh") and mesh.MeshType == Enum.MeshType.FileMesh then
  235. mesh.Scale = mesh.Scale * modelScale
  236. else
  237. mesh.Scale = mesh.Scale*(oldz*modelScale)/v.Size
  238. end
  239. end
  240. end
  241. gtParts(v)
  242. end
  243. end
  244. gtJoints(char)
  245. gtParts(char)
  246. for i,v in pairs(Joints) do
  247. v[1].Part0 = v[2]
  248. v[1].Part1 = v[3]
  249. end
  250. end
  251. end
  252. rs.C0,rs.C1 = c0.rs,c1.rs
  253. ls.C0,ls.C1 = c0.ls,c1.ls
  254. rh.C0,rh.C1 = c0.rh,c1.rh
  255. lh.C0,lh.C1 = c0.lh,c1.lh
  256. nk.C0,nk.C1 = c0.nk,c1.nk
  257. tw.C0,tw.C1 = c0.tw,c1.tw
  258. local w10,w20 = w1.C0,w2.C0
  259. local pl = tor:FindFirstChild("FairyLight") or Instance.new("PointLight",tor)
  260. pl.Name = "FairyLight"
  261. pl.Shadows = false
  262. pl.Range = 8
  263. pl.Brightness = 10
  264. local sparkles = tor:FindFirstChild("FairySparkles") or Instance.new("Sparkles",tor)
  265. sparkles.Name = "FairySparkles"
  266.  
  267. local outfit = 0
  268. local outfitparts = {ra,la,rl,ll,tor}
  269. local outfits = {
  270. {{106705109},{106705077},{106703301},{106703213},{106705037}}
  271. }
  272.  
  273. local mycolor = ll.BrickColor.Color
  274. local mycolor2 = mycolor
  275. function setOutfit()
  276. local of = outfits[outfit]
  277. if of then
  278. for i,v in pairs(outfitparts) do
  279. local mesh = v:FindFirstChild("outfitMesh")
  280. local meshdata = outfits[outfit][i]
  281. if not mesh then
  282. mesh = Instance.new("SpecialMesh",v)
  283. mesh.Name = "outfitMesh"
  284. mesh.TextureId = "rbxassetid://9854798"
  285. end
  286. mesh.Scale =(meshdata[2] or Vector3.new(1,1,1)) * modelScale
  287. mesh.MeshId = "rbxassetid://"..meshdata[1]
  288. mesh.VertexColor = Vector3.new(mycolor2.r,mycolor2.g,mycolor2.b)
  289. end
  290. else
  291. for i,v in pairs(outfitparts) do
  292. pcall(function() v.outfitMesh:Destroy() end)
  293. end
  294. end
  295. end
  296. setOutfit()
  297. local senabled = true
  298. local lenabled = true
  299. function changeColor()
  300. for i,v in pairs(char:GetChildren()) do
  301. if v:IsA("BasePart") then
  302. v.BrickColor = BrickColor.new(mycolor)
  303. end
  304. end
  305. local mc1 = Vector3.new(mycolor.r,mycolor.g,mycolor.b)
  306. local mc2 = Vector3.new(mycolor2.r,mycolor2.g,mycolor2.b)
  307. w1m.VertexColor,w2m.VertexColor,hm.VertexColor = mc1,mc1,mc2
  308. for i,v in pairs(outfitparts) do
  309. local mesh = v:FindFirstChild("outfitMesh")
  310. if mesh then
  311. mesh.VertexColor = mc2
  312. end
  313. end
  314. pl.Color = mycolor
  315. sparkles.SparkleColor = mycolor
  316. end
  317. changeColor()
  318. do
  319. pcall(function() plr.PlayerGui.fairyColoring:Destroy() end)
  320. local scr = Instance.new("ScreenGui",plr.PlayerGui)
  321. scr.Name = "fairyColoring"
  322. local fr = Instance.new("Frame",scr)
  323. fr.Size = UDim2.new(0,-150,0,-65)
  324. fr.BackgroundColor3 = Color3.new(1,1,1)
  325. fr.BorderColor3 = Color3.new(.05,.05,.05)
  326. fr.BackgroundTransparency = .8
  327. fr.Position = UDim2.new(1,0,1,scr.Parent:FindFirstChild("PandaHelpNotify") and -20 or 0)
  328. fr.ZIndex = 9
  329. local am = 75
  330. local rval,gval,bval = mycolor.r,mycolor.g,mycolor.b
  331. local r = Instance.new("TextButton",fr)
  332. r.BackgroundTransparency = 1
  333. r.Size = UDim2.new(0,75,0,15)
  334. r.Position = UDim2.new(0,5,0,5)
  335. r.TextColor3 = Color3.new(1,1,1)
  336. r.TextStrokeTransparency = .4
  337. for i=1,am do
  338. local t = Instance.new("ImageLabel",r)
  339. t.BorderSizePixel = 0
  340. t.Size = UDim2.new(1/am,0,1,0)
  341. t.Position = UDim2.new((i-1)/am,0,0,0)
  342. t.Name = i
  343. t.ZIndex = 10
  344. end
  345. local rb = Instance.new("ImageLabel",r)
  346. rb.ZIndex = 10
  347. rb.Size = UDim2.new(0,2,1,-2)
  348. rb.BackgroundColor3 = Color3.new(0,0,0)
  349. rb.BackgroundTransparency = .5
  350. rb.BorderColor3 = Color3.new(.4,.4,.4)
  351. rb.Name = "b"
  352. local g = r:Clone()
  353. g.Parent = fr
  354. g.Position = UDim2.new(0,5,0,25)
  355. local b = r:Clone()
  356. b.Parent = fr
  357. b.Position = UDim2.new(0,5,0,45)
  358. r.ZIndex,g.ZIndex,b.ZIndex = 10,10,10
  359. local prev = Instance.new("TextButton",fr)
  360. prev.Size = UDim2.new(0,55,0,45)
  361. prev.Position = UDim2.new(0,90,0,5)
  362. prev.ZIndex = 10
  363. prev.BorderColor3 = Color3.new(.2,.2,.2)
  364. prev.TextColor3 = Color3.new(1,1,1)
  365. prev.TextStrokeTransparency = .4
  366. prev.TextYAlignment = "Bottom"
  367. prev.FontSize = "Size8"
  368. prev.TextWrapped = true
  369. local res = Instance.new("TextButton",fr)
  370. res.Size = UDim2.new(0,55,0,9)
  371. res.Position = UDim2.new(0,90,0,51)
  372. res.ZIndex = 10
  373. res.BorderColor3 = Color3.new(.2,.2,.2)
  374. res.BackgroundColor3 = Color3.new(.5,0,0)
  375. res.TextColor3 = Color3.new(1,1,1)
  376. res.Text = "reset"
  377. res.FontSize = "Size8"
  378. local mode = 0
  379. local function update(set)
  380. r.b.Position = UDim2.new(rval,-1,0,1)
  381. g.b.Position = UDim2.new(gval,-1,0,1)
  382. b.b.Position = UDim2.new(bval,-1,0,1)
  383. local col = Color3.new(rval,gval,bval)
  384. prev.BackgroundColor3 = mode == 1 and mycolor2 or mycolor
  385. prev.Text = ""
  386. r.Text = math.floor(rval*255+.5)
  387. g.Text = math.floor(gval*255+.5)
  388. b.Text = math.floor(bval*255+.5)
  389. for i,v in pairs(r:GetChildren()) do
  390. local n = tonumber(v.Name)
  391. if n then
  392. local sc = n/am
  393. v.BackgroundColor3 = Color3.new(sc,gval,bval)
  394. end
  395. end
  396. for i,v in pairs(g:GetChildren()) do
  397. local n = tonumber(v.Name)
  398. if n then
  399. local sc = n/am
  400. v.BackgroundColor3 = Color3.new(rval,sc,bval)
  401. end
  402. end
  403. for i,v in pairs(b:GetChildren()) do
  404. local n = tonumber(v.Name)
  405. if n then
  406. local sc = n/am
  407. v.BackgroundColor3 = Color3.new(rval,gval,sc)
  408. end
  409. end
  410. if set ~= false then
  411. if mode == 0 then
  412. mycolor = col
  413. end
  414. if mode == 1 then
  415. mycolor2 = col
  416. end
  417. changeColor()
  418. end
  419. end
  420. update()
  421. local rd,gd,bd = false,false,false
  422. r.MouseButton1Down:connect(function(x,y) rd = true rval = (x-r.AbsolutePosition.X)/r.AbsoluteSize.X update() end)
  423. r.MouseButton1Up:connect(function() rd = false end)
  424. r.MouseLeave:connect(function() rd = false end)
  425. r.MouseMoved:connect(function(x,y) if not rd then return end rval = (x-r.AbsolutePosition.X)/r.AbsoluteSize.X update() end)
  426. g.MouseButton1Down:connect(function(x,y) gd = true gval = (x-g.AbsolutePosition.X)/g.AbsoluteSize.X update() end)
  427. g.MouseButton1Up:connect(function() gd = false end)
  428. g.MouseLeave:connect(function() gd = false end)
  429. g.MouseMoved:connect(function(x,y) if not gd then return end gval = (x-g.AbsolutePosition.X)/g.AbsoluteSize.X update() end)
  430. b.MouseButton1Down:connect(function(x,y) bd = true bval = (x-b.AbsolutePosition.X)/b.AbsoluteSize.X update() end)
  431. b.MouseButton1Up:connect(function() bd = false end)
  432. b.MouseLeave:connect(function() bd = false end)
  433. b.MouseMoved:connect(function(x,y) if not bd then return end bval = (x-b.AbsolutePosition.X)/b.AbsoluteSize.X update() end)
  434. res.MouseButton1Click:connect(function()
  435. rval,gval,bval = themeColor.Color.r,themeColor.Color.g,themeColor.Color.b
  436. update()
  437. end)
  438. local modebtn = Instance.new("TextButton",fr)
  439. modebtn.Position = UDim2.new(1,-150,0,-15)
  440. modebtn.Size = UDim2.new(0,49,0,14)
  441. modebtn.BackgroundColor3 = Color3.new(1,1,0)
  442. modebtn.BackgroundTransparency = .6
  443. modebtn.TextScaled = true
  444. modebtn.Font = 4
  445. modebtn.TextColor3 = Color3.new(1,1,1)
  446. modebtn.TextStrokeTransparency = .7
  447. modebtn.Text = "Body"
  448. modebtn.MouseButton1Click:connect(function()
  449. mode = (mode+1)%2
  450. local col = mode == 1 and mycolor2 or mycolor
  451. rval,gval,bval = col.r,col.g,col.b
  452. modebtn.Text = mode == 0 and "Body" or "Clothes"
  453. update(false)
  454. end)
  455. local outfitbtn = Instance.new("TextButton",fr)
  456. outfitbtn.Position = UDim2.new(1,-150,0,-30)
  457. outfitbtn.Size = UDim2.new(0,49,0,14)
  458. outfitbtn.BackgroundColor3 = Color3.new(1,1,0)
  459. outfitbtn.BackgroundTransparency = .6
  460. outfitbtn.TextScaled = true
  461. outfitbtn.Font = 4
  462. outfitbtn.TextColor3 = Color3.new(1,1,1)
  463. outfitbtn.TextStrokeTransparency = .7
  464. outfitbtn.Text = "Outfit"
  465. outfitbtn.MouseButton1Click:connect(function()
  466. outfit = (outfit+1)%(#outfits+1)
  467. setOutfit()
  468. end)
  469. local sparklebtn = Instance.new("TextButton",fr)
  470. sparklebtn.Position = UDim2.new(1,-100,0,-15)
  471. sparklebtn.Size = UDim2.new(0,100,0,14)
  472. sparklebtn.BackgroundColor3 = Color3.new(0,1,0)
  473. sparklebtn.BackgroundTransparency = .6
  474. sparklebtn.TextScaled = true
  475. sparklebtn.Font = 4
  476. sparklebtn.TextColor3 = Color3.new(1,1,1)
  477. sparklebtn.TextStrokeTransparency = .7
  478. sparklebtn.Text = "Sparkles"
  479. sparklebtn.MouseButton1Click:connect(function()
  480. senabled = not senabled
  481. sparklebtn.BackgroundColor3 = senabled and Color3.new(0,1,0) or Color3.new(1,0,0)
  482. end)
  483. local lightbtn = Instance.new("TextButton",fr)
  484. lightbtn.Position = UDim2.new(1,-100,0,-30)
  485. lightbtn.Size = UDim2.new(0,100,0,14)
  486. lightbtn.BackgroundColor3 = Color3.new(0,1,0)
  487. lightbtn.BackgroundTransparency = .6
  488. lightbtn.TextScaled = true
  489. lightbtn.Font = 4
  490. lightbtn.TextColor3 = Color3.new(1,1,1)
  491. lightbtn.TextStrokeTransparency = .7
  492. lightbtn.Text = "Light"
  493. lightbtn.MouseButton1Click:connect(function()
  494. lenabled = not lenabled
  495. lightbtn.BackgroundColor3 = lenabled and Color3.new(0,1,0) or Color3.new(1,0,0)
  496. end)
  497. end
  498.  
  499. local gyro = root:FindFirstChild("RootGyro") or Instance.new("BodyGyro",root)
  500. gyro.maxTorque = Vector3.new()
  501. gyro.Name = "RootGyro"
  502. local vel = root:FindFirstChild("RootVel") or Instance.new("BodyVelocity",root)
  503. vel.maxForce = Vector3.new()
  504. vel.Name = "RootVel"
  505. vel.P = 4000
  506. local flying = false
  507. local state = "idle"
  508. local kd = {}
  509. local humspd = 0
  510. local flyspeed = 0
  511. local flystop = 0
  512. local sitting = false
  513. local holding = false
  514. m.KeyDown:connect(function(k)
  515. local now = tick()
  516. kd[k] = now
  517. if k == " " and not flying then
  518. pcall(function() sitting:Destroy() end)
  519. sitting = nil
  520. state = "fly"
  521. flying = true
  522. flydir = (root.CFrame.lookVector*Vector3.new(1,0,1)).unit
  523. elseif k == " " and state == "fly" then
  524. flying = false
  525. state = "idle"
  526. flystop = tick()
  527. elseif k == "x" and m.Target and (root.Position-m.Hit.p).magnitude < 20*modelScale then
  528. local tar = m.Target
  529. local cf = tar.CFrame:toObjectSpace(m.Hit)
  530. local siz = tar.Size/2
  531. local cfr
  532. local rx,ry,rz = 0,0,0
  533. local lv = tar.CFrame:vectorToObjectSpace(root.CFrame.lookVector)
  534. if math.abs(cf.Y-siz.Y) < .03 then
  535. cfr = CFrame.new(cf.p + Vector3.new(0,3*modelScale,0)) * CFrame.Angles(0,math.atan2(-lv.X,-lv.Z),0)
  536. elseif math.abs(-cf.Y-siz.Y) < .03 then
  537. cfr = CFrame.new(cf.p - Vector3.new(0,3*modelScale,0)) * CFrame.Angles(0,math.atan2(-lv.X,-lv.Z),math.pi)
  538. elseif math.abs(cf.X-siz.X) < .03 then
  539. cfr = CFrame.new(cf.p + Vector3.new(3*modelScale,0,0)) * CFrame.Angles(0,0,-math.pi/2) * CFrame.Angles(0,math.atan2(-lv.X,-lv.Z),0)
  540. elseif math.abs(-cf.X-siz.X) < .03 then
  541. cfr = CFrame.new(cf.p - Vector3.new(3*modelScale,0,0)) * CFrame.Angles(0,0,math.pi/2) * CFrame.Angles(0,math.atan2(-lv.X,-lv.Z),0)
  542. elseif math.abs(cf.Z-siz.Z) < .03 then
  543. cfr = CFrame.new(cf.p + Vector3.new(0,0,3*modelScale)) * CFrame.Angles(math.pi/2,0,0) * CFrame.Angles(0,math.atan2(-lv.X,-lv.Z),0)
  544. elseif math.abs(-cf.Z-siz.Z) < .03 then
  545. cfr = CFrame.new(cf.p - Vector3.new(0,0,3*modelScale)) * CFrame.Angles(-math.pi/2,0,0) * CFrame.Angles(0,math.atan2(-lv.X,-lv.Z),0)
  546. end
  547. if cfr then
  548. pcall(function() sitting:Destroy() end)
  549. flying = false
  550. state = "sit"
  551. if m.Target.Anchored then
  552. sitting = {tar = tar, cf = cfr}
  553. else
  554. sitting = weld(tar,root,cfr)
  555. end
  556. end
  557. end
  558. end)
  559. m.KeyUp:connect(function(k)
  560. kd[k] = nil
  561. end)
  562. hum.Running:connect(function(spd)
  563. if state ~= "idle" and state ~= "walk" and state ~= "inair" then return end
  564. humspd = spd
  565. state = flying and "fly" or (spd < 1 and "idle" or "walk")
  566. end)
  567. hum.Climbing:connect(function(spd)
  568. if state ~= "idle" and state ~= "walk" and state ~= "inair" then return end
  569. humspd = spd
  570. state = flying and "fly" or (spd < 1 and "idle" or "walk")
  571. end)
  572. hum.Seated:connect(function(a)
  573. state = a and "sit" or humspd > 0 and "idle" or "walk"
  574. end)
  575. hum.Changed:connect(function()
  576. if hum.Jump then
  577. hum.Jump = false
  578. end
  579. end)
  580. hum.FreeFalling:connect(function()
  581. if state ~= "idle" and state ~= "walk" and state ~= "inair" then return end
  582. state = math.abs(tor.Velocity.Y) > 1 and "inair" or state
  583. end)
  584. hum.FallingDown:connect(function(a)
  585. if not a then return end
  586. state = "inair"
  587. end)
  588.  
  589. while true do
  590. runservice.RenderStepped:wait()
  591. local cam = workspace.CurrentCamera
  592. local alpha = .2
  593. sparkles.Enabled = senabled and flying and tor.Velocity.magnitude > 3
  594. pl.Enabled = lenabled
  595. if state ~= "fly" then
  596. if type(sitting) == "table" then
  597. gyro.maxTorque = Vector3.new(1,1,1)*4e6
  598. vel.maxForce = Vector3.new(1,1,1)*4e5
  599. gyro.cframe = sitting.tar.CFrame * sitting.cf
  600. vel.velocity = (gyro.cframe.p-root.Position)*10
  601. else
  602. gyro.maxTorque,vel.maxForce = Vector3.new(),Vector3.new()
  603. end
  604. end
  605. if sitting then
  606. state = "sit"
  607. end
  608. tw.MaxVelocity,rh.MaxVelocity,lh.MaxVelocity,rs.MaxVelocity,ls.MaxVelocity,nk.MaxVelocity = 0,0,0,0,0,0
  609. tw.CurrentAngle,rh.CurrentAngle,lh.CurrentAngle,rs.CurrentAngle,ls.CurrentAngle,nk.CurrentAngle = 0,0,0,0,0,0
  610. local hasRobe = outfit == 1
  611. if state == "idle" then
  612. hum.PlatformStand = false
  613. local breathing = math.sin(tick()*2)
  614. local tilt = .02 + breathing*.03
  615. w1.C0 = clerp(w1.C0,w10*CFrame.Angles(0,-.01+breathing*.01,0),alpha)
  616. w2.C0 = clerp(w2.C0,w20*CFrame.Angles(0,.01-breathing*.01,0),alpha)
  617. tw.C0 = clerp(tw.C0,c0.tw*CFrame.Angles(tilt,0,0),alpha)
  618. rh.C0 = clerp(rh.C0,c0.rh*CFrame.Angles(-tilt,hasRobe and 0 or -.1,hasRobe and 0 or .06),alpha)
  619. lh.C0 = clerp(lh.C0,c0.lh*CFrame.Angles(-tilt,hasRobe and 0 or .1,hasRobe and 0 or -.06),alpha)
  620. rs.C0 = clerp(rs.C0,c0.rs*CFrame.Angles(-tilt,0,.1),alpha)
  621. ls.C0 = clerp(ls.C0,c0.ls*CFrame.Angles(-tilt,0,-.1),alpha)
  622. nk.C0 = clerp(nk.C0,c0.nk*CFrame.Angles(-tilt+breathing*.05-.03,0,0),alpha)
  623. elseif state == "inair" then
  624. hum.PlatformStand = false
  625. local wings = math.sin(tick()*80)
  626. w1.C0 = clerp(w1.C0,w10*CFrame.Angles(0,-.15+wings*.3,0),.6)
  627. w2.C0 = clerp(w2.C0,w20*CFrame.Angles(0,.15-wings*.3,0),.6)
  628. local alpha = .15
  629. local tilt = .05
  630. local wavey = math.sin(tick()*3)
  631. tw.C0 = clerp(tw.C0,c0.tw*CFrame.Angles(tilt,0,0),alpha)
  632. rh.C0 = clerp(rh.C0,c0.rh*CFrame.Angles(-tilt+wavey*.1,0,hasRobe and 0 or .02),alpha)
  633. lh.C0 = clerp(lh.C0,c0.lh*CFrame.Angles(-tilt-wavey*.1,0,hasRobe and 0 or -.02),alpha)
  634. rs.C0 = clerp(rs.C0,c0.rs*CFrame.Angles(-tilt-wavey*.07,0,.01),alpha)
  635. ls.C0 = clerp(ls.C0,c0.ls*CFrame.Angles(-tilt+wavey*.07,0,-.01),alpha)
  636. nk.C0 = clerp(nk.C0,c0.nk*CFrame.Angles(-tilt+.2,0,0),alpha)
  637. elseif state == "walk" then
  638. hum.PlatformStand = false
  639. local walking = math.sin(tick()*25)
  640. local breathing = math.sin(tick()*2)
  641. local tilt = -.03-breathing*.02+walking*.01
  642. alpha = .6
  643. w1.C0 = clerp(w1.C0,w10*CFrame.Angles(0,-.05+breathing*.01+walking*.05,0),alpha)
  644. w2.C0 = clerp(w2.C0,w20*CFrame.Angles(0,.05-breathing*.01+walking*.05,0),alpha)
  645. tw.C0 = clerp(tw.C0,c0.tw*CFrame.Angles(tilt,-walking*.08,0),alpha)
  646. rh.C0 = clerp(rh.C0,c0.rh*CFrame.Angles(-tilt+walking*.3,0,hasRobe and 0 or .02),alpha)
  647. lh.C0 = clerp(lh.C0,c0.lh*CFrame.Angles(-tilt-walking*.3,0,hasRobe and 0 or -.02),alpha)
  648. rs.C0 = clerp(rs.C0,c0.rs*CFrame.Angles(-tilt+.05-walking*.25,0,.01),alpha)
  649. ls.C0 = clerp(ls.C0,c0.ls*CFrame.Angles(-tilt+.05+walking*.25,0,-.01),alpha)
  650. nk.C0 = clerp(nk.C0,c0.nk*CFrame.Angles(-tilt+breathing*.04,walking*.07,0),alpha)
  651. elseif state == "sit" then
  652. hum.Sit = false
  653. hum.PlatformStand = true
  654. local breathing = math.sin(tick()*2)
  655. local upvec = root.CFrame:vectorToWorldSpace(Vector3.new(0,1,0))
  656. if upvec.Y > .4 then
  657. local tilt = -.55+breathing*.015
  658. w1.C0 = clerp(w1.C0,w10*CFrame.Angles(0,-.01+breathing*.01,0),alpha)
  659. w2.C0 = clerp(w2.C0,w20*CFrame.Angles(0,.01-breathing*.01,0),alpha)
  660. tw.C0 = clerp(tw.C0,c0.tw*CFrame.Angles(tilt,0,0)+Vector3.new(0,-1.7,0)*modelScale,alpha)
  661. rh.C0 = clerp(rh.C0,c0.rh*CFrame.Angles(-tilt+1.57,0,hasRobe and 0 or .6),alpha)
  662. lh.C0 = clerp(lh.C0,c0.lh*CFrame.Angles(-tilt+1.57,0,hasRobe and 0 or -.6),alpha)
  663. rs.C0 = clerp(rs.C0,c0.rs*CFrame.Angles(-tilt+.3,0,-.1)*CFrame.Angles(hasRobe and .3 or 0,hasRobe and .2 or 0,hasRobe and -.2 or 0)+(hasRobe and 0 or 1)*Vector3.new(-.85,-.25,-.25)*modelScale,alpha)
  664. ls.C0 = clerp(ls.C0,c0.ls*CFrame.Angles(-tilt+.3,0,.1)*CFrame.Angles(hasRobe and .3 or 0,hasRobe and -.2 or 0,hasRobe and .2 or 0)+(hasRobe and 0 or 1)*Vector3.new(.85,-.25,-.25)*modelScale,alpha)
  665. nk.C0 = clerp(nk.C0,c0.nk*CFrame.Angles(-tilt+breathing*.04-.03,0,math.sin(tick()*4)*.06),alpha)
  666. else -- wallhug
  667. local breathing = math.sin(tick()*5)
  668. local tilt = -1.55+breathing*.015
  669. w1.C0 = clerp(w1.C0,w10*CFrame.Angles(0,-.01+breathing*.01,0),alpha)
  670. w2.C0 = clerp(w2.C0,w20*CFrame.Angles(0,.01-breathing*.01,0),alpha)
  671. tw.C0 = clerp(tw.C0,c0.tw*CFrame.Angles(tilt,0,0)+Vector3.new(0,-2.5,0)*modelScale,alpha)
  672. rh.C0 = clerp(rh.C0,c0.rh*CFrame.Angles(.2,0,hasRobe and 0 or .5)+Vector3.new(0,hasRobe and 0 or .2,0)*modelScale,alpha)
  673. lh.C0 = clerp(lh.C0,c0.lh*CFrame.Angles(.2,0,hasRobe and 0 or -.5)+Vector3.new(0,hasRobe and 0 or .2,0)*modelScale,alpha)
  674. rs.C0 = clerp(rs.C0,c0.rs*CFrame.Angles(2.9,0,.8)+Vector3.new(-.2,.4,0)*modelScale,alpha)
  675. ls.C0 = clerp(ls.C0,c0.ls*CFrame.Angles(2.9,0,-.8)+Vector3.new(.2,.4,0)*modelScale,alpha)
  676. nk.C0 = clerp(nk.C0,c0.nk*CFrame.Angles(breathing*.04+.7,0,0),alpha)
  677. end
  678. elseif state == "fly" then
  679. hum.PlatformStand = true
  680. gyro.maxTorque = Vector3.new(1,1,1)*4e6
  681. vel.maxForce = Vector3.new(1,1,1)*4e5
  682. local velocity = Vector3.new((kd.d and 1 or 0)+(kd.a and -1 or 0),0,(kd.s and 1 or 0)+(kd.w and -1 or 0))
  683. velocity = cam.CoordinateFrame:vectorToWorldSpace(velocity)
  684. local maxspeed = 40-(velocity.magnitude > 0 and velocity.unit.Y*20 or 0)
  685. if velocity.magnitude > 0 then
  686. flyspeed = lerp(flyspeed,maxspeed,.1)
  687. flydir = flydir:Lerp(velocity.unit,.4).unit
  688. hoverheight = nil
  689. else
  690. flyspeed = lerp(flyspeed,0,.3)
  691. flydir = (flydir*Vector3.new(1,0,1)).unit
  692. hoverheight = hoverheight or root.Position.Y
  693. end
  694. vel.velocity = flydir.unit * flyspeed
  695. if hoverheight then
  696. vel.velocity = vel.velocity + Vector3.new(0,hoverheight-root.Position.Y,0)
  697. end
  698. gyro.cframe = CFrame.new(Vector3.new(),flydir*Vector3.new(1,0,1))
  699. rl.CanCollide,ll.CanCollide = true,true
  700. local wings = math.sin(tick()*80)
  701. w1.C0 = clerp(w1.C0,w10*CFrame.Angles(0,-.15+wings*.3,0),.6)
  702. w2.C0 = clerp(w2.C0,w20*CFrame.Angles(0,.15-wings*.3,0),.6)
  703. local alpha = .15
  704. local flytilt = (flyspeed/maxspeed)
  705. local tilt = flytilt*-1.4 + math.asin(gyro.cframe:vectorToObjectSpace(flydir).unit.Y)
  706. local wavey = math.sin(tick()*6)
  707. tw.C0 = clerp(tw.C0,c0.tw*CFrame.Angles(tilt,0,0),alpha)
  708. rh.C0 = clerp(rh.C0,c0.rh*CFrame.Angles(wavey*.1,hasRobe and 0 or -.08,hasRobe and 0 or .1),alpha)
  709. lh.C0 = clerp(lh.C0,c0.lh*CFrame.Angles(-wavey*.1,hasRobe and 0 or .08,hasRobe and 0 or -.1),alpha)
  710. rs.C0 = clerp(rs.C0,c0.rs*CFrame.Angles(-wavey*.15,-.08,.1),alpha)
  711. ls.C0 = clerp(ls.C0,c0.ls*CFrame.Angles(wavey*.15,.08,-.1),alpha)
  712. nk.C0 = clerp(nk.C0,c0.nk*CFrame.Angles(-tilt*.8,0,0),alpha)
  713. end
  714. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement