-
What do you want to achieve? Keep it simple and clear!
On Pressing a arrow key on the keyboard, move the player to the part -
What is the issue? Include screenshots / videos if possible!
Fix this issue with the game not being “gameProcessed” or something of the sorts -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
dev fourms
Local Code:
uis.InputBegan:Connect(function(input, gameProcessed)
local newInput = input.KeyCode.Name
game.ReplicatedStorage.Remotes.MovePlayer2:FireServer(player2, newInput)
end)
Server Code:
local MovePlayer2 = game.ReplicatedStorage.Remotes.MovePlayer2
MovePlayer2.OnServerEvent:Connect(function(player, player2, Input, gameProcessed)
if not gameProcessed then
warn("gameProcessed == false")
return
end
if Input then
if Input.KeyCode == Enum.KeyCode.W then
player2.Humanoid:MoveTo(player2.MovePointForward.Position)
warn("Moved Player2: " ..Input.KeyCode.Name)
elseif Input.KeyCode == Enum.KeyCode.S then
player2.Humanoid:MoveTo(player2.MovePointDown.Position)
warn("Moved Player2: " ..Input.KeyCode.Name)
elseif Input.KeyCode == Enum.KeyCode.A then
player2.Humanoid:MoveTo(player2.MovePointLeft.Position)
warn("Moved Player2: " ..Input.KeyCode.Name)
elseif Input.KeyCode == Enum.KeyCode.D then
player2.Humanoid:MoveTo(player2.MovePointRight.Position)
warn("Moved Player2: " ..Input.KeyCode.Name)
else
warn("Input was not apart of list (bug)")
end
else
warn("No Input")
end
end)