Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How to make a ray cast downwards?

Asked by 4 years ago

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

Log in to vote
1
Answered by 4 years ago
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
1
Thank you! bruceywayne 35 — 4y
0
mhm The_Pr0fessor 595 — 4y
Ad

Answer this question