The raycast isn’t detecting parts
script.Parent.Shoot.OnServerEvent:Connect(function(player,size,speed,color,material,transparency,mousecframe,spread,lifetime,damage,headshot)
local CastBullet = workspace:Raycast(script.Parent.FirePos.Position,mousecframe)
if CastBullet then
print(CastBullet.Instance)
if CastBullet.Instance.Parent:FindFirstChild("Humanoid") and CastBullet.Instance.Parent.Name ~= player.Name then
if CastBullet.Instance.Name == "Head" then
CastBullet.Instance.Parent.Humanoid:TakeDamage(headshot)
else
CastBullet.Instance.Parent.Humanoid:TakeDamage(damage)
end
end
else
warn("no")
print(mousecframe)
end
end)
the script always prints no even if my cursor is on a part
Here is the line in the client script
script.Parent.Shoot:FireServer(BulletSize,BulletSpeed,BulletColor,BulletMaterial,BulletTransparency,Mouse.Hit.Position,Spread,Damage,HeadshotDamage)
Mouse is players mouse
Everything is the gun has cancollide and canquery off