|
| 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 |
|
|
|
| 03 Aug 2015 03:13 PM |
| oh whoops forget the connect >.< |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 03 Aug 2015 05:36 PM |
| i got it myself already but thanks anyway guys |
|
|
| Report Abuse |
|
|