No this goes into StarterCharacterScripts
I wanna make grass sounds, where do I put grass
You’d put grass into the array like this:
local MaterialTable = {
["Wood"] = 0,
["Concrete"] = 0,
["Grass"] = 0, -- Your ID replaces 0
}
EDIT: Remove the comma on the last array
there is a line on
Grass on left of ‘’
Yeah sorry, remove the comma at the end of the Grass Line. Also, make sure, if you’re not making the Wood or Concrete as custom sounds then you should remove it from the MaterialTable
LocalScript, StarterCharacterScripts.
local Player = game.Players.LocalPlayer
local Character = Player.Character
local DefaultSound = Character.Head:WaitForChild("Running").SoundId
local MaterialTable = {
[Enum.Material.Grass] = "rbxassetid://256575709"
}
local Assets = {"rbxassetid://256575709","rbxassetid://256575709"}
game:GetService("ContentProvider"):PreloadAsync(Assets)
Character.Humanoid:GetPropertyChangedSignal("FloorMaterial"):Connect(function()
local FloorMaterial = Character.Humanoid.FloorMaterial
if MaterialTable[FloorMaterial] then
Character.Head.Running.SoundId = MaterialTable[FloorMaterial]
else
Character.Head.Running.SoundId = DefaultSound
end
end)
Not too much?
also do you know script for jumping sound, just that please?
As long your audio is heard
can you do last thing for me jumping animation?
i mean sound
Could you mark the Thread as the solution so people know what the actual solution is
Also, unfortunately I can’t help too much because you need to learn a bit for your self . We have to start somewhere. But to change the jumping sound is in the Head object under the Player
okay thanks
I’d like to remind you that the Scripting Support category is not an outlet for asking for code. It’s nice to see that you’re learning and all, but try and achieve some of these things alone or look around to see how you can accomplish it. YouTube tutorials are not the only way - there are many other resources available to attempt these problems.
Thanks for telling me a new information.
How would i do this with terrain?
EDIT: Turns out FloorMaterial is suppose to detect terrain, but doesn’t
The Humanoid does detect FloorMaterial but is sometimes buggy.
Try this model I made a while back using this thread and other tutorials.
TerrainSound.rbxm (3.5 KB)
No, this doesn’t really matter much. This error means that Studio is unable to load the texture ID of your material, but as long as you can actually see the material when you play, then this error should not be breaking your gameplay.
Well FloorMaterial works on terrain for me. I made a script that uses FloorMaterial and it works fine on terrain