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: what did I do wrong

Previous Thread :: Next Thread 
soutman110 is not online. soutman110
Joined: 20 Oct 2011
Total Posts: 3663
29 Jul 2016 11:46 AM
function onClicked(playerWhoClicked)
Sound:Play()
script.Parent.ClickDetector.MouseClick:connect(onClicked)
Report Abuse
Kodran is not online. Kodran
Joined: 15 Aug 2013
Total Posts: 5330
29 Jul 2016 11:49 AM
you didn't end your function, and make sure you defined the variable Sound.
Report Abuse
soutman110 is not online. soutman110
Joined: 20 Oct 2011
Total Posts: 3663
29 Jul 2016 01:16 PM
function onClicked(playerWhoClicked)
Sound:Play()
local Sound = game.Workspace.GodAndreiPro.Head.Sound
script.Parent.ClickDetector.MouseClick:connect(onClicked)
end

What am I doing wrong? trying to learn fairly new to scripting :D
Report Abuse
Soybeen is online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
29 Jul 2016 01:18 PM
script.Parent.ClickDetector.MouseClick:connect(function(playerWhoClicked)
local Sound = workspace:FindFirstChild("GodAndreiPro").Head.Sound
if sound then Sound:Play() end
end)


Report Abuse
seanbenish is not online. seanbenish
Joined: 31 Jul 2009
Total Posts: 429
29 Jul 2016 01:19 PM
You're connecting the function in the function itself. Just move script.Parent.ClickDetector.MouseClick:connect(onClicked) below the end.


(Strive to improve and inspire. <-> Be inspired by those who strive to become better.) The circle of inspiration.
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