hey devs,
i’ve made a gun script but it wont function here it is:
script.Parent.fire.OnServerEvent:Connect(function(player,mousePos)
local raycastParams = RaycastParams.new()
RaycastParams.filterDecendedantsInstances = (player.Charecter)
RaycastParams.FilterType = Enum.RaycastFilterType.Blacklist
local raycastResults = workspace:Raycast(script.Parent.Handel.Position,(mousePos - script.Parent.Handle.Position)*300,RaycastParams)
if raycastResults then
local hitpart = raycastResults.Instance
local model = hitpart:FindFirstAncestorOfClass("Model")
if model then
if model:FindFirstChild("Humanoid")
model.Humanoid.Health -=30
end
end
end)