So my ray is casting from the origin of the player's left arm, however I want it to go in the -x direction (away from the character's arm to the left). However I'm not doing it right because it's not hitting anything any tips?

local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait() 
local LeftArm = Character["Left Arm"].Position
local leftarmobj = Character["Left Arm"]

local root = Character:WaitForChild("HumanoidRootPart")

	

while true do
	wait(0.1)
	
	local ray = Ray.new(leftarmobj.CFrame.p, Vector3.new(-35,0,0) * 500)
	local hit, hitposition = workspace:FindPartOnRay(ray, Character)
if hit then
    print("something ha been hit")
    end
end

2 comments

0

You're doing this on the client. You should do this on the server. Also, Are you using R6 or R15? Cos the script will break if you use R15.

0

Im using R6, this is a local script in start character scripts.