Hi, Im having a problem with my script and it keeps saying this error messege Players.confidencebreath.Backpack.M1911.Shooter:140: attempt to index nil with 'Target' and its not working on how its supposed if anyone can find a solution and which i mean a simple fix i would be grateful heres the code the problem is in green and if anyone could give me a explantion on why is this happening then i reflect on what to do next time without asking
function KeyDownFunctions(key)
if key == "r" then
Reload()
elseif key == "v" then
if canshoot == true and reloading == false then
slice()
end
elseif key == "f" then
--Main problem 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
local 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
im sorry for the confussing title

2 comments
Ok, thanks I will try it out later
Slight problem now when I press f nothing happens