So I want to be able to get an enemy’s root part through Mouse.Target, however, I get an error and I can’t figure it out. The output says " Attempted to index nil with “Target”
local aircombat = ReplicatedStorage.AirCombat:WaitForChild("Mouse")
aircombat.OnServerEvent:Connect(function(Player)
local mouse = Player:GetMouse()
if mouse.Target then -- THE LINE OF ERROR
if mouse.Target.Parent:IsA("Model") then
local HumanoidRootPart = mouse.Target.Parent:FindFirstChild("HumanoidRootPart")
if HumanoidRootPart then
print("RootPart found")
else
print("Not Found")
end
end
end
end)