Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.25 KB | None | 0 0
  1. function move()
  2.     while wait(0) do
  3.         if not paused then
  4.             if not running then break end
  5.             local dt = time() - t
  6.             t = time()
  7.             for i, v in pairs(chars:GetChildren()) do
  8.                 if v.Visible then
  9.                     local s = v.AbsoluteSize
  10.                     local p = v.AbsolutePosition
  11.                     local m = .25 / (chars["P"..i].AbsoluteSize.X/20)
  12.                     if gui.Controls["P"..i.."Right"].TextButton.Text ~= "" and gui.Controls["P"..i.."Right"].TextButton.Text ~= "|" and buttons(gui.Controls["P"..i.."Right"].TextButton.Text) and F[i].X == 0 then
  13.                         F[i] = F[i] + Vector2.new(8 + F[i].X, 0)
  14.                     elseif gui.Controls["P"..i.."Left"].TextButton.Text ~= "|" and gui.Controls["P"..i.."Left"].TextButton.Text ~= "" and buttons(gui.Controls["P"..i.."Left"].TextButton.Text) and F[i].X == 0 then
  15.                         F[i] = F[i] - Vector2.new(8 + F[i].X, 0)
  16.                     elseif Vf[i].X ~= 0 then
  17.                         F[i] = Vector2.new(0, F[i].Y)
  18.                         Vf[i] = Vf[i] - Vector2.new(.25 * (math.abs(Vf[i].X)/Vf[i].X), 0)
  19.                         if Vf[i].X < .25 and Vf[i].X > -.25 then
  20.                             Vf[i] = Vector2.new(0, Vf[i].Y)
  21.                         end
  22.                     end
  23.                     if F[i].X > 0 then
  24.                         v.Gun.Position = UDim2.new(1,0,0,12)
  25.                     elseif F[i].X < 0 then
  26.                         v.Gun.Position = UDim2.new(0, -12, 0, 12)
  27.                     end
  28.                     if F[i].Y == 0 and Vf[i].Y == 0 and gui.Controls["P"..i.."Jump"].TextButton.Text ~= "" and gui.Controls["P"..i.."Jump"].TextButton.Text ~= "|" and buttons(gui.Controls["P"..i.."Jump"].TextButton.Text) then
  29.                         local run = false              
  30.                         for z, x in pairs(gui[ground]:GetChildren()) do
  31.                             if not x:IsA("Folder") then
  32.                                 if s.Y + p.Y == x.AbsolutePosition.Y then
  33.                                     run = true
  34.                                     break
  35.                                 end
  36.                             end
  37.                         end
  38.                         if run then
  39.                             F[i] = F[i] - Vector2.new(0, 11)
  40.                         end
  41.                     end
  42.                     if F[i].Y < 10 then
  43.                         F[i] = F[i] + Vector2.new(0, 1)
  44.                     end
  45.                     Vf[i] = Vf[i] + Vector2.new(F[i].X * (dt/m), F[i].Y * (dt/m))
  46.                     if Vf[i].X > 20 or Vf[i].X < -20 then
  47.                         Vf[i] = Vector2.new(20 * (math.abs(Vf[i].X)/Vf[i].X), Vf[i].Y)
  48.                     end
  49.                     for z, x in pairs(gui[ground]:GetChildren()) do
  50.                         if not x:IsA("Folder") then
  51.                             collision(v, x, p, s, i)
  52.                         end
  53.                     end
  54.                     v.Position = UDim2.new(0, Vf[i].X + v.AbsolutePosition.X, 0, Vf[i].Y + v.AbsolutePosition.Y)
  55.                 end
  56.             end
  57.         end
  58.     end
  59. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement