Raycast only works in the center of the part in my script

Hello

  1. What do you want to achieve? I want the raycast to work when any area of the part is touched

  2. What is the issue?
    the raycast only works/detects when the player is at the very center of the part
    RobloxStudioBeta_78JJZ09W7K

  3. What solutions have you tried so far? i tryed to mess around with the raydirection using vector3 sizes but it didnt work - i couldnt find solutions anywhere

local part = script.Parent

local redPower = script.Parent.redCaptureValue
local bluePower = script.Parent.blueCaptureValue

local processText = script.Parent.CProcess

local function castRay()
	local startPos = part.Position
	local rayDirection = Vector3.new(3, 15, 3)
	
	local rayCastResult = workspace:Raycast(startPos, rayDirection)
	if rayCastResult then
		if rayCastResult.Instance then
			local RaycastPlayer = game.Players:GetPlayerFromCharacter(rayCastResult.Instance.Parent)
			if RaycastPlayer.Team == game.Teams.Axis then
				if part.BrickColor ~= RaycastPlayer.TeamColor then
					if redPower.Value ~= 12 then
						processText.Enabled = true
						wait(1)
						redPower.Value = redPower.Value + 1
					end
					if redPower.Value >= 12 then
						processText.Enabled = false
						part.BrickColor = RaycastPlayer.TeamColor
					end
				end
			elseif RaycastPlayer.Team == game.Teams.Allies then
				if part.BrickColor ~= RaycastPlayer.TeamColor then
					if bluePower.Value ~= 12 then
						processText.Enabled = true
						wait(1)
						bluePower.Value = bluePower.Value + 1
					end
					if bluePower.Value >= 12 then
						processText.Enabled = false
						part.BrickColor = RaycastPlayer.TeamColor
					end
				end
			else
				print("not")
				
			end
		end
	else
		processText.Enabled = false
		redPower.Value = 0
		bluePower.Value = 0
	end
end

while true do
	castRay()
	wait()
end

i recently switched from touchevent to raycast so i hope what im doing is right

  1. Raycast from every player
  2. Have multiple raycasts, I suggest to use attachments to position them, loop through them and do all the magic.