Hi, So one of my local scripts are not deciding to work as i press on f and doesnt work on how its supposed to do and no errors and nothing popups up in output and so i decided to take a look at the script and it seems that when i press on r it reloads and not the other keybinds take a look at the script, if you know why it doesnt work it would be really helpful if you do explain it and come with a solution

  • Im so sorry for the poor grammar my arm really hurts badly!
local mouse = game.Players.LocalPlayer:GetMouse()

function KeyDownFunctions(key)
	if key == "r" then
		Reload()
	elseif key == "f" then
	local obj = mouse.Target
		if obj ~= nil and obj:findFirstChild("Activate") ~= nil then
			if (obj.Position - Tool.Handle.Position).magnitude <= 5 then
				obj.Activate.Value = game.Players:playerFromCharacter(Tool.Parent)
			end
		end
		if obj ~= nil and obj.Parent ~= nil then
			h = obj.Parent:FindFirstChild("Humanoid")
			if obj.Parent.Parent ~= nil then
				h = obj.Parent:FindFirstChild("Humanoid") or obj.Parent.Parent:FindFirstChild("Humanoid") 
			end
			if h ~= nil then
				if h.Parent:findFirstChild("Downed") ~= nil and (h.Parent.Torso.Position - Tool.Handle.Position).magnitude <= 5 then
					h.Parent:findFirstChild("Downed").Activate.Value = game.Players:playerFromCharacter(Tool.Parent)
				end
			end
		end
	end
end