Advertisement
carlosname

Untitled

Feb 6th, 2023 (edited)
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.68 KB | None | 0 0
  1. --Jump Two Time or press M
  2. --Down Press Q
  3. --Wings Spin Press A Two Time, Doesnt work maybe
  4. --Wings Spin Press D Two Time, Doesnt work maybe
  5. script.Parent = nil
  6. local Remote = script.Parent:WaitForChild("RemoteEvent")
  7. function fly()
  8.  
  9. for i,v in pairs(script:GetChildren()) do
  10.  
  11. pcall(function() v.Value = "" end)
  12.  
  13. game:GetService("Debris"):AddItem(v,.1)
  14.  
  15. end
  16.  
  17. local function weld(p0,p1,c0,c1,par)
  18.  
  19. local w = Instance.new("Weld",p0 or par)
  20.  
  21. w.Part0 = p0
  22.  
  23. w.Part1 = p1
  24.  
  25. w.C0 = c0 or CFrame.new()
  26.  
  27. w.C1 = c1 or CFrame.new()
  28.  
  29. return w
  30.  
  31. end
  32.  
  33. local motors = {}
  34.  
  35. local function motor(p0,p1,c0,c1,des,vel,par)
  36.  
  37. local w = Instance.new("Motor6D",p0 or par)
  38.  
  39. w.Part0 = p0
  40.  
  41. w.Part1 = p1
  42.  
  43. w.C0 = c0 or CFrame.new()
  44.  
  45. w.C1 = c1 or CFrame.new()
  46.  
  47. w.MaxVelocity = tonumber(vel) or .05
  48.  
  49. w.DesiredAngle = tonumber(des) or 0
  50.  
  51. return w
  52.  
  53. end
  54.  
  55. local function lerp(a,b,c)
  56.  
  57. return a+(b-a)*c
  58.  
  59. end
  60.  
  61. local function clerp(c1,c2,al)
  62.  
  63. local com1 = {c1.X,c1.Y,c1.Z,c1:toEulerAnglesXYZ()}
  64.  
  65. local com2 = {c2.X,c2.Y,c2.Z,c2:toEulerAnglesXYZ()}
  66.  
  67. for i,v in pairs(com1) do
  68.  
  69. com1[i] = lerp(v,com2[i],al)
  70.  
  71. end
  72.  
  73. return CFrame.new(com1[1],com1[2],com1[3]) * CFrame.Angles(select(4,unpack(com1)))
  74.  
  75. end
  76.  
  77. local function ccomplerp(c1,c2,al)
  78.  
  79. local com1 = {c1:components()}
  80.  
  81. local com2 = {c2:components()}
  82.  
  83. for i,v in pairs(com1) do
  84.  
  85. com1[i] = lerp(v,com2[i],al)
  86.  
  87. end
  88.  
  89. return CFrame.new(unpack(com1))
  90.  
  91. end
  92.  
  93. local function tickwave(time,length,offset)
  94.  
  95. return (math.abs((tick()+(offset or 0))%time-time/2)*2-time/2)/time/2*length
  96.  
  97. end
  98.  
  99. local function invcol(c)
  100.  
  101. c = c.Color
  102.  
  103. return BrickColor.new(Color3.new(1-c.b,1-c.g,1-c.r))
  104.  
  105. end
  106.  
  107. local oc = oc or function(...) return ... end
  108.  
  109. local plr = game.Players.LocalPlayer
  110.  
  111. local char = plr.Character
  112.  
  113. local tor = char.Torso
  114.  
  115. local hum = char.Humanoid
  116.  
  117. hum.PlatformStand = false
  118.  
  119. pcall(function()
  120.  
  121. char.Wings:Destroy()
  122.  
  123. end)
  124.  
  125. pcall(function()
  126.  
  127. char.Angel:Destroy() -- hat
  128.  
  129. end)
  130.  
  131. local mod = Instance.new("Model",char)
  132.  
  133. mod.Name = "Wings"
  134.  
  135. local special = {
  136.  
  137. --antiboomz0r = {"Really black","Institutional white",0,0,false,Color3.new(1,1,.95),Color3.new(1,1,.6)},
  138.  
  139. antiboomz0r = {"New Yeller",nil,0.4,0.7,true,Color3.new(1,1,.95),Color3.new(1,1,.6)},
  140.  
  141. --antiboomz0r = {"Cyan","Toothpaste",0,0,false,Color3.new(1,0,0),Color3.new(0,0,0)},
  142.  
  143. taart = {"Royal purple",nil,.4,.4,true},
  144.  
  145. mitta = {"Black",nil,0,0,false},
  146.  
  147. penjuin3 = {"White",nil,0,0,false},
  148.  
  149. thepc8110 = {"Black","Bright red",.5,0,false,Color3.new(1,0,0),Color3.new(0,0,0)},
  150.  
  151. nonspeaker = {"Cyan","Toothpaste",0,0,false,Color3.new(1,0,0),Color3.new(0,0,0)},
  152.  
  153. littleau999 = {"Reddish brown",1030,0,0,false},
  154.  
  155. unscripter = {"Really black","Really black",.2,0,true,Color3.new(0,0,0),Color3.new(0,0,0)},
  156.  
  157. oxcool1 = {"Really black","White",.2,0,false,Color3.new(0,0,0),Color3.new(0,0,0)},
  158.  
  159. krodmiss = {"Really black",nil,0,0,false},
  160.  
  161. }
  162.  
  163. local topcolor = invcol(char.Torso.BrickColor)
  164.  
  165. local feacolor = char.Torso.BrickColor
  166.  
  167. local ptrans = 0
  168.  
  169. local pref = 0
  170.  
  171. local fire = false
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182. local idle = {0,0.5,-.2,0; .05,.05,.1,.05; -.6,-1.5,.1,0;}--0,.3,0,0
  183.  
  184. local outlow = {-.7,-.2,1.8,0; .3,.05,.1,.05; .2,0,0,0}
  185.  
  186. local outhigh = {.5,-.2,1.8,0; .3,.05,.1,.05; .2,0,0,0}
  187.  
  188. local veryhigh = {.9,-.3,1.9,0; .3,.05,.1,.05; .2,0,0,0}
  189.  
  190. local flap1 = {-.3,.3,1.1,-.2; .3,.05,.1,.05; .2,-.6,0,0}
  191.  
  192. local divebomb = {0,.2,.4,-.7; .3,.05,.1,.05; 0,-.5,-.6,0}
  193.  
  194.  
  195. --function setwings(tab,time)
  196. --
  197. -- time = time or 10
  198. --
  199. -- for i=1,4 do
  200. --
  201. -- rwing[i].DesiredAngle = tab[i]
  202. --
  203. -- lwing[i].DesiredAngle = tab[i]
  204. --
  205. -- rwing[i].MaxVelocity = math.abs(tab[i]-rwing[i].CurrentAngle)/time
  206. --
  207. -- lwing[i].MaxVelocity = math.abs(tab[i]-lwing[i].CurrentAngle)/time
  208. --
  209. -- local rcf = oc0[rwing[i]] * (tab[12+i] or CFrame.new())
  210. --
  211. -- local lcf = oc0[lwing[i]] * (tab[12+i] or CFrame.new())
  212. --
  213. -- end
  214. --
  215. -- for i,v in pairs(rf1) do
  216. --
  217. -- v.DesiredAngle = tab[9]
  218. --
  219. -- v.MaxVelocity = math.abs(v.DesiredAngle-v.CurrentAngle)/time
  220.  
  221. -- end
  222. --
  223. -- for i,v in pairs(lf1) do
  224. --
  225. -- v.DesiredAngle = tab[9]
  226. --
  227. -- v.MaxVelocity = math.abs(v.DesiredAngle-v.CurrentAngle)/time
  228.  
  229. -- end
  230. --
  231. -- for i,v in pairs(rf2) do
  232.  
  233. -- v.DesiredAngle = tab[10]
  234.  
  235. -- v.MaxVelocity = math.abs(v.DesiredAngle-v.CurrentAngle)/time
  236.  
  237. -- end
  238. --
  239. -- for i,v in pairs(lf2) do
  240. --
  241. -- v.DesiredAngle = tab[10]
  242. --
  243. -- v.MaxVelocity = math.abs(v.DesiredAngle-v.CurrentAngle)/time
  244. --
  245. -- end
  246. --
  247. -- for i,v in pairs(rf3) do
  248. --
  249. -- v.DesiredAngle = tab[11]
  250. --
  251. -- v.MaxVelocity = math.abs(v.DesiredAngle-v.CurrentAngle)/time
  252.  
  253. -- end
  254.  
  255. -- for i,v in pairs(lf3) do
  256. --
  257. -- v.DesiredAngle = tab[11]
  258. --
  259. -- v.MaxVelocity = math.abs(v.DesiredAngle-v.CurrentAngle)/time
  260. --
  261. -- end
  262. --
  263. -- end]]
  264.  
  265. --setwings(outhigh,1)
  266.  
  267. flying = false
  268.  
  269. moving = false
  270.  
  271. for i,v in pairs(tor:GetChildren()) do
  272.  
  273. if v.ClassName:lower():match("body") then
  274.  
  275. v:Destroy()
  276.  
  277. end
  278.  
  279. end
  280.  
  281. local ctor = tor:Clone()
  282.  
  283. ctor:ClearAllChildren()
  284.  
  285. ctor.Name = "cTorso"
  286.  
  287. ctor.Transparency = 1
  288.  
  289. ctor.CanCollide = false
  290.  
  291. ctor.FormFactor = "Custom"
  292.  
  293. ctor.Size = Vector3.new(.2,.2,.2)
  294.  
  295. ctor.Parent = mod
  296.  
  297. weld(tor,ctor)
  298.  
  299. local bg = Instance.new("BodyGyro",ctor)
  300.  
  301. bg.maxTorque = Vector3.new()
  302.  
  303. bg.P = 15000
  304.  
  305. bg.D = 1000
  306.  
  307. local bv = Instance.new("BodyVelocity",ctor)
  308.  
  309. bv.maxForce = Vector3.new()
  310.  
  311. bv.P = 15000
  312.  
  313. local vel = Vector3.new()
  314.  
  315. local cf = CFrame.new()
  316.  
  317. local flspd = 0
  318.  
  319.  
  320. local keysdown = {}
  321.  
  322. local keypressed = {}
  323.  
  324. local ktime = {}
  325.  
  326. local descendtimer = 0
  327.  
  328. local jumptime = tick()
  329.  
  330. hum.Jumping:connect(function()
  331.  
  332. jumptime = tick()
  333.  
  334. end)
  335.  
  336. local cam = workspace.CurrentCamera
  337.  
  338. local kd = plr:GetMouse().KeyDown:connect(oc(function(key)
  339.  
  340. keysdown[key] = true
  341.  
  342. keypressed[key] = true
  343.  
  344. if key == "q" then
  345.  
  346. descendtimer = tick()
  347.  
  348. elseif key == " " and not hum.Jump then
  349.  
  350. jumptime = tick()
  351.  
  352. elseif (key == "a" or key == "d") and ktime[key] and tick()-ktime[key] < .3 and math.abs(reqrotx) < .3 then
  353.  
  354. reqrotx = key == "a" and math.pi*2 or -math.pi*2
  355.  
  356. end
  357.  
  358. ktime[key] = tick()
  359.  
  360. end))
  361.  
  362. local ku = plr:GetMouse().KeyUp:connect(function(key)
  363.  
  364. keysdown[key] = false
  365.  
  366. if key == " " then
  367.  
  368. descendtimer = tick()
  369.  
  370. end
  371.  
  372. end)
  373.  
  374. local function mid(a,b,c)
  375.  
  376. return math.max(a,math.min(b,c or -a))
  377.  
  378. end
  379.  
  380. local function bn(a)
  381.  
  382. return a and 1 or 0
  383.  
  384. end
  385.  
  386. local function gm(tar)
  387.  
  388. local m = 0
  389.  
  390. for i,v in pairs(tar:GetChildren()) do
  391.  
  392. if v:IsA("BasePart") then
  393.  
  394. m = m + v:GetMass()
  395.  
  396. end
  397.  
  398. m = m + gm(v)
  399.  
  400. end
  401.  
  402. return m
  403.  
  404. end
  405.  
  406. reqrotx = 0
  407.  
  408. local grav = 196.2
  409.  
  410. local con
  411. local idledir
  412. con = game:GetService("RunService").Stepped:connect(oc(function()
  413.  
  414. --[[if not mod:IsDescendantOf(workspace) then
  415.  
  416. pcall(function() kd:disconnect() end)
  417.  
  418. pcall(function() ku:disconnect() end)
  419.  
  420. bg:Destroy()
  421.  
  422. bv:Destroy()
  423.  
  424. con:disconnect()
  425.  
  426. script:Destroy()
  427.  
  428. return
  429.  
  430. end]]
  431.  
  432. local obvel = tor.CFrame:vectorToObjectSpace(tor.Velocity)
  433.  
  434. local sspd, uspd,fspd = obvel.X,obvel.Y,obvel.Z
  435.  
  436. if flying then
  437.  
  438. Remote:FireServer("Flying")
  439. local fldir = cam.CoordinateFrame:vectorToWorldSpace(Vector3.new(bn(keysdown.d)-bn(keysdown.a),0,bn(keysdown.s)-bn(keysdown.w))).unit
  440.  
  441. local lfldir = fldir
  442.  
  443. local lmoving = moving
  444.  
  445. moving = fldir.magnitude > .1
  446. script.Parent.WingsMovement:FireServer("moving",moving)
  447. if lmoving and not moving then
  448.  
  449. idledir = lfldir*Vector3.new(1,0,1)
  450.  
  451. descendtimer = tick()
  452.  
  453. end
  454.  
  455. local dbomb = fldir.Y < -.6 or (moving and keysdown["1"])
  456.  
  457. if moving and keysdown["0"] and lmoving then
  458.  
  459. fldir = (Vector3.new(lfldir.X,math.min(fldir.Y,lfldir.Y+.01)-.1,lfldir.Z)+(fldir*Vector3.new(1,0,1))*.05).unit
  460.  
  461. end
  462.  
  463. local down = tor.CFrame:vectorToWorldSpace(Vector3.new(0,-1,0))
  464.  
  465. local descending = (not moving and keysdown["q"] and not keysdown[" "])
  466.  
  467. cf = ccomplerp(cf,CFrame.new(tor.Position,tor.Position+(not moving and idledir or fldir)),keysdown["0"] and .02 or .07)
  468.  
  469. local gdown = not dbomb and cf.lookVector.Y < -.2 and tor.Velocity.unit.Y < .05
  470.  
  471. hum.PlatformStand = true
  472.  
  473. bg.maxTorque = Vector3.new(1,1,1)*9e5
  474.  
  475. local rotvel = CFrame.new(Vector3.new(),tor.Velocity):toObjectSpace(CFrame.new(Vector3.new(),fldir)).lookVector
  476.  
  477. 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)
  478.  
  479. reqrotx = reqrotx - reqrotx/10
  480.  
  481. bv.maxForce = Vector3.new(1,1,1)*9e4*.5
  482.  
  483. local anioff =(bn(keysdown[" "])-bn(keysdown["q"]))/2
  484.  
  485. local ani = tickwave(1.5-anioff,1)
  486. script.Parent.AniTick:FireServer(ani)
  487. 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)
  488.  
  489. vel = moving and cf.lookVector*flspd or Vector3.new()
  490.  
  491. 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))
  492.  
  493. -- setwings(moving and (gdown and outlow or dbomb and divebomb) or (descending and veryhigh or flap1),15)
  494. --Dive anim or swing animation
  495. if gdown then
  496. script.Parent.WingsMovement:FireServer("gdown",gdown)
  497. --print("gdown")
  498. elseif dbomb then
  499. script.Parent.WingsMovement:FireServer("dbomb",dbomb)
  500. --print("dbomb")
  501. elseif divebomb then
  502. script.Parent.WingsMovement:FireServer("divebomb",divebomb)
  503. --print("divebomb")
  504. elseif veryhigh then
  505. script.Parent.WingsMovement:FireServer("veryhigh",veryhigh)
  506. --print("veryhigh")
  507. elseif flap1 then
  508. script.Parent.WingsMovement:FireServer("flap1",flap1)
  509. --print("flap")
  510. elseif outlow then
  511. script.Parent.WingsMovement:FireServer("outlow",outlow)
  512. elseif descending then
  513. script.Parent.WingsMovement:FireServer("descending",descending)
  514. --print("outlow")
  515. end
  516.  
  517. local hit,ray = workspace:FindPartOnRayWithIgnoreList(Ray.new(tor.Position,Vector3.new(0,-3.5+math.min(0,bv.velocity.y)/30,0)),{char})
  518.  
  519. if hit and down.Y < -.85 and tick()-flystart > 1 then
  520.  
  521. flying = false
  522.  
  523. hum.PlatformStand = false
  524.  
  525. tor.Velocity = Vector3.new()
  526.  
  527. end
  528.  
  529. else
  530.  
  531. bg.maxTorque = Vector3.new()
  532.  
  533. bv.maxForce = Vector3.new()
  534.  
  535. local ani = tickwave(--[[walking and .8 or]] 4.5,1)
  536. script.Parent.AniTick:FireServer(ani)
  537. --print("Idle")
  538. -- setwings(idle,10)
  539. Remote:FireServer("Idle")
  540. --maybe idle
  541. local x,y,z = fspd/160,uspd/700,sspd/900
  542.  
  543.  
  544.  
  545. if (keypressed["M"] or keypressed["m"]) and not flying and (tick()-jumptime > .05 and (tick()-jumptime < 3 or hum.Jump)) then
  546.  
  547. vel = Vector3.new(0,50,0)
  548.  
  549. bv.velocity = vel
  550.  
  551. idledir = cam.CoordinateFrame.lookVector*Vector3.new(1,0,1)
  552.  
  553. cf = tor.CFrame * CFrame.Angles(-.01,0,0)
  554.  
  555. tor.CFrame = cf
  556.  
  557. bg.cframe = cf
  558.  
  559. flystart = tick()
  560.  
  561. flying = true
  562.  
  563. end
  564.  
  565. end
  566.  
  567. keypressed = {}
  568.  
  569. end))
  570.  
  571.  
  572.  
  573. end fly()
  574.  
  575. --Bird Wings By saud20
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement