Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- script.Parent = nil
- function fly()
- for i,v in pairs(script:GetChildren()) do
- pcall(function() v.Value = "" end)
- game:GetService("Debris"):AddItem(v,.1)
- end
- function weld(p0,p1,c0,c1,par)
- local w = Instance.new("Weld",p0 or par)
- w.Part0 = p0
- w.Part1 = p1
- w.C0 = c0 or CFrame.new()
- w.C1 = c1 or CFrame.new()
- return w
- end
- local motors = {}
- function motor(p0,p1,c0,c1,des,vel,par)
- local w = Instance.new("Motor6D",p0 or par)
- w.Part0 = p0
- w.Part1 = p1
- w.C0 = c0 or CFrame.new()
- w.C1 = c1 or CFrame.new()
- w.MaxVelocity = tonumber(vel) or .05
- w.DesiredAngle = tonumber(des) or 0
- return w
- end
- function lerp(a,b,c)
- return a+(b-a)*c
- end
- function clerp(c1,c2,al)
- local com1 = {c1.X,c1.Y,c1.Z,c1:toEulerAnglesXYZ()}
- local com2 = {c2.X,c2.Y,c2.Z,c2:toEulerAnglesXYZ()}
- for i,v in pairs(com1) do
- com1[i] = lerp(v,com2[i],al)
- end
- return CFrame.new(com1[1],com1[2],com1[3]) * CFrame.Angles(select(4,unpack(com1)))
- end
- function ccomplerp(c1,c2,al)
- local com1 = {c1:components()}
- local com2 = {c2:components()}
- for i,v in pairs(com1) do
- com1[i] = lerp(v,com2[i],al)
- end
- return CFrame.new(unpack(com1))
- end
- function tickwave(time,length,offset)
- return (math.abs((tick()+(offset or 0))%time-time/2)*2-time/2)/time/2*length
- end
- function invcol(c)
- c = c.Color
- return BrickColor.new(Color3.new(1-c.b,1-c.g,1-c.r))
- end
- local oc = oc or function(...) return ... end
- local plr = game.Players.LocalPlayer
- local char = plr.Character
- local tor = char.Torso
- local hum = char.Humanoid
- hum.PlatformStand = false
- pcall(function()
- char.Wings:Destroy()
- end)
- pcall(function()
- char.Angel:Destroy() -- hat
- end)
- local mod = Instance.new("Model",char)
- mod.Name = "Wings"
- local special = {
- --antiboomz0r = {"Really black","Institutional white",0,0,false,Color3.new(1,1,.95),Color3.new(1,1,.6)},
- antiboomz0r = {"New Yeller",nil,0.4,0.7,true,Color3.new(1,1,.95),Color3.new(1,1,.6)},
- --antiboomz0r = {"Cyan","Toothpaste",0,0,false,Color3.new(1,0,0),Color3.new(0,0,0)},
- taart = {"Royal purple",nil,.4,.4,true},
- mitta = {"Black",nil,0,0,false},
- penjuin3 = {"White",nil,0,0,false},
- thepc8110 = {"Black","Bright red",.5,0,false,Color3.new(1,0,0),Color3.new(0,0,0)},
- nonspeaker = {"Cyan","Toothpaste",0,0,false,Color3.new(1,0,0),Color3.new(0,0,0)},
- littleau999 = {"Reddish brown",1030,0,0,false},
- SmokeDelsin = {"Really black","Really black",.2,0,true,Color3.new(0,0,0),Color3.new(0,0,0)},
- SmokeDelsin = {"White","Really black",.2,0,false,Color3.new(0,0,0),Color3.new(0,0,0)},
- SmokeDelsin = {"Really black",nil,0,0,tre},
- }
- local topcolor = char.Torso.BrickColor
- local feacolor = char.Torso.BrickColor
- local ptrans = 0
- local pref = 0
- local fire = false
- local fmcol = Color3.new()
- local fscol = Color3.new()
- local spec = special[plr.Name:lower()]
- if spec then
- topcolor,feacolor,ptrans,pref,fire,fmcol,fscol = spec[1] and BrickColor.new(spec[1]) or topcolor,spec[2] and BrickColor.new(spec[2]) or feacolor,spec[3],spec[4],spec[5],spec[6],spec[7]
- end
- local part = Instance.new("Part")
- part.FormFactor = "Custom"
- part.Size = Vector3.new(.2,.2,.2)
- part.TopSurface,part.BottomSurface = 0,0
- part.CanCollide = false
- part.BrickColor = topcolor
- part.Transparency = ptrans
- part.Reflectance = pref
- local ef = Instance.new("Fire",fire and part or nil)
- ef.Size = .15
- ef.Color = fmcol or Color3.new()
- ef.SecondaryColor = fscol or Color3.new()
- part:BreakJoints()
- function newpart()
- local clone = part:Clone()
- clone.Parent = mod
- clone:BreakJoints()
- return clone
- end
- local feath = newpart()
- feath.BrickColor = feacolor
- feath.Transparency = 0
- Instance.new("SpecialMesh",feath).MeshType = "Sphere"
- function newfeather()
- local clone = feath:Clone()
- clone.Parent = mod
- clone:BreakJoints()
- return clone
- end
- ---------- RIGHT WING
- local r1 = newpart()
- r1.Size = Vector3.new(.3,1.5,.3)*1.2
- local rm1 = motor(tor,r1,CFrame.new(.35,.6,.4) * CFrame.Angles(0,0,math.rad(-60)) * CFrame.Angles(math.rad(30),math.rad(-25),0),CFrame.new(0,-.8,0),.1)
- local r2 = newpart()
- r2.Size = Vector3.new(.4,1.8,.4)*1.2
- local rm2 = motor(r1,r2,CFrame.new(0,.75,0) * CFrame.Angles(0,0,math.rad(50)) * CFrame.Angles(math.rad(-30),math.rad(15),0),CFrame.new(0,-.9,0),.1)
- local r3 = newpart()
- r3.Size = Vector3.new(.3,2.2,.3)*1.2
- local rm3 = motor(r2,r3,CFrame.new(.1,.9,0) * CFrame.Angles(0,0,math.rad(-140)) * CFrame.Angles(math.rad(-3),0,0),CFrame.new(0,-1.1,0),.1)
- local r4 = newpart()
- r4.Size = Vector3.new(.25,1.2,.25)*1.2
- local rm4 = motor(r3,r4,CFrame.new(0,1.1,0) * CFrame.Angles(0,0,math.rad(-10)) * CFrame.Angles(math.rad(-3),0,0),CFrame.new(0,-.6,0),.1)
- local feather = newfeather()
- feather.Mesh.Scale = Vector3.new(1,1,1)
- feather.Size = Vector3.new(.4,3,.3)
- weld(r4,feather,CFrame.new(-.1,-.3,0),CFrame.new(0,-1.5,0))
- feather = newfeather()
- feather.Mesh.Scale = Vector3.new(1,1,1)
- feather.Size = Vector3.new(.4,2.3,.3)
- weld(r4,feather,CFrame.new(.1,-.1,0) * CFrame.Angles(0,math.random()*.1,0),CFrame.new(0,-1.1,0))
- feather = newfeather()
- feather.Mesh.Scale = Vector3.new(1,1,1)
- feather.Size = Vector3.new(.35,2.2,.25)
- weld(r4,feather,CFrame.new(.1,-.3,0) * CFrame.Angles(0,math.random()*.1,math.rad(-10)),CFrame.new(0,-1.1,0))
- local rf3 = {}
- for i=0,7 do
- feather = newfeather()
- feather.Mesh.Scale = Vector3.new(1,1,1)
- feather.Size = Vector3.new(.45,2.2,.35)
- table.insert(rf3,motor(r3,feather,CFrame.new(.05,1-i*.285,0) * CFrame.Angles(0,math.random()*.1,math.rad(-25-i*2)),CFrame.new(0,-feather.Size.Y/2,0)))
- end
- local rf2 = {}
- for i=0,6 do
- feather = newfeather()
- feather.Mesh.Scale = Vector3.new(1,1,1)
- feather.Size = Vector3.new(.45,2.2-i*.08,.3)
- table.insert(rf2,motor(r2,feather,CFrame.new(.05,.75-i*.26,0) * CFrame.Angles(0,math.random()*.1,math.rad(-75-i*4)),CFrame.new(0,-feather.Size.Y/2,0)))
- end
- local rf1 = {}
- for i=0,6 do
- feather = newfeather()
- feather.Mesh.Scale = Vector3.new(1,1,1)
- feather.Size = Vector3.new(.37,1.65-i*.06,.25)
- table.insert(rf1,motor(r1,feather,CFrame.new(.05,.63-i*.21,0) * CFrame.Angles(0,math.random()*.05,math.rad(-75)),CFrame.new(0,-feather.Size.Y/2,0)))
- end
- ---------- LEFT WING
- local l1 = newpart()
- l1.Size = Vector3.new(.3,1.5,.3)*1.2
- local lm1 = motor(tor,l1,CFrame.new(-.35,.6,.4) * CFrame.Angles(0,0,math.rad(60)) * CFrame.Angles(math.rad(30),math.rad(25),0) * CFrame.Angles(0,-math.pi,0),CFrame.new(0,-.8,0) ,.1)
- local l2 = newpart()
- l2.Size = Vector3.new(.4,1.8,.4)*1.2
- local lm2 = motor(l1,l2,CFrame.new(0,.75,0) * CFrame.Angles(0,0,math.rad(50)) * CFrame.Angles(math.rad(30),math.rad(-15),0),CFrame.new(0,-.9,0),.1)
- local l3 = newpart()
- l3.Size = Vector3.new(.3,2.2,.3)*1.2
- local lm3 = motor(l2,l3,CFrame.new(.1,.9,0) * CFrame.Angles(0,0,math.rad(-140)) * CFrame.Angles(math.rad(3),0,0),CFrame.new(0,-1.1,0),.1)
- local l4 = newpart()
- l4.Size = Vector3.new(.25,1.2,.25)*1.2
- local lm4 = motor(l3,l4,CFrame.new(0,1.1,0) * CFrame.Angles(0,0,math.rad(-10)) * CFrame.Angles(math.rad(3),0,0),CFrame.new(0,-.6,0),.1)
- local feather = newfeather()
- feather.Mesh.Scale = Vector3.new(1,1,1)
- feather.Size = Vector3.new(.4,3,.3)
- weld(l4,feather,CFrame.new(-.1,-.3,0),CFrame.new(0,-1.5,0))
- feather = newfeather()
- feather.Mesh.Scale = Vector3.new(1,1,1)
- feather.Size = Vector3.new(.4,2.3,.3)
- weld(l4,feather,CFrame.new(.1,-.1,0) * CFrame.Angles(0,math.random()*.1,0),CFrame.new(0,-1.1,0))
- feather = newfeather()
- feather.Mesh.Scale = Vector3.new(1,1,1)
- feather.Size = Vector3.new(.35,2.2,.25)
- weld(l4,feather,CFrame.new(.1,-.3,0) * CFrame.Angles(0,math.random()*.1,math.rad(-10)),CFrame.new(0,-1.1,0))
- local lf3 = {}
- for i=0,7 do
- feather = newfeather()
- feather.Mesh.Scale = Vector3.new(1,1,1)
- feather.Size = Vector3.new(.45,2.2,.35)
- table.insert(lf3,motor(l3,feather,CFrame.new(.05,1-i*.285,0) * CFrame.Angles(0,math.random()*.1,math.rad(-25-i*2)),CFrame.new(0,-feather.Size.Y/2,0)))
- end
- local lf2 = {}
- for i=0,6 do
- feather = newfeather()
- feather.Mesh.Scale = Vector3.new(1,1,1)
- feather.Size = Vector3.new(.45,2.2-i*.08,.3)
- table.insert(lf2,motor(l2,feather,CFrame.new(.05,.75-i*.26,0) * CFrame.Angles(0,math.random()*.1,math.rad(-75-i*4)),CFrame.new(0,-feather.Size.Y/2,0)))
- end
- local lf1 = {}
- for i=0,6 do
- feather = newfeather()
- feather.Mesh.Scale = Vector3.new(1,1,1)
- feather.Size = Vector3.new(.37,1.65-i*.06,.25)
- table.insert(lf1,motor(l1,feather,CFrame.new(.05,.63-i*.21,0) * CFrame.Angles(0,math.random()*.05,math.rad(-75)),CFrame.new(0,-feather.Size.Y/2,0)))
- end
- local rwing = {rm1,rm2,rm3,rm4}
- local lwing = {lm1,lm2,lm3,lm4}
- local oc0 = {}
- for i,v in pairs(rwing) do
- oc0[v] = v.C0
- end
- for i,v in pairs(lwing) do
- oc0[v] = v.C0
- end
- function gotResized()
- if lastsize then
- if tor.Size == lastsize then return end -- This shouldn't happen?
- local scaleVec = tor.Size/lastsize
- for i,v in pairs(oc0) do
- oc0[i] = v-v.p+scaleVec*v.p
- end
- lastsize = tor.Size
- end
- lastsize = tor.Size
- end
- tor.Changed:connect(function(p)
- if p == "Size" then
- gotResized()
- end
- end)
- gotResized()
- local idle = {0,0.5,-.2,0; .05,.05,.1,.05; -.6,-1.5,.1,0;}--0,.3,0,0
- local outlow = {-.7,-.2,1.8,0; .3,.05,.1,.05; .2,0,0,0}
- local outhigh = {.5,-.2,1.8,0; .3,.05,.1,.05; .2,0,0,0}
- local veryhigh = {.9,-.3,1.9,0; .3,.05,.1,.05; .2,0,0,0}
- local flap1 = {-.3,.3,1.1,-.2; .3,.05,.1,.05; .2,-.6,0,0}
- local divebomb = {0,.2,.4,-.7; .3,.05,.1,.05; 0,-.5,-.6,0}
- function setwings(tab,time)
- time = time or 10
- for i=1,4 do
- rwing[i].DesiredAngle = tab[i]
- lwing[i].DesiredAngle = tab[i]
- rwing[i].MaxVelocity = math.abs(tab[i]-rwing[i].CurrentAngle)/time
- lwing[i].MaxVelocity = math.abs(tab[i]-lwing[i].CurrentAngle)/time
- local rcf = oc0[rwing[i]] * (tab[12+i] or CFrame.new())
- local lcf = oc0[lwing[i]] * (tab[12+i] or CFrame.new())
- end
- for i,v in pairs(rf1) do
- v.DesiredAngle = tab[9]
- v.MaxVelocity = math.abs(v.DesiredAngle-v.CurrentAngle)/time
- end
- for i,v in pairs(lf1) do
- v.DesiredAngle = tab[9]
- v.MaxVelocity = math.abs(v.DesiredAngle-v.CurrentAngle)/time
- end
- for i,v in pairs(rf2) do
- v.DesiredAngle = tab[10]
- v.MaxVelocity = math.abs(v.DesiredAngle-v.CurrentAngle)/time
- end
- for i,v in pairs(lf2) do
- v.DesiredAngle = tab[10]
- v.MaxVelocity = math.abs(v.DesiredAngle-v.CurrentAngle)/time
- end
- for i,v in pairs(rf3) do
- v.DesiredAngle = tab[11]
- v.MaxVelocity = math.abs(v.DesiredAngle-v.CurrentAngle)/time
- end
- for i,v in pairs(lf3) do
- v.DesiredAngle = tab[11]
- v.MaxVelocity = math.abs(v.DesiredAngle-v.CurrentAngle)/time
- end
- end
- setwings(outhigh,1)
- flying = false
- moving = false
- for i,v in pairs(tor:GetChildren()) do
- if v.ClassName:lower():match("body") then
- v:Destroy()
- end
- end
- local ctor = tor:Clone()
- ctor:ClearAllChildren()
- ctor.Name = "cTorso"
- ctor.Transparency = 1
- ctor.CanCollide = false
- ctor.FormFactor = "Custom"
- ctor.Size = Vector3.new(.2,.2,.2)
- ctor.Parent = mod
- weld(tor,ctor)
- local bg = Instance.new("BodyGyro",ctor)
- bg.maxTorque = Vector3.new()
- bg.P = 15000
- bg.D = 1000
- local bv = Instance.new("BodyVelocity",ctor)
- bv.maxForce = Vector3.new()
- bv.P = 15000
- vel = Vector3.new()
- cf = CFrame.new()
- flspd = 0
- keysdown = {}
- keypressed = {}
- ktime = {}
- descendtimer = 0
- jumptime = tick()
- hum.Jumping:connect(function()
- jumptime = tick()
- end)
- cam = workspace.CurrentCamera
- kd = plr:GetMouse().KeyDown:connect(oc(function(key)
- keysdown[key] = true
- keypressed[key] = true
- if key == "q" then
- descendtimer = tick()
- elseif key == " " and not hum.Jump then
- jumptime = tick()
- elseif (key == "a" or key == "d") and ktime[key] and tick()-ktime[key] < .3 and math.abs(reqrotx) < .3 then
- reqrotx = key == "a" and math.pi*2 or -math.pi*2
- end
- ktime[key] = tick()
- end))
- ku = plr:GetMouse().KeyUp:connect(function(key)
- keysdown[key] = false
- if key == " " then
- descendtimer = tick()
- end
- end)
- function mid(a,b,c)
- return math.max(a,math.min(b,c or -a))
- end
- function bn(a)
- return a and 1 or 0
- end
- function gm(tar)
- local m = 0
- for i,v in pairs(tar:GetChildren()) do
- if v:IsA("BasePart") then
- m = m + v:GetMass()
- end
- m = m + gm(v)
- end
- return m
- end
- reqrotx = 0
- local grav = 196.2
- local con
- con = game:GetService("RunService").Stepped:connect(oc(function()
- --[[if not mod:IsDescendantOf(workspace) then
- pcall(function() kd:disconnect() end)
- pcall(function() ku:disconnect() end)
- bg:Destroy()
- bv:Destroy()
- con:disconnect()
- script:Destroy()
- return
- end]]
- local obvel = tor.CFrame:vectorToObjectSpace(tor.Velocity)
- local sspd, uspd,fspd = obvel.X,obvel.Y,obvel.Z
- if flying then
- local lfldir = fldir
- fldir = cam.CoordinateFrame:vectorToWorldSpace(Vector3.new(bn(keysdown.d)-bn(keysdown.a),0,bn(keysdown.s)-bn(keysdown.w))).unit
- local lmoving = moving
- moving = fldir.magnitude > .1
- if lmoving and not moving then
- idledir = lfldir*Vector3.new(1,0,1)
- descendtimer = tick()
- end
- local dbomb = fldir.Y < -.6 or (moving and keysdown["1"])
- if moving and keysdown["0"] and lmoving then
- fldir = (Vector3.new(lfldir.X,math.min(fldir.Y,lfldir.Y+.01)-.1,lfldir.Z)+(fldir*Vector3.new(1,0,1))*.05).unit
- end
- local down = tor.CFrame:vectorToWorldSpace(Vector3.new(0,-1,0))
- local descending = (not moving and keysdown["q"] and not keysdown[" "])
- cf = ccomplerp(cf,CFrame.new(tor.Position,tor.Position+(not moving and idledir or fldir)),keysdown["0"] and .02 or .07)
- local gdown = not dbomb and cf.lookVector.Y < -.2 and tor.Velocity.unit.Y < .05
- hum.PlatformStand = true
- bg.maxTorque = Vector3.new(1,1,1)*9e5
- local rotvel = CFrame.new(Vector3.new(),tor.Velocity):toObjectSpace(CFrame.new(Vector3.new(),fldir)).lookVector
- bg.cframe = cf * CFrame.Angles(not moving and -.1 or -math.pi/2+.2,moving and mid(-2.5,rotvel.X/1.5) + reqrotx or 0,0)
- reqrotx = reqrotx - reqrotx/10
- bv.maxForce = Vector3.new(1,1,1)*9e4*.5
- local anioff =(bn(keysdown[" "])-bn(keysdown["q"]))/2
- local ani = tickwave(1.5-anioff,1)
- bv.velocity = bv.velocity:Lerp(Vector3.new(0,bn(not moving)*-ani*15+(descending and math.min(20,tick()-descendtimer)*-8 or bn(keysdown[" "])-bn(keysdown["q"]))*15,0)+vel,.6)
- vel = moving and cf.lookVector*flspd or Vector3.new()
- flspd = math.min(120,lerp(flspd,moving and (fldir.Y<0 and flspd+(-fldir.Y)*grav/60 or math.max(50,flspd-fldir.Y*grav/300)) or 60,.4))
- setwings(moving and (gdown and outlow or dbomb and divebomb) or (descending and veryhigh or flap1),15)
- for i=1,4 do
- --CFrame.Angles(-.5+bn(i==3)*2.4+bn(i==4)*.5,.1+bn(i==2)*.5-bn(i==3)*1.1,bn(i==3)*.1)
- rwing[i].C0 = clerp(rwing[i].C0,oc0[rwing[i]] * (gdown and CFrame.new() or dbomb and CFrame.Angles(-.5+bn(i==3)*.4+bn(i==4)*.5,.1+bn(i==2)*.5-bn(i==3)*1.1,bn(i==3)*.1) or descending and CFrame.Angles(.3,0,0) or CFrame.Angles((i*.1+1.5)*ani,ani*-.5,1*ani)),descending and .8 or .2)
- lwing[i].C0 = clerp(lwing[i].C0,oc0[lwing[i]] * (gdown and CFrame.new() or dbomb and CFrame.Angles(-(-.5+bn(i==3)*.4+bn(i==4)*.5),-(.1+bn(i==2)*.5-bn(i==3)*1.1),bn(i==3)*.1) or descending and CFrame.Angles(-.3,0,0) or CFrame.Angles(-(i*.1+1.5)*ani,ani*.5,1*ani)),descending and .8 or .2)
- end
- local hit,ray = workspace:FindPartOnRayWithIgnoreList(Ray.new(tor.Position,Vector3.new(0,-3.5+math.min(0,bv.velocity.y)/30,0)),{char})
- if hit and down.Y < -.85 and tick()-flystart > 1 then
- flying = false
- hum.PlatformStand = false
- tor.Velocity = Vector3.new()
- end
- else
- bg.maxTorque = Vector3.new()
- bv.maxForce = Vector3.new()
- local ani = tickwave(walking and .8 or 4.5,1)
- setwings(idle,10)
- local x,y,z = fspd/160,uspd/700,sspd/900
- for i=1,4 do
- rwing[i].C0 = clerp(rwing[i].C0,oc0[rwing[i]] * CFrame.Angles(ani*.1 + -mid(-.1,x),0 + -mid(-.1,y) + bn(i==2)*.6,ani*.02 + -mid(-.1,z)),.2)
- lwing[i].C0 = clerp(lwing[i].C0,oc0[lwing[i]] * CFrame.Angles(ani*-.05 + mid(-.1,x),0 + mid(-.1,y) + -bn(i==2)*.6,ani*.02 + mid(-.1,z)),.2)
- end
- if keypressed[" "] and not flying and (tick()-jumptime > .05 and (tick()-jumptime < 3 or hum.Jump)) then
- vel = Vector3.new(0,50,0)
- bv.velocity = vel
- idledir = cam.CoordinateFrame.lookVector*Vector3.new(1,0,1)
- cf = tor.CFrame * CFrame.Angles(-.01,0,0)
- tor.CFrame = cf
- bg.cframe = cf
- flystart = tick()
- flying = true
- end
- end
- keypressed = {}
- end))
- end fly()
- local plr = game:service'Players'.LocalPlayer
- local m = plr:GetMouse()
- local char = plr.Character
- local runservice = game:service'RunService'
- local modelScale = 1/5
- pcall(function() local a = script.Parent.FaerieScript if a ~= script then a:Destroy() end end)
- pcall(function() local a = char.Animate if a ~= script then a.Disabled = true a:Destroy() end end)
- script.Name = "FaerieScript"
- function weld(a,b,c,d)
- local w = Instance.new("Weld",a)
- w.Part0 = a
- w.Part1 = b
- w.C0 = c or CFrame.new()
- w.C1 = d or CFrame.new()
- return w
- end
- function lerp(a,b,c)
- return a+(b-a)*c
- end
- do -- Ignore my clerp stuff stolen from stravvy
- local function QuaternionFromCFrame(cf)
- local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components()
- local trace = m00 + m11 + m22
- if trace > 0 then
- local s = math.sqrt(1 + trace)
- local recip = 0.5/s
- return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5
- else
- local i = 0
- if m11 > m00 then
- i = 1
- end
- if m22 > (i == 0 and m00 or m11) then
- i = 2
- end
- if i == 0 then
- local s = math.sqrt(m00-m11-m22+1)
- local recip = 0.5/s
- return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip
- elseif i == 1 then
- local s = math.sqrt(m11-m22-m00+1)
- local recip = 0.5/s
- return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip
- elseif i == 2 then
- local s = math.sqrt(m22-m00-m11+1)
- local recip = 0.5/s return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip
- end
- end
- end
- local function QuaternionToCFrame(px, py, pz, x, y, z, w)
- local xs, ys, zs = x + x, y + y, z + z
- local wx, wy, wz = w*xs, w*ys, w*zs
- local xx = x*xs
- local xy = x*ys
- local xz = x*zs
- local yy = y*ys
- local yz = y*zs
- local zz = z*zs
- 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))
- end
- local function QuaternionSlerp(a, b, t)
- local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4]
- local startInterp, finishInterp;
- if cosTheta >= 0.0001 then
- if (1 - cosTheta) > 0.0001 then
- local theta = math.acos(cosTheta)
- local invSinTheta = 1/math.sin(theta)
- startInterp = math.sin((1-t)*theta)*invSinTheta
- finishInterp = math.sin(t*theta)*invSinTheta
- else
- startInterp = 1-t
- finishInterp = t
- end
- else
- if (1+cosTheta) > 0.0001 then
- local theta = math.acos(-cosTheta)
- local invSinTheta = 1/math.sin(theta)
- startInterp = math.sin((t-1)*theta)*invSinTheta
- finishInterp = math.sin(t*theta)*invSinTheta
- else
- startInterp = t-1
- finishInterp = t
- end
- end
- 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
- end
- function clerp(a,b,t)
- local qa = {QuaternionFromCFrame(a)}
- local qb = {QuaternionFromCFrame(b)}
- local ax, ay, az = a.x, a.y, a.z
- local bx, by, bz = b.x, b.y, b.z
- local _t = 1-t
- return QuaternionToCFrame(_t*ax + t*bx, _t*ay + t*by, _t*az + t*bz,QuaternionSlerp(qa, qb, t))
- end
- end
- Instance.new("Hat",char)
- local root = char.HumanoidRootPart
- local tw = root.RootJoint
- local tor = char.Torso
- local hd = char.Head
- local hum = char.Humanoid
- hum.Health = 40
- hum.MaxHealth = 40
- hum.WalkSpeed = 12
- local rl,ll = char["Right Leg"],char["Left Leg"]
- local ra,la = char["Right Arm"],char["Left Arm"]
- local c0 = {
- rs = CFrame.new(1,.5,0),
- ls = CFrame.new(-1,.5,0),
- rh = CFrame.new(.5,-1,0),
- lh = CFrame.new(-.5,-1,0),
- nk = CFrame.new(0,1,0),
- tw = CFrame.new(0,0,0)*CFrame.Angles(0,0,0),
- }
- local c1 = {
- rs = CFrame.new(-.5,.5,0),
- ls = CFrame.new(.5,.5,0),
- rh = CFrame.new(0,1,0),
- lh = CFrame.new(0,1,0),
- nk = CFrame.new(0,-.5,0),
- tw = CFrame.new(0,0,0)*CFrame.Angles(0,0,0)
- }
- local rs = tor["Right Shoulder"]
- local ls = tor["Left Shoulder"]
- local rh = tor["Right Hip"]
- local lh = tor["Left Hip"]
- local nk = tor["Neck"]
- for i,v in pairs(tor:GetChildren()) do
- if v:IsA("Motor6D") then
- v.DesiredAngle = 0
- v.MaxVelocity = 0
- v.CurrentAngle = 0
- end
- end
- pcall(function() tor.roblox:Destroy() end)
- pcall(function() char.Faerie:Destroy() end)
- local model = Instance.new("Model",char)
- model.Name = "Faerie"
- local BasePart = Instance.new("Part")
- BasePart.CanCollide = false
- BasePart.Anchored = false
- BasePart.FormFactor = "Custom"
- BasePart.Locked = true
- BasePart.Size = Vector3.new()
- BasePart.TopSurface,BasePart.BottomSurface,BasePart.LeftSurface,BasePart.RightSurface,BasePart.FrontSurface,BasePart.BackSurface = 10,10,10,10,10,10
- BasePart:BreakJoints()
- function NP(par)
- local p = BasePart:Clone()
- p.Parent = par or model
- return p
- end
- for i,v in pairs(char:GetChildren()) do
- if v:IsA("BasePart") then
- v.Material = "SmoothPlastic"
- v.TopSurface,v.BottomSurface,v.FrontSurface,v.BackSurface,v.LeftSurface,v.RightSurface = 10,10,10,10,10,10
- end
- end
- do
- if modelScale ~= 1 then
- for i,v in pairs(c0) do
- c0[i] = (v-v.p) + v.p*modelScale
- end
- for i,v in pairs(c1) do
- c1[i] = (v-v.p) + v.p*modelScale
- end
- local Joints = {}
- local gtJoints,gtParts;
- local function gtCFrame(cf)
- return (cf-cf.p) + cf.p * modelScale
- end
- function gtJoints(p)
- for i,v in pairs(p:GetChildren()) do
- if v:IsA("JointInstance") then
- table.insert(Joints,{v,v.Part0,v.Part1})
- v.Part0 = nil
- v.Part1 = nil
- v.C0 = (v.C0-(v.C0.p)) + (v.C0.p * modelScale)
- v.C1 = (v.C1-(v.C1.p)) + (v.C1.p * modelScale)
- end
- gtJoints(v)
- end
- end
- function gtParts(p)
- for i,v in pairs(p:GetChildren()) do
- if v:IsA("BasePart") then
- pcall(function() v.FormFactor = "Custom" end)
- local oldz = v.Size
- local cf = tor.CFrame:toObjectSpace(v.CFrame)
- v.Size = v.Size * modelScale
- v.CFrame = tor.CFrame * gtCFrame(cf)
- local mesh = nil
- for i,t in pairs(v:GetChildren()) do
- if t:IsA("DataModelMesh") then
- mesh = t
- end
- end
- if mesh == nil and v:IsA("Part") and v.Shape == Enum.PartType.Ball then
- mesh = Instance.new("SpecialMesh",v)
- mesh.MeshType = Enum.MeshType.Sphere
- end
- if mesh == nil and ((v:IsA("Part") and v.Shape == Enum.PartType.Block) or v:IsA("Seat") or v:IsA("VehicleSeat")) then
- mesh = Instance.new("BlockMesh",v)
- end
- if mesh ~= nil then
- if mesh:IsA("SpecialMesh") and mesh.MeshType == Enum.MeshType.FileMesh then
- mesh.Scale = mesh.Scale * modelScale
- else
- mesh.Scale = mesh.Scale*(oldz*modelScale)/v.Size
- end
- end
- end
- gtParts(v)
- end
- end
- gtJoints(char)
- gtParts(char)
- for i,v in pairs(Joints) do
- v[1].Part0 = v[2]
- v[1].Part1 = v[3]
- end
- end
- end
- rs.C0,rs.C1 = c0.rs,c1.rs
- ls.C0,ls.C1 = c0.ls,c1.ls
- rh.C0,rh.C1 = c0.rh,c1.rh
- lh.C0,lh.C1 = c0.lh,c1.lh
- nk.C0,nk.C1 = c0.nk,c1.nk
- tw.C0,tw.C1 = c0.tw,c1.tw
- local w10,w20 = w1.C0,w2.C0
- local pl = tor:FindFirstChild("FairyLight") or Instance.new("PointLight",tor)
- pl.Name = "FairyLight"
- pl.Shadows = false
- pl.Range = 8
- pl.Brightness = 10
- local sparkles = tor:FindFirstChild("FairySparkles") or Instance.new("Sparkles",tor)
- sparkles.Name = "FairySparkles"
- local outfit = 0
- local outfitparts = {ra,la,rl,ll,tor}
- local outfits = {
- {{106705109},{106705077},{106703301},{106703213},{106705037}}
- }
- local mycolor = ll.BrickColor.Color
- local mycolor2 = mycolor
- function setOutfit()
- local of = outfits[outfit]
- if of then
- for i,v in pairs(outfitparts) do
- local mesh = v:FindFirstChild("outfitMesh")
- local meshdata = outfits[outfit][i]
- if not mesh then
- mesh = Instance.new("SpecialMesh",v)
- mesh.Name = "outfitMesh"
- mesh.TextureId = "rbxassetid://9854798"
- end
- mesh.Scale =(meshdata[2] or Vector3.new(1,1,1)) * modelScale
- mesh.MeshId = "rbxassetid://"..meshdata[1]
- mesh.VertexColor = Vector3.new(mycolor2.r,mycolor2.g,mycolor2.b)
- end
- else
- for i,v in pairs(outfitparts) do
- pcall(function() v.outfitMesh:Destroy() end)
- end
- end
- end
- setOutfit()
- local senabled = true
- local lenabled = true
- function changeColor()
- for i,v in pairs(char:GetChildren()) do
- if v:IsA("BasePart") then
- v.BrickColor = BrickColor.new(mycolor)
- end
- end
- local mc1 = Vector3.new(mycolor.r,mycolor.g,mycolor.b)
- local mc2 = Vector3.new(mycolor2.r,mycolor2.g,mycolor2.b)
- w1m.VertexColor,w2m.VertexColor,hm.VertexColor = mc1,mc1,mc2
- for i,v in pairs(outfitparts) do
- local mesh = v:FindFirstChild("outfitMesh")
- if mesh then
- mesh.VertexColor = mc2
- end
- end
- pl.Color = mycolor
- sparkles.SparkleColor = mycolor
- end
- changeColor()
- do
- pcall(function() plr.PlayerGui.fairyColoring:Destroy() end)
- local scr = Instance.new("ScreenGui",plr.PlayerGui)
- scr.Name = "fairyColoring"
- local fr = Instance.new("Frame",scr)
- fr.Size = UDim2.new(0,-150,0,-65)
- fr.BackgroundColor3 = Color3.new(1,1,1)
- fr.BorderColor3 = Color3.new(.05,.05,.05)
- fr.BackgroundTransparency = .8
- fr.Position = UDim2.new(1,0,1,scr.Parent:FindFirstChild("PandaHelpNotify") and -20 or 0)
- fr.ZIndex = 9
- local am = 75
- local rval,gval,bval = mycolor.r,mycolor.g,mycolor.b
- local r = Instance.new("TextButton",fr)
- r.BackgroundTransparency = 1
- r.Size = UDim2.new(0,75,0,15)
- r.Position = UDim2.new(0,5,0,5)
- r.TextColor3 = Color3.new(1,1,1)
- r.TextStrokeTransparency = .4
- for i=1,am do
- local t = Instance.new("ImageLabel",r)
- t.BorderSizePixel = 0
- t.Size = UDim2.new(1/am,0,1,0)
- t.Position = UDim2.new((i-1)/am,0,0,0)
- t.Name = i
- t.ZIndex = 10
- end
- local rb = Instance.new("ImageLabel",r)
- rb.ZIndex = 10
- rb.Size = UDim2.new(0,2,1,-2)
- rb.BackgroundColor3 = Color3.new(0,0,0)
- rb.BackgroundTransparency = .5
- rb.BorderColor3 = Color3.new(.4,.4,.4)
- rb.Name = "b"
- local g = r:Clone()
- g.Parent = fr
- g.Position = UDim2.new(0,5,0,25)
- local b = r:Clone()
- b.Parent = fr
- b.Position = UDim2.new(0,5,0,45)
- r.ZIndex,g.ZIndex,b.ZIndex = 10,10,10
- local prev = Instance.new("TextButton",fr)
- prev.Size = UDim2.new(0,55,0,45)
- prev.Position = UDim2.new(0,90,0,5)
- prev.ZIndex = 10
- prev.BorderColor3 = Color3.new(.2,.2,.2)
- prev.TextColor3 = Color3.new(1,1,1)
- prev.TextStrokeTransparency = .4
- prev.TextYAlignment = "Bottom"
- prev.FontSize = "Size8"
- prev.TextWrapped = true
- local res = Instance.new("TextButton",fr)
- res.Size = UDim2.new(0,55,0,9)
- res.Position = UDim2.new(0,90,0,51)
- res.ZIndex = 10
- res.BorderColor3 = Color3.new(.2,.2,.2)
- res.BackgroundColor3 = Color3.new(.5,0,0)
- res.TextColor3 = Color3.new(1,1,1)
- res.Text = "reset"
- res.FontSize = "Size8"
- local mode = 0
- local function update(set)
- r.b.Position = UDim2.new(rval,-1,0,1)
- g.b.Position = UDim2.new(gval,-1,0,1)
- b.b.Position = UDim2.new(bval,-1,0,1)
- local col = Color3.new(rval,gval,bval)
- prev.BackgroundColor3 = mode == 1 and mycolor2 or mycolor
- prev.Text = ""
- r.Text = math.floor(rval*255+.5)
- g.Text = math.floor(gval*255+.5)
- b.Text = math.floor(bval*255+.5)
- for i,v in pairs(r:GetChildren()) do
- local n = tonumber(v.Name)
- if n then
- local sc = n/am
- v.BackgroundColor3 = Color3.new(sc,gval,bval)
- end
- end
- for i,v in pairs(g:GetChildren()) do
- local n = tonumber(v.Name)
- if n then
- local sc = n/am
- v.BackgroundColor3 = Color3.new(rval,sc,bval)
- end
- end
- for i,v in pairs(b:GetChildren()) do
- local n = tonumber(v.Name)
- if n then
- local sc = n/am
- v.BackgroundColor3 = Color3.new(rval,gval,sc)
- end
- end
- if set ~= false then
- if mode == 0 then
- mycolor = col
- end
- if mode == 1 then
- mycolor2 = col
- end
- changeColor()
- end
- end
- update()
- local rd,gd,bd = false,false,false
- r.MouseButton1Down:connect(function(x,y) rd = true rval = (x-r.AbsolutePosition.X)/r.AbsoluteSize.X update() end)
- r.MouseButton1Up:connect(function() rd = false end)
- r.MouseLeave:connect(function() rd = false end)
- r.MouseMoved:connect(function(x,y) if not rd then return end rval = (x-r.AbsolutePosition.X)/r.AbsoluteSize.X update() end)
- g.MouseButton1Down:connect(function(x,y) gd = true gval = (x-g.AbsolutePosition.X)/g.AbsoluteSize.X update() end)
- g.MouseButton1Up:connect(function() gd = false end)
- g.MouseLeave:connect(function() gd = false end)
- g.MouseMoved:connect(function(x,y) if not gd then return end gval = (x-g.AbsolutePosition.X)/g.AbsoluteSize.X update() end)
- b.MouseButton1Down:connect(function(x,y) bd = true bval = (x-b.AbsolutePosition.X)/b.AbsoluteSize.X update() end)
- b.MouseButton1Up:connect(function() bd = false end)
- b.MouseLeave:connect(function() bd = false end)
- b.MouseMoved:connect(function(x,y) if not bd then return end bval = (x-b.AbsolutePosition.X)/b.AbsoluteSize.X update() end)
- res.MouseButton1Click:connect(function()
- rval,gval,bval = themeColor.Color.r,themeColor.Color.g,themeColor.Color.b
- update()
- end)
- local modebtn = Instance.new("TextButton",fr)
- modebtn.Position = UDim2.new(1,-150,0,-15)
- modebtn.Size = UDim2.new(0,49,0,14)
- modebtn.BackgroundColor3 = Color3.new(1,1,0)
- modebtn.BackgroundTransparency = .6
- modebtn.TextScaled = true
- modebtn.Font = 4
- modebtn.TextColor3 = Color3.new(1,1,1)
- modebtn.TextStrokeTransparency = .7
- modebtn.Text = "Body"
- modebtn.MouseButton1Click:connect(function()
- mode = (mode+1)%2
- local col = mode == 1 and mycolor2 or mycolor
- rval,gval,bval = col.r,col.g,col.b
- modebtn.Text = mode == 0 and "Body" or "Clothes"
- update(false)
- end)
- local outfitbtn = Instance.new("TextButton",fr)
- outfitbtn.Position = UDim2.new(1,-150,0,-30)
- outfitbtn.Size = UDim2.new(0,49,0,14)
- outfitbtn.BackgroundColor3 = Color3.new(1,1,0)
- outfitbtn.BackgroundTransparency = .6
- outfitbtn.TextScaled = true
- outfitbtn.Font = 4
- outfitbtn.TextColor3 = Color3.new(1,1,1)
- outfitbtn.TextStrokeTransparency = .7
- outfitbtn.Text = "Outfit"
- outfitbtn.MouseButton1Click:connect(function()
- outfit = (outfit+1)%(#outfits+1)
- setOutfit()
- end)
- local sparklebtn = Instance.new("TextButton",fr)
- sparklebtn.Position = UDim2.new(1,-100,0,-15)
- sparklebtn.Size = UDim2.new(0,100,0,14)
- sparklebtn.BackgroundColor3 = Color3.new(0,1,0)
- sparklebtn.BackgroundTransparency = .6
- sparklebtn.TextScaled = true
- sparklebtn.Font = 4
- sparklebtn.TextColor3 = Color3.new(1,1,1)
- sparklebtn.TextStrokeTransparency = .7
- sparklebtn.Text = "Sparkles"
- sparklebtn.MouseButton1Click:connect(function()
- senabled = not senabled
- sparklebtn.BackgroundColor3 = senabled and Color3.new(0,1,0) or Color3.new(1,0,0)
- end)
- local lightbtn = Instance.new("TextButton",fr)
- lightbtn.Position = UDim2.new(1,-100,0,-30)
- lightbtn.Size = UDim2.new(0,100,0,14)
- lightbtn.BackgroundColor3 = Color3.new(0,1,0)
- lightbtn.BackgroundTransparency = .6
- lightbtn.TextScaled = true
- lightbtn.Font = 4
- lightbtn.TextColor3 = Color3.new(1,1,1)
- lightbtn.TextStrokeTransparency = .7
- lightbtn.Text = "Light"
- lightbtn.MouseButton1Click:connect(function()
- lenabled = not lenabled
- lightbtn.BackgroundColor3 = lenabled and Color3.new(0,1,0) or Color3.new(1,0,0)
- end)
- end
- local gyro = root:FindFirstChild("RootGyro") or Instance.new("BodyGyro",root)
- gyro.maxTorque = Vector3.new()
- gyro.Name = "RootGyro"
- local vel = root:FindFirstChild("RootVel") or Instance.new("BodyVelocity",root)
- vel.maxForce = Vector3.new()
- vel.Name = "RootVel"
- vel.P = 4000
- local flying = false
- local state = "idle"
- local kd = {}
- local humspd = 0
- local flyspeed = 0
- local flystop = 0
- local sitting = false
- local holding = false
- m.KeyDown:connect(function(k)
- local now = tick()
- kd[k] = now
- if k == " " and not flying then
- pcall(function() sitting:Destroy() end)
- sitting = nil
- state = "fly"
- flying = true
- flydir = (root.CFrame.lookVector*Vector3.new(1,0,1)).unit
- elseif k == " " and state == "fly" then
- flying = false
- state = "idle"
- flystop = tick()
- elseif k == "x" and m.Target and (root.Position-m.Hit.p).magnitude < 20*modelScale then
- local tar = m.Target
- local cf = tar.CFrame:toObjectSpace(m.Hit)
- local siz = tar.Size/2
- local cfr
- local rx,ry,rz = 0,0,0
- local lv = tar.CFrame:vectorToObjectSpace(root.CFrame.lookVector)
- if math.abs(cf.Y-siz.Y) < .03 then
- cfr = CFrame.new(cf.p + Vector3.new(0,3*modelScale,0)) * CFrame.Angles(0,math.atan2(-lv.X,-lv.Z),0)
- elseif math.abs(-cf.Y-siz.Y) < .03 then
- cfr = CFrame.new(cf.p - Vector3.new(0,3*modelScale,0)) * CFrame.Angles(0,math.atan2(-lv.X,-lv.Z),math.pi)
- elseif math.abs(cf.X-siz.X) < .03 then
- 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)
- elseif math.abs(-cf.X-siz.X) < .03 then
- 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)
- elseif math.abs(cf.Z-siz.Z) < .03 then
- 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)
- elseif math.abs(-cf.Z-siz.Z) < .03 then
- 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)
- end
- if cfr then
- pcall(function() sitting:Destroy() end)
- flying = false
- state = "sit"
- if m.Target.Anchored then
- sitting = {tar = tar, cf = cfr}
- else
- sitting = weld(tar,root,cfr)
- end
- end
- end
- end)
- m.KeyUp:connect(function(k)
- kd[k] = nil
- end)
- hum.Running:connect(function(spd)
- if state ~= "idle" and state ~= "walk" and state ~= "inair" then return end
- humspd = spd
- state = flying and "fly" or (spd < 1 and "idle" or "walk")
- end)
- hum.Climbing:connect(function(spd)
- if state ~= "idle" and state ~= "walk" and state ~= "inair" then return end
- humspd = spd
- state = flying and "fly" or (spd < 1 and "idle" or "walk")
- end)
- hum.Seated:connect(function(a)
- state = a and "sit" or humspd > 0 and "idle" or "walk"
- end)
- hum.Changed:connect(function()
- if hum.Jump then
- hum.Jump = false
- end
- end)
- hum.FreeFalling:connect(function()
- if state ~= "idle" and state ~= "walk" and state ~= "inair" then return end
- state = math.abs(tor.Velocity.Y) > 1 and "inair" or state
- end)
- hum.FallingDown:connect(function(a)
- if not a then return end
- state = "inair"
- end)
- while true do
- runservice.RenderStepped:wait()
- local cam = workspace.CurrentCamera
- local alpha = .2
- sparkles.Enabled = senabled and flying and tor.Velocity.magnitude > 3
- pl.Enabled = lenabled
- if state ~= "fly" then
- if type(sitting) == "table" then
- gyro.maxTorque = Vector3.new(1,1,1)*4e6
- vel.maxForce = Vector3.new(1,1,1)*4e5
- gyro.cframe = sitting.tar.CFrame * sitting.cf
- vel.velocity = (gyro.cframe.p-root.Position)*10
- else
- gyro.maxTorque,vel.maxForce = Vector3.new(),Vector3.new()
- end
- end
- if sitting then
- state = "sit"
- end
- tw.MaxVelocity,rh.MaxVelocity,lh.MaxVelocity,rs.MaxVelocity,ls.MaxVelocity,nk.MaxVelocity = 0,0,0,0,0,0
- tw.CurrentAngle,rh.CurrentAngle,lh.CurrentAngle,rs.CurrentAngle,ls.CurrentAngle,nk.CurrentAngle = 0,0,0,0,0,0
- local hasRobe = outfit == 1
- if state == "idle" then
- hum.PlatformStand = false
- local breathing = math.sin(tick()*2)
- local tilt = .02 + breathing*.03
- w1.C0 = clerp(w1.C0,w10*CFrame.Angles(0,-.01+breathing*.01,0),alpha)
- w2.C0 = clerp(w2.C0,w20*CFrame.Angles(0,.01-breathing*.01,0),alpha)
- tw.C0 = clerp(tw.C0,c0.tw*CFrame.Angles(tilt,0,0),alpha)
- rh.C0 = clerp(rh.C0,c0.rh*CFrame.Angles(-tilt,hasRobe and 0 or -.1,hasRobe and 0 or .06),alpha)
- lh.C0 = clerp(lh.C0,c0.lh*CFrame.Angles(-tilt,hasRobe and 0 or .1,hasRobe and 0 or -.06),alpha)
- rs.C0 = clerp(rs.C0,c0.rs*CFrame.Angles(-tilt,0,.1),alpha)
- ls.C0 = clerp(ls.C0,c0.ls*CFrame.Angles(-tilt,0,-.1),alpha)
- nk.C0 = clerp(nk.C0,c0.nk*CFrame.Angles(-tilt+breathing*.05-.03,0,0),alpha)
- elseif state == "inair" then
- hum.PlatformStand = false
- local wings = math.sin(tick()*80)
- w1.C0 = clerp(w1.C0,w10*CFrame.Angles(0,-.15+wings*.3,0),.6)
- w2.C0 = clerp(w2.C0,w20*CFrame.Angles(0,.15-wings*.3,0),.6)
- local alpha = .15
- local tilt = .05
- local wavey = math.sin(tick()*3)
- tw.C0 = clerp(tw.C0,c0.tw*CFrame.Angles(tilt,0,0),alpha)
- rh.C0 = clerp(rh.C0,c0.rh*CFrame.Angles(-tilt+wavey*.1,0,hasRobe and 0 or .02),alpha)
- lh.C0 = clerp(lh.C0,c0.lh*CFrame.Angles(-tilt-wavey*.1,0,hasRobe and 0 or -.02),alpha)
- rs.C0 = clerp(rs.C0,c0.rs*CFrame.Angles(-tilt-wavey*.07,0,.01),alpha)
- ls.C0 = clerp(ls.C0,c0.ls*CFrame.Angles(-tilt+wavey*.07,0,-.01),alpha)
- nk.C0 = clerp(nk.C0,c0.nk*CFrame.Angles(-tilt+.2,0,0),alpha)
- elseif state == "walk" then
- hum.PlatformStand = false
- local walking = math.sin(tick()*25)
- local breathing = math.sin(tick()*2)
- local tilt = -.03-breathing*.02+walking*.01
- alpha = .6
- w1.C0 = clerp(w1.C0,w10*CFrame.Angles(0,-.05+breathing*.01+walking*.05,0),alpha)
- w2.C0 = clerp(w2.C0,w20*CFrame.Angles(0,.05-breathing*.01+walking*.05,0),alpha)
- tw.C0 = clerp(tw.C0,c0.tw*CFrame.Angles(tilt,-walking*.08,0),alpha)
- rh.C0 = clerp(rh.C0,c0.rh*CFrame.Angles(-tilt+walking*.3,0,hasRobe and 0 or .02),alpha)
- lh.C0 = clerp(lh.C0,c0.lh*CFrame.Angles(-tilt-walking*.3,0,hasRobe and 0 or -.02),alpha)
- rs.C0 = clerp(rs.C0,c0.rs*CFrame.Angles(-tilt+.05-walking*.25,0,.01),alpha)
- ls.C0 = clerp(ls.C0,c0.ls*CFrame.Angles(-tilt+.05+walking*.25,0,-.01),alpha)
- nk.C0 = clerp(nk.C0,c0.nk*CFrame.Angles(-tilt+breathing*.04,walking*.07,0),alpha)
- elseif state == "sit" then
- hum.Sit = false
- hum.PlatformStand = true
- local breathing = math.sin(tick()*2)
- local upvec = root.CFrame:vectorToWorldSpace(Vector3.new(0,1,0))
- if upvec.Y > .4 then
- local tilt = -.55+breathing*.015
- w1.C0 = clerp(w1.C0,w10*CFrame.Angles(0,-.01+breathing*.01,0),alpha)
- w2.C0 = clerp(w2.C0,w20*CFrame.Angles(0,.01-breathing*.01,0),alpha)
- tw.C0 = clerp(tw.C0,c0.tw*CFrame.Angles(tilt,0,0)+Vector3.new(0,-1.7,0)*modelScale,alpha)
- rh.C0 = clerp(rh.C0,c0.rh*CFrame.Angles(-tilt+1.57,0,hasRobe and 0 or .6),alpha)
- lh.C0 = clerp(lh.C0,c0.lh*CFrame.Angles(-tilt+1.57,0,hasRobe and 0 or -.6),alpha)
- 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)
- 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)
- nk.C0 = clerp(nk.C0,c0.nk*CFrame.Angles(-tilt+breathing*.04-.03,0,math.sin(tick()*4)*.06),alpha)
- else -- wallhug
- local breathing = math.sin(tick()*5)
- local tilt = -1.55+breathing*.015
- w1.C0 = clerp(w1.C0,w10*CFrame.Angles(0,-.01+breathing*.01,0),alpha)
- w2.C0 = clerp(w2.C0,w20*CFrame.Angles(0,.01-breathing*.01,0),alpha)
- tw.C0 = clerp(tw.C0,c0.tw*CFrame.Angles(tilt,0,0)+Vector3.new(0,-2.5,0)*modelScale,alpha)
- 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)
- 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)
- rs.C0 = clerp(rs.C0,c0.rs*CFrame.Angles(2.9,0,.8)+Vector3.new(-.2,.4,0)*modelScale,alpha)
- ls.C0 = clerp(ls.C0,c0.ls*CFrame.Angles(2.9,0,-.8)+Vector3.new(.2,.4,0)*modelScale,alpha)
- nk.C0 = clerp(nk.C0,c0.nk*CFrame.Angles(breathing*.04+.7,0,0),alpha)
- end
- elseif state == "fly" then
- hum.PlatformStand = true
- gyro.maxTorque = Vector3.new(1,1,1)*4e6
- vel.maxForce = Vector3.new(1,1,1)*4e5
- 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))
- velocity = cam.CoordinateFrame:vectorToWorldSpace(velocity)
- local maxspeed = 40-(velocity.magnitude > 0 and velocity.unit.Y*20 or 0)
- if velocity.magnitude > 0 then
- flyspeed = lerp(flyspeed,maxspeed,.1)
- flydir = flydir:Lerp(velocity.unit,.4).unit
- hoverheight = nil
- else
- flyspeed = lerp(flyspeed,0,.3)
- flydir = (flydir*Vector3.new(1,0,1)).unit
- hoverheight = hoverheight or root.Position.Y
- end
- vel.velocity = flydir.unit * flyspeed
- if hoverheight then
- vel.velocity = vel.velocity + Vector3.new(0,hoverheight-root.Position.Y,0)
- end
- gyro.cframe = CFrame.new(Vector3.new(),flydir*Vector3.new(1,0,1))
- rl.CanCollide,ll.CanCollide = true,true
- local wings = math.sin(tick()*80)
- w1.C0 = clerp(w1.C0,w10*CFrame.Angles(0,-.15+wings*.3,0),.6)
- w2.C0 = clerp(w2.C0,w20*CFrame.Angles(0,.15-wings*.3,0),.6)
- local alpha = .15
- local flytilt = (flyspeed/maxspeed)
- local tilt = flytilt*-1.4 + math.asin(gyro.cframe:vectorToObjectSpace(flydir).unit.Y)
- local wavey = math.sin(tick()*6)
- tw.C0 = clerp(tw.C0,c0.tw*CFrame.Angles(tilt,0,0),alpha)
- rh.C0 = clerp(rh.C0,c0.rh*CFrame.Angles(wavey*.1,hasRobe and 0 or -.08,hasRobe and 0 or .1),alpha)
- lh.C0 = clerp(lh.C0,c0.lh*CFrame.Angles(-wavey*.1,hasRobe and 0 or .08,hasRobe and 0 or -.1),alpha)
- rs.C0 = clerp(rs.C0,c0.rs*CFrame.Angles(-wavey*.15,-.08,.1),alpha)
- ls.C0 = clerp(ls.C0,c0.ls*CFrame.Angles(wavey*.15,.08,-.1),alpha)
- nk.C0 = clerp(nk.C0,c0.nk*CFrame.Angles(-tilt*.8,0,0),alpha)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement