I'm asking this question to know what to do to assign hotkeys. For example in most fighting games, if you press Q you'd do a punch or a kick. Could any of you guys tell me a script that will help me with something like that? Many thanks!
Here is the script for this
local function onInputBegan(input,gameProcessed) if input.UserInputType == Enum.UserInputType.Keyboard then local keyPressed = input.KeyCode if string.upper(keyPressed) == "Q" then . -- Function here . end end end UserInputService.InputBegan:connect(onInputBegan)
This script allows you to equip a tool by pressing a key and unequip it by pressing the same key put this inside the tool then put the tool in the starter pack
local player = game:GetService("Players").LocalPlayer; local mouse = player:GetMouse(); local tool = player.Backpack.Rasengan;-- change to tool name local toggle = false mouse.KeyDown:connect(function(key) if toggle == false and key == "r" then --change hot key inside "" player.Character.Humanoid:EquipTool(tool); toggle = true elseif toggle == true and key == "r" then --change hot key inside "" player.Character.Humanoid:UnequipTools(tool); toggle = false end end);