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

What's wrong with this simple raycast?

Asked by 9 years ago
local findPosColor = function(position)
    local start = Vector3.new(0, 100, 0)
    local part = Workspace:FindPartOnRay(Ray.new(start, (position - start).unit * 500))
    if part then
        return Color3.new(part.BrickColor.Color.r, part.BrickColor.Color.g, part.BrickColor.Color.b)
    end
    return nil
end

error:

Players.Player1.PlayerGui.ScreenGui.Radar.LocalScript:22: bad argument #1 to '?' (Vector3 expected, got number) (line 22 is the local part = ... line)

0
Not too sure, try making the ray on a separate line with a variable, then use FindPartOnRay with the variable you made. Spongocardo 1991 — 9y

Answer this question