So i got my own decal for Particle Emitter and what i want to do when player presses play the particles emit and when stops i want it to stop emitting. y doesn't it work ?
wait(0.1) local sound = Instance.new("Sound") sound.Volume=1 sound.Pitch=1 sound.Name="" sound.Looped=true sound.PlayOnRemove=false local player = game.Players.LocalPlayer.Character sound.Parent = player.Radio local Format = "http://www.roblox.com/asset/?id=##ID##" local frame = script.Parent:WaitForChild("Frame") Spark = script.Parent.Parent.ParticleEmitter frame:WaitForChild("Play").MouseButton1Click:connect(function() local input = tonumber(frame:WaitForChild("Input").Text) if input then sound:Stop() sound.SoundId=Format:gsub("##ID##", tostring(input)) sound:Play() Spark:Enabled() end end) frame:WaitForChild("Stop").MouseButton1Click:connect(function() sound:Stop() Spark:Enabled() end)
help
From a first glance, you aren't turning on and off the particle emitter in a valid way. Enabled() is not a default function of Particle emitter, meaning it won't do anything and might return an error.
In order to turn a particle emitter on or off, you need to set the boolean property "Enabled" to true or false respectively.
So instead of Spark:Enabled(), use this to turn it on,
Spark.Enabled = true
and this to turn it off
Spark.Enabled = false
Thus the final product would look like
wait(0.1) local sound = Instance.new("Sound") sound.Volume=1 sound.Pitch=1 sound.Name="" sound.Looped=true sound.PlayOnRemove=false local player = game.Players.LocalPlayer.Character sound.Parent = player.Radio local Format = "http://www.roblox.com/asset/?id=##ID##" local frame = script.Parent:WaitForChild("Frame") Spark = player:WaitForChild("Radio").ParticleEmitter frame:WaitForChild("Play").MouseButton1Click:connect(function() local input = tonumber(frame:WaitForChild("Input").Text) if input then sound:Stop() sound.SoundId=Format:gsub("##ID##", tostring(input)) sound:Play() Spark.Enabled = true end end) frame:WaitForChild("Stop").MouseButton1Click:connect(function() sound:Stop() Spark.Enabled = false end)