Hello I Was Trying To Make A Gun Then This Error Happened All The Code Runs Normally Until You Point It At A Humanoid. And Then Shoot It Gives You The Error I'm Confused I Have Tryed Renaming Parts And Other Things And Trying Different Ways To Fix This Please Leave Any Suggestions Or Things You May Thing Are Causing This Error Also This Is a script in a tool Here is The Code The Error Is At Line 7

script.Parent.Fire.OnServerEvent:Connect(function(player,mousePos)
	script.Parent.BANG:Play()
	local raycastparams = RaycastParams.new()
	raycastparams.FilterDescendantsInstances = {player.Character}
	raycastparams.FilterType = Enum.RaycastFilterType.Blacklist
	
	local raycastresults = workspace:Raycast(script.Parent.Muzzle.Position,(mousePos - script.Parent.Muzzle.Position)*50)
	if raycastresults then
		local hitpart = raycastresults.Instance
		local model = hitpart:FindFirstAncestorOfClass("Model")
		if model then
			if model:FindFirstChild("Humanoid") then
				model.Humanoid.Health -= 100
				warn("Somebody Has Been Shot ohno!")
			end
		end
	end
end)

4 comments

0

What is the error message?

0

Muzzle is not a valid member of Tool

0

Can you show an image of your path?

0

??