Hello my script gives me an error when the if statement is false
local function RaycastBullet() local Target = mouse.target local Damage = 10 if Target then if Target.Parent.Humanoid then Target.Parent.Humanoid:TakeDamage(Damage) end if Target.Parent.Parent.Humanoid then Target.Parent.Parent.Humanoid:TakeDamage(Damage) end end end
You should use FindFirstChild, if it detect the Instance is not there, it returns nil. You are going to make line 2 to:
local Target = mouse:FindFirstChild("target")
And it will work fine.