Tools are equipped in chat

I migrated the chat, and when I type 1 in the chat, the tool called 1 in the backpack is equipped.
How can I get rid of this?
I want to prevent tools from being equipped while chatting.

2 Likes

I think contextactionservice would work.

1 Like

How do I add contextactionservice?

1 Like
ContextActionService:BindAction("name", yourfunciton, createTouchButton, keycode)

make sure it’s done on the client.

1 Like

It appears you have a custom inventory/hot-bar system. Given the context in the video, it most likely uses UserInputService to respond to keyboard inputs. It seems it’s lacking an elementary guard clause for stopping the callback if Roblox is responding to the input itself. In this scenario, Roblox is processing the keyboard input so it may update the TextBox.Text field with the user’s inputs.

The event being used to detect keyboard inputs is UserInputService.InputBegan, and its second parameter is a boolean that states whether or not Roblox already processed the input. Your code should look like this:

UserInputService.InputBegan:Connect(function(input: InputObject, gameProcessedEvent: boolean)
    if gameProcessedEvent then
        return
    end

    -- Process input
end)
1 Like

Where should I add this code? Backpack Toolbar? Or somewhere else?

1 Like

You need to edit the inventory/hot-bar LocalScript that contains the UserInputService.InputBegan event

1 Like

I added that script right above my toolbar script and it still doesn’t work. If I still type 1 in the chat window, the tool still gets caught.

2 Likes

in this event handler function

not

2 Likes

BackpackModule

– This backpack script doesn’t support hopperbin because using :ToggleActive() will raise an error and its belong to corescript

– Backpack Version 5.1
– OnlyTwentyCharacters, SolarCrane

local UserInputService = game:GetService(“UserInputService”)

UserInputService.InputBegan:Connect(function(input: InputObject, gameProcessedEvent: boolean)
if gameProcessedEvent then
return
end

–Process input
end)

local BackpackScript = {}
BackpackScript.OpenClose = nil – Function to toggle open/close
BackpackScript.IsOpen = false
BackpackScript.StateChanged = Instance.new(“BindableEvent”) – Fires after any open/close, passes IsNowOpen

I added this, but the symptom still remains.

2 Likes