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

How can I change ROBLOX player walk sound when he steps on two types of terrain material?

I have two sounds that I want to play when a player walks on the terrain of a forest. I want a stone sound to play on the stone material and a grass sound on the grass. I've been trying but the sound is sped up and normally doesn't load sometimes.

--Sound Names

--STONE: StoneWalk:Play() --GRASS: GrassWalk:Play()

thanks!

1 answer

✓ Accepted answer

so, you cant necessarily play it specifically on the terrain, but you can add a block around the terrain, and if the player touches it, it plays the sound.

script.Parent.Touched:Connect(function(hit)
if hit,Parent = Humanoid then
local sound = script:WaitForChild("YOUR SOUND") --MUST BE LOCAL SCRIPT
while true do
sound:Play()
wait(1)
            end
      end
end)
script.Parent.TouchEnded:Connect(function()
sound:Stop() -- stop might be wrong, you can search it up
end)

5 comments

0

you can do the same with the rock, just make a different part

0

line #2 is incorrect | please indent

0

just place a dot where the "," is

0

Hey can you do this when a car drives on a certain material such as a concrete sound? u know.. that loud noise when ur on a highway. Is there anyway it can get a higher pitch as the car increases speed? thanks

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