Raycast doesn't raycast (i think)

I can’t tell whether i am doing something stupid, but my raycast just, doesn’t raycast.

local function DealDamage()
		local RANGE = meleeInfo[tool.Name]["RANGE"] -- This is a number, something like 5 for example
		
		-- Raycast parameters;
		local origin = player.Character.HumanoidRootPart
		local raycastParams = RaycastParams.new()
		
		raycastParams.FilterDescendantsInstances = {player.Character}
		raycastParams.FilterType = Enum.RaycastFilterType.Exclude
		
		local hitReg = workspace:Raycast(origin.Position, direction * RANGE, raycastParams)
		
		SwingSound:Play()
		SwingSound.PlaybackSpeed = 1
		stamina.Value -= COMBO_STAMINA_CONSUMPTION
		player.Regenerating.Value = false
		
		-- Check if any buffs are active;
		if player:GetAttribute("Berserk") then
			COMBO_DAMAGE = COMBO_DAMAGE * 2
		end
		
		if hitReg then
			print("Found something lol") -- doesn't print :(
			local character = hitReg.Instance.Parent
			
			if character:FindFirstChild("Humanoid") and not Players:GetPlayerFromCharacter(character) then
				local humanoid = character.Humanoid
				humanoid:TakeDamage(COMBO_DAMAGE)
				DamageIndicatorEvent:FireClient(player, COMBO_DAMAGE, character)
				CheckForKill(humanoid)
			end
		end
	end

Where’s the direction for the raycast? I can’t see it defined in the snippet

eep sorry i went to bed

the direction is mouse.hit.position that the client sends

it should be:

local direction = (mouse.Hit.Position - origin.Position)
1 Like

image

i forgot about that :sob:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.