How to make a raycast visible?

Hello there, I have a problem. I’m doing raycasting for making my gun and I ran into this problem. I want to visualize the bullet path but I don’t know how. I’ve looked everywhere but I can’t find a solution. :P

Code:

script.Parent.ShootEvent.OnServerEvent:Connect(function(player,mousePos)
	local raycastParams = RaycastParams.new()
	raycastParams.FilterDescendantsInstances = {player.Character}
	raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
	
	local result = workspace:Raycast(script.Parent.Handle.Position, (mousePos-script.Parent.Handle.Position)*300,raycastParams)
	
	if result then
		local hitPart = result.Instance
		local model = hitPart:FindFirstAncestorOfClass("Model")
		
		if model then
			if model:FindFirstChild("Humanoid") then
				model.Humanoid:TakeDamage(20)
			end
		end
	end
end)

Please help :))

Edit: BTW this is in a script.

First result on google for “roblox visualize raycast” :slight_smile: :

um wow ok thanks im really stupid