Advertisement
PegarTodos

FE 1

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