generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Audio script; once walking on material.

Previous Thread :: Next Thread 
manofarmy12 is not online. manofarmy12
Joined: 15 Mar 2010
Total Posts: 7313
14 Sep 2014 10:23 PM
Question, does anyone know how to make a Part play an audio once stepped on?

Say like the part material is sand, and I want a sand audio to play once you are stepping on it.
How do I make the audio play while a player is walking on the part.?

(Plus, I didn't know if this should have been posted in builder helpers or Scripting Helpers).

Thanks!
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
14 Sep 2014 10:27 PM
A. Create a walking animation
B. Name the Keyframe where the legs should hit the ground something
C. Whenever the AnimationTrack runs that KEYFRAME, Raycast under the legs
D. Play the sound depending if it hits or not and what material it does hit.
Report Abuse
Tynezz is not online. Tynezz
Joined: 28 Apr 2014
Total Posts: 4945
14 Sep 2014 10:48 PM
local mat={["Sand"]=game.Workspace.Sand}--Add more
local touched={"Part1","Part2"}
for i,v in pairs(touched) do
v.Touched:connect(function(hit)
for index,x in pairs(mat) do
if v.Material==index then
local player=game.Players:GetPlayerFromCharacter(hit.Parent)
local sound=x:Clone()
sound.Parent=player.PlayerGui
sound:Play()
end end end) end
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
14 Sep 2014 10:52 PM
Touched is so bad at not running multiple times AND detecting when something touches something.


There's a reason why I said to Raycast instead.
Report Abuse
Tynezz is not online. Tynezz
Joined: 28 Apr 2014
Total Posts: 4945
14 Sep 2014 10:53 PM
@bebee
Good point.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image