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 » Scripters
Home Search
 

Re: Sound on touch not working.

Previous Thread :: Next Thread 
TaintedSkies is not online. TaintedSkies
Joined: 15 Apr 2010
Total Posts: 98
25 Jan 2015 02:17 PM
I'm new to scripting, so if this is way off, that's the reason. Here's my script:

local part = game.Workspace.Part

function onTouch(part)
part.Sound:play()
wait(5)
part.Sound:Stop()
end

part.Touch:connect(onTouch)

I entered the sound ID in the Workspace thing, is there anything I could be missing ?
Report Abuse
iGotRekt is not online. iGotRekt
Joined: 23 Jan 2014
Total Posts: 831
25 Jan 2015 02:20 PM
"part.Sound:play()"
:Play()

✗ вυяиσυт699 » ɪGᴏᴛRᴇᴋᴛ
Report Abuse
Eternalfireeater is not online. Eternalfireeater
Joined: 01 May 2011
Total Posts: 10027
25 Jan 2015 02:24 PM
@iGot
Not case sensitive.

Are there multiple objects named "part" in workspace?
Report Abuse
iiLinked is not online. iiLinked
Joined: 05 Oct 2012
Total Posts: 42
25 Jan 2015 02:28 PM
if its in a group then do this
local part = game.Workspace.(put the name here like if you just did it without renaming it would be Model).Part

function onTouch(part)
part.Sound:play()
wait(5)
part.Sound:Stop()
end

part.Touch:connect(onTouch)
Report Abuse
TaintedSkies is not online. TaintedSkies
Joined: 15 Apr 2010
Total Posts: 98
25 Jan 2015 02:33 PM
@Eternal,
Yes, I realised that and changes the name of the part to 'Brick', as well as the ones in the script.

@iiLinked,
No, it's not in a group.

Still doesn't work.
Report Abuse
Eternalfireeater is not online. Eternalfireeater
Joined: 01 May 2011
Total Posts: 10027
25 Jan 2015 02:47 PM
Try this:
-----
part = workspace.Brick;
d = false;

part.Touched:connect(function(h)
if d == false then
d = true;
part.Sound:play();
wait(5);
part.Sound:stop();
wait();
d = false;
end
end)
-----
Report Abuse
025110 is not online. 025110
Joined: 23 Nov 2012
Total Posts: 57661
25 Jan 2015 02:50 PM
wtf are you all doing..


local db = false

script.Parent.Touched:connect(function(p)
if p:FindFirstChild("Humanoid") then
if not db then
db = true
script.Parent.Sound:Play()
db = false
end
end
end)


R$3,070
Report Abuse
Eternalfireeater is not online. Eternalfireeater
Joined: 01 May 2011
Total Posts: 10027
25 Jan 2015 02:52 PM
@02
Take a look at the OP's code. He only wants to play 5 seconds of the sound.
Report Abuse
TaintedSkies is not online. TaintedSkies
Joined: 15 Apr 2010
Total Posts: 98
25 Jan 2015 02:56 PM
Thanks! It works now. I appreciate your help.
Report Abuse
parkiet3 is not online. parkiet3
Joined: 16 Jul 2011
Total Posts: 832
25 Jan 2015 03:51 PM
Easy explaination

You made 2 parameters both called part
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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