after you press f and change character the melee attack wont work like it just doesnt run when i press E

local plr = game.Players.LocalPlayer
local UIS = game:GetService("UserInputService")
local MeleeDb = false
local shifted = false

--//Shift

local keybind = Enum.KeyCode.F
UIS.InputBegan:Connect(function(input, gameprocessed)
	if gameprocessed then return end

	if input.KeyCode == keybind then
		
		script.Shift:FireServer()	
		
		shifted = true
		
	end

end)

--//Melee Attack

local Melee = Enum.KeyCode.E
UIS.InputBegan:Connect(function(input, gameprocessed)
	if gameprocessed then return end

	if input.KeyCode == Melee then
		print("done")
		if shifted == true and MeleeDb == false then
		print("REALdone")	
		script.Melee:FireServer()	
			MeleeDb = true
			wait(0.5)
			MeleeDb = false
		end
	end
end)

2 comments

1

Localscript is probably placed in wrong place for this, it would help if we knew the events too maybe

0

you are right thanks