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

16 comments
I haven't tested this yet, but how do you see script errors log?
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
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 ???
game.Players.LocalPlayer.Backpack.Radio
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
http://prntscr.com/88s9gz there how it looks its not in Services like Players > Player > Backpack its in workspace. how 2 locate it ?
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
Yes but can you make the script enable the particles when its playing and atop when its stopped on clicks? Please?
I updated the answer with the code. If it produces any error, please tell me what it is
"Did you forget a colon? The first argument of member function WaitChild must... thats what i got
oops. Yeah. Common error on my part. it should be Spark = player.WaitForChild("Radio").ParticleEmitter
I mean Spark = player:WaitForChild("Radio").ParticleEmitter So frustrating
Man it still doesn't work...
ParticleEmitter is not a valid member of Part... .-.
Tell me the error this time...
NEVERMIND I FIXED IT Spark = player.Radio.ParticleEmitter THATS WHAT I WROTE THX!!! ANYWAY :3