How can i "unfire" an event?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve?
    I am trying to make a tank

  2. What is the issue?
    I dont know how to stop a remote.
    Like exemple: when the player press W to go forward the remote get fired and when the player release the key i want it to “unfire” but i dont know how?

Thanks for reading :smiley:

Once a remote event has been fired that’s it. For your use case you could use an argument in the event and set it to true or false depending on what you need, and then fire it when the player presses W and releases W.

-- W input code
event:FireServer(true)

--W input ended code
event:FireServer(false)
1 Like

Could you show us your current code to help you, please? That would be appreciated :slight_smile:

What do you mean by unfired, do you mean disconnecting the event ect

After the remote is fired, you can’t “unfire” it,

lets say you have remote1 and remote2
After remote1 is fired, you can’t “unfire” it, you can however fire remote2 to stop the action remote1 has started.

for example:

local RemoteIsActive = false

--this remote "activates" the action inside the while loop
remote1.Event:Connect(function()
    RemoteIsActive = true
end)

--this remote "stops" the action inside the while loop
remote2.Event:Connect(function()
    RemoteIsActive = false 
end)

while true do
    if RemoteIsActive then --if the value == true
        --do something here
    end
    wait()
end
1 Like

What you are asking for is not possible you could fire another event to intersect it but you would have to make sure the if statement runs after you fire the second event.

Since the while loop runs forever, it is always being called, so it will also be called after the second event is fired.

Unless there is another loop inside the first if statement, this should not be a problem

Remote event fires once, and doesn’t yield, however you can use remote functions if you need an answer from the server.