Advertisement
Guest User

Untitled

a guest
Apr 19th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.79 KB | None | 0 0
  1. local WalkAnimation = {5, 1, 9, 13}; --Key.Value == 1.
  2. local function KeyDownMovement(Plr, directionToUpdate, Iteration)
  3.     local Facing = plrInput:WaitForChild(Plr.Name).Actions.Facing; --Direction the character is facing.
  4.     local plrFrame = proximityView:WaitForChild(Plr.Name); --Player's character frame position.
  5.     local NewDirection = {
  6.         plrFrame.Position - UDim2.new(0, 0, 0, 40);
  7.         plrFrame.Position + UDim2.new(0, 0, 0, 40);
  8.         plrFrame.Position - UDim2.new(0, 40, 0, 0);
  9.         plrFrame.Position + UDim2.new(0, 40, 0, 0)
  10.     }
  11.     --Collision Check here.
  12.     directionToUpdate.Value = 1; --Makes movement true.
  13.     Facing.Value = Iteration; --Sets idle position for Key Up.
  14.     while directionToUpdate.Value == 1 do
  15.         plrFrame.Position = NewDirection[Iteration];
  16.         wait(0.3); --Needs to be a var.
  17.     end;
  18. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement