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: why does this not work :(

Previous Thread :: Next Thread 
jimmysnow02 is not online. jimmysnow02
Joined: 25 Sep 2011
Total Posts: 20169
03 Aug 2015 03:12 PM
local brick = game.Workspace.Brick
brick.BrickColor = BrickColor.new("Brown")
function onTouch(part)
brick.instance.new("Sound")
wait(1)
brick.Sound.Content = ("http://www.roblox.com/Asset/?id=130833677")
brick.Sound:play()
print("*poot*")
end

the first 2 lines work, but the function doesn't
Report Abuse
jimmysnow02 is not online. jimmysnow02
Joined: 25 Sep 2011
Total Posts: 20169
03 Aug 2015 03:13 PM
oh whoops forget the connect >.<
Report Abuse
litalela is not online. litalela
Joined: 30 Mar 2010
Total Posts: 6267
03 Aug 2015 03:15 PM
local brick = game.Workspace.Brick -- would be better to put in brick and do script.Parent
brick.BrickColor = BrickColor.new("Brown")
brick.Touched:connect(function(hit)
local sound = Instance.new("Sound", brick)
wait(1)
sound.SoundId = "http://www.roblox.com/Asset/?id=130833677"
sound:Play()
end)
Report Abuse
myactivetestplace is not online. myactivetestplace
Joined: 11 Jul 2015
Total Posts: 3733
03 Aug 2015 03:16 PM
local brick = game.Workspace.Brick
local debounce = false
brick.BrickColor = BrickColor.new("Brown") --[[Move this to after your function if you want it to change after being touched otherwise it will when the server runs.]]--
script.Parent.Touched:connect(function(part)
if debounce == false then
debounce = true
brick.instance.new("Sound")
wait(1)
brick.Sound.Content = ("http://www.roblox.com/Asset/?id=130833677")
brick.Sound:play()
print("*poot*")
end
debounce = false
end)
Report Abuse
myactivetestplace is not online. myactivetestplace
Joined: 11 Jul 2015
Total Posts: 3733
03 Aug 2015 03:18 PM
If this script is in workspace use this


local b = game.Workspace.Brick -- What you define after local could be as short as b
local debounce = false
brick.BrickColor = BrickColor.new("Brown") --[[Move this to after your function if you want it to change after being touched otherwise it will when the server runs.]]--
b.Touched:connect(function(part)
if debounce == false then
debounce = true
brick.instance.new("Sound")
wait(1)
brick.Sound.Content = ("http://www.roblox.com/Asset/?id=130833677")
brick.Sound:play()
print("*poot*")
end
debounce = false
end)
Report Abuse
jimmysnow02 is not online. jimmysnow02
Joined: 25 Sep 2011
Total Posts: 20169
03 Aug 2015 05:36 PM
i got it myself already but thanks anyway guys
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