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

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

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

4 comments

0

???????

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?

0

Enum.Material is only used for Terrain

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

1 answer

✓ Accepted answer
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

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