|
| 26 Mar 2017 09:00 AM |
So, I'm a total noob at scripting and I want to know how to use functions in a bool (probably not the right term to use lol), for example, if I want a property to change when a event/function occurs.
In this case, I'm trying to make it so that a smoke object's "enabled" property will be activated if a sound plays, and this is all registered under a clickdetector. This is what I have so far.
local smoke = Inst#####################o##############alse smoke.parent = game.Workspace.cannon.barrel
local sound = Instance.new ("Sound") sound.SoundId = "eedoesntmatterrr" sound.parent = game.workspace.cannon.barrel
barrel = script.Parent
function shoot()
if sound:Play = true then smoke.Enabled = true else smoke.Enabled = false end end
barrel.ClickDetector.MouseClick:connect(shoot)
Yeah, make fun of me if you want if it's a horrendous failure :P
But, how would I actually do this, since what might be the problem is how I registered the smoke, and also how I used the sound:Play
|
|
|
| Report Abuse |
|
|
|
| 26 Mar 2017 09:02 AM |
| whenever sound is changed, and is playing, you simply add smoke to it. |
|
|
| Report Abuse |
|
|
|
| 26 Mar 2017 09:05 AM |
Censoring won't let the first part in..
Let's just change "smoke" to "bunnies"
local bunnies = Instance.new("Bunnies") Bunnies.enabled = false
|
|
|
| Report Abuse |
|
|
|
| 26 Mar 2017 09:06 AM |
sound.Changed:connect(function() if sound.Playing then end end)
capitalist atheist |
|
|
| Report Abuse |
|
|
|
| 26 Mar 2017 09:07 AM |
| ######### Like I said, I'm new so I'm not entirely sure how to do that, sorry Can you give me a sample of the script or something |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 26 Mar 2017 09:19 AM |
| Still not working, I think I didn't register smoke.Enabled the way I should |
|
|
| Report Abuse |
|
|
|
| 26 Mar 2017 09:22 AM |
> sound.parent sound.Parent |
|
|
| Report Abuse |
|
|