So, I'm trying to make a raycast punch script, and I got stuck on the directioning part of the ray.
What I've Tried
- -CFrame.UpVector
- CFrame.LookVector - CFrame.UpVector
Here is the RayCast Script
local punch = game:GetService("ReplicatedStorage"):WaitForChild("Punch")
local rightPunch = game:GetService("ReplicatedStorage"):WaitForChild("RightPunch")
punch.OnServerEvent:Connect(function(player)
local character = player.Character or player.CharacterAdded:Wait()
if character:FindFirstChild("Humanoid") then
local humanoid = character:FindFirstChild("Humanoid")
local newPunch = humanoid:LoadAnimation(rightPunch)
newPunch:Play()
wait(0.1)
local newRay = Ray.new(character:WaitForChild("Right Arm").Position,(Vector3.FromNormalId(Enum.NormalId.Bottom) * 10))
local ignoreList = {character}
local hit, position = game:GetService("Workspace"):FindPartOnRayWithIgnoreList(newRay,ignoreList)
if hit then
print(hit.Name)
end
end
end)
What I'm Trying To Achieve
- RayCast starts from the Right Arm and goes forward, so I can detect who they have hit.

7 comments
So, how would I format it? (Look In Script Above)
the script looks good, i think you just need to multiply the result for
FromNormalIdby distance...b/c it only returns a direction vector
Alright, ty.
It's kinda not working?
I'm punching it towards a dummy with a humanoid, and nothing is appearing.
hmm