I'm finding it hard to make a script, that allows each part named something, like for example grass, have a sound when you step on it. I made a script with a function, and well here it is: function touch(hit)
function touch(hit) if hit.Name == "Grass" then end end script.Parent.Touched:connect(touch) Workspace.sound.play() wait(1) Workspace.sound.play() wait(1) loop end
Please help me with this script, maybe find some errors, i don't want a link to a model, i need help. So am i doing anything wrong?
workspace.Part.Touched:connect(function(hit) -- .Touched if hit.Name == "grass" then print("Nothx") else workspace.Sound:Play() wait(1) workspace.Sound.Looped = true --False if not supposed to loop end end)
--In order to loop the sound, you must set it's "Looped" property to true; Sound.Looped=true --Also, the sound in your code wouldn't play as you'd want since it's not connected to the event