Weird bug with remote events

So I’m making an ability that when the player goes into a ball and presses space they do a ground slam:

The ability works normally, however when I press space before I activate the ability it slams instantly even though the remote event was fired before it connected:

Here is the code that s connecting the event when the tool is activated:

abilityStorage.maid:GiveTask(ReplicatedStorage.Network.Input.Space.OnServerEvent:Connect(function(otherPlayer)
	if otherPlayer ~= player then return end

	shared.AbilityService:DeactivateAbility(player, "Heavenly Fall", abilityStorage)
end))

abilityStorage.maid is automatically cleaned up when the ability is deactivated (I checked and it dose get disconnected).

Here is the code that fires the space remote event:

UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
	InputController.gameProcessedEvent = gameProcessedEvent
		
	if input.KeyCode == Enum.KeyCode.Space then
		ReplicatedStorage.Network.Input.Space:FireServer()
	end
end)

The only way I was able to prevent this was to just connect to the remote event in another script:

game.ReplicatedStorage.Network.Input.Space.OnServerEvent:Connect(function()
end)

I don’t even need to do anything, it just fixed when I added this. However I dislike the fact that I will probably need to do this will all inputs so if anyone knows how to fix this issue please let me know!

2 Likes

Any remote event that is sent to a client will queue until the first connection.

2 Likes

Hey I’ve bern wondering but how do you do the rock crater thing snd rubble

1 Like

Here is a tutorial, although it’s not verry good. It should give a basic understanding though.

1 Like

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