So i making a Gun i can show you an example of whats wrong:
Code(i cant show you the entire code):
GEngine.Events.Shoot.OnServerInvoke = function(Player, Pos, GunFirePoint)
local Raycast = RaycastParams.new()
Raycast.FilterDescendantsInstances = {Player.Character}
Raycast.FilterType = Enum.RaycastFilterType.Blacklist
local Result = workspace:Raycast(Tool.Handle.Position, (Pos - Tool.Handle.Position) * Settings.Settings.Range)
if Result then
local Hit = Result.Instance
local Model = Hit:FindFirstAncestorOfClass("Model")
if Model then
if Model.Humanoid then
Model.Humanoid.Health -= Settings.Settings.Damage
if Model.Humanoid.Health <= 0 then
return true
else
return false
end
end
end
end
end