Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make a ray cast downwards?

Hi!

So I want to cast a ray from a part in the player's Character. The script casts the ray but the problem is the ray goes forward, not downward like I want it to. I'm using lookVector so I tried rotating the part but the ray still goes forward. Any idea why?


local player = game.Players.LocalPlayer
local char = player.Character
local LookPart = char:WaitForChild("Chest1"):WaitForChild("Look")
while true do
	wait(1)
	local ray = Ray.new(LookPart.CFrame.p, LookPart.CFrame.lookVector * 300)
end

1 answer

✓ Accepted answer
local player = game.Players.LocalPlayer
local char = player.Character
local LookPart = char:WaitForChild("Chest1"):WaitForChild("Look")
while true do
    wait(1)
    local ray = Ray.new(LookPart.CFrame.Position, LookPart.CFrame.UpVector * -300)
end

2 comments

1

Thank you!

0

mhm

This discussion is preserved as it was. New answers, comments, and votes are closed.