Advertisement
lafur

Untitled

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