gameProcessed = false Bug

  1. 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

  2. What is the issue? Include screenshots / videos if possible!
    Fix this issue with the game not being “gameProcessed” or something of the sorts

  3. 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)

2 Likes

You aren’t passing the gameProcessed parameter along the remote, so the parameter on the server is nil. not nil is just true, so therefore your not gameProcessed code branch runs.

To fix, pass gameProcessed along the remote.

1 Like

So I have done that and im still getting the warn message of “gameProcessed == false”.

My updated code was changing this:

game.ReplicatedStorage.Remotes.MovePlayer2:FireServer(player2, newInput)

to this:

game.ReplicatedStorage.Remotes.MovePlayer2:FireServer(player2, newInput, gameProcessed)

Its 1:10 AM so my brain is a little cooked rn

YEAHHHHHHHHHHHHHHHHHHHHHHHHHH I DID IT

OH YEAHHH

My fix was just basically slamming my head into my keyboard and it all worked

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.