RayCasting (GroundCheck)

Hello, Peoples.
I was wondering how I could shoot a raycast from the players feet and detect the part there standing on…
Then blacklist that from the next raycast which would shoot from there head.

            local MyRayCast = Ray.new(Head.CFrame.p, Head.CFrame.LookVector * 100)
            local part = workspace:FindPartOnRay(MyRayCast)


            if part and (Character.HumanoidRootPart.Position - part.Position).Magnitude <= 15 then

I want to do some type of check to make sure there not aiming at the ground/

1 Like

If you want to make sure the player isnt aiming at the ground couldnt you just raycast from the camera position and see if it hits the ground?

1 Like

I guess but how?
My idea was raycast facing down, grab part than blacklist from the raycast

I tried this

            local MyRayCast = Ray.new(Head.CFrame.p, Head.CFrame.LookVector * 100)
            local part = workspace:FindPartOnRay(MyRayCast)

But it seems the ground somehow still gets pickedup

Also stop using Ray.new() as that is deprcated use Workspace:Raycast() instead

This will also work for first person or third person

1 Like

I want it to adapt to whatever the player is standing on.
AE if its a roof filter the roof.
If there standing on the ground filter out the ground.
Whatever there standing on,

Wait but you said you want to detect the ground though? Thats just conter intuitive

Lemmmie re-explain,

Whatever there standing on I wanted blacklisted.
Which was the ground, but I thought what if there standing on a roof.
I still need to filter out whatever is under there feet.

(sorry for bad english)

Then just raycast from the root position downwards

What???

()()()()()()()()()()()()

Sorry to bother, can I know what’s the text font?

no problem, it is called Monospace
image

Is it in the roblox studio font settings?

Because I can’t really find it.

Bruhhhh, this is turned into a off-topic sub

What do you need help with specifically? To raycast facing downwards, just give it a direction of (0, -distance, 0)
Then detect what it hits and do stuff with it.