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

How to use raycasting to test if the brick below the basepart is a certain material?

Asked by 4 years ago

I have tried the Roblix Dev and wiki and had no luck in it working.

Can someone please explain to me how it works?

So when the raycast tests the brick is concrete it would do this

        if part then
            if part == Enum.Material.Concrete then
                concrete.Sound.Playing = true
                concrete.Sound.Looped = true
            else
                concrete.Sound.Playing = false
                concrete.Sound.Looped = false
            end
        end

I don't know how to set this up

0
??????? AizakkuZ 226 — 4y
0
if part.Material == "Concrete" then I advise u not to get into ray casting without learning if then statements first wait what this a part??? Yo i'm actually confused what? AizakkuZ 226 — 4y
0
Enum.Material is only used for Terrain AizakkuZ 226 — 4y
1
The Humanoid actually has a property that tells you the material it's standing on: https://developer.roblox.com/en-us/api-reference/property/Humanoid/FloorMaterial PhantomVisual 992 — 4y

1 answer

Log in to vote
0
Answered by
AizakkuZ 226 Moderation Voter
4 years ago
if part then
    if part.Material == "Concrete" then
        concrete.Sound.Playing = true
        concrete.Sound.Looped = true
    else
        concrete.Sound.Playing = false
        concrete.Sound.Looped = false
    end
end
Ad

Answer this question