Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make radio display particles with emitter ?

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

1 answer

✓ Accepted answer

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)

16 comments

0

I haven't tested this yet, but how do you see script errors log?

0

If you are testing this in roblox Studio, go to "View" and click output window. Else, you could hit f9 in a game and click on "Server console". Errors will be in red

0

It doesn't work when player joins the particles are in Radio which means in his inventory and script locates that it's in script.Parent.Parent.ParticleEmitter which means in radio but it locates that in playergui how i locate the radio which is in players inventory ???

0

game.Players.LocalPlayer.Backpack.Radio

0

The radio is in game.workspace.Player1 which means when any random name is there i dont know how to locate it. the player1 name im testing in solo and in backpack theres nothing actually

0

http://prntscr.com/88s9gz there how it looks its not in Services like Players > Player > Backpack its in workspace. how 2 locate it ?

0

I was under the assumption that by "Inventory", you meant the player's backpack. In that case, You've already defined your player, which won't change even if his name isn't Player1. Look at this segment --local player = game.Players.LocalPlayer.Character-- It defines the model Player1 as the variable player. Thus, radio is player.Radio

0

Yes but can you make the script enable the particles when its playing and atop when its stopped on clicks? Please?

0

I updated the answer with the code. If it produces any error, please tell me what it is

0

"Did you forget a colon? The first argument of member function WaitChild must... thats what i got

0

oops. Yeah. Common error on my part. it should be Spark = player.WaitForChild("Radio").ParticleEmitter

0

I mean Spark = player:WaitForChild("Radio").ParticleEmitter So frustrating

0

Man it still doesn't work...

0

ParticleEmitter is not a valid member of Part... .-.

0

Tell me the error this time...

0

NEVERMIND I FIXED IT Spark = player.Radio.ParticleEmitter THATS WHAT I WROTE THX!!! ANYWAY :3

This discussion is preserved as it was. New answers, comments, and votes are closed.