generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Script doesn't always remove ParticleEmitter

Previous Thread :: Next Thread 
LuckyAura is not online. LuckyAura
Joined: 25 Jul 2009
Total Posts: 4444
16 Jan 2017 12:30 PM
I have this inside of a GUI Frame in the ReplicatedStorage. When you click, it's supposed to clone the ############### ## the script, and then remove it. But it doesn't always remove. What is wrong? Me = script.Parent.Parent.Parent.Parent.Parent.Parent Character = Me.Character function onClicked() local particle = script.ParticleEmitter:Clone() particle.Parent=Character.Torso particle.Enabled = true wait(0.35) particle:Destroy() game.Players.LocalPlayer.Character.Torso.ParticleEmitter:Remove() local sound = script.TransformSound:Clone() sound.Parent = Character sound:Play() wait(3) sound:Destroy() end script.Parent.MouseButton1Click:connect(onClicked)
Report Abuse
LuckyAura is not online. LuckyAura
Joined: 25 Jul 2009
Total Posts: 4444
16 Jan 2017 12:30 PM
Me = script.Parent.Parent.Parent.Parent.Parent.Parent
Character = Me.Character

function onClicked()
local particle = script.ParticleEmitter:Clone()
particle.Parent=Character.Torso
particle.Enabled = true
wait(0.35)
particle:Destroy()
game.Players.LocalPlayer.Character.Torso.ParticleEmitter:Remove()
local sound = script.TransformSound:Clone()
sound.Parent = Character
sound:Play()
wait(3)
sound:Destroy()

end
script.Parent.MouseButton1Click:connect(onClicked)
Report Abuse
LuckyAura is not online. LuckyAura
Joined: 25 Jul 2009
Total Posts: 4444
16 Jan 2017 01:48 PM
Help
Report Abuse
LuckyAura is not online. LuckyAura
Joined: 25 Jul 2009
Total Posts: 4444
16 Jan 2017 02:28 PM
BUMP
Report Abuse
HalfPinky456 is not online. HalfPinky456
Joined: 10 Apr 2011
Total Posts: 6236
16 Jan 2017 02:55 PM
any errors in the output?
Report Abuse
LuckyAura is not online. LuckyAura
Joined: 25 Jul 2009
Total Posts: 4444
16 Jan 2017 05:11 PM
18:11:11.955 - ParticleEmitter is not a valid member of Part
18:11:11.957 - Stack Begin
18:11:11.959 - Script 'Players.Player1.PlayerGui.AlbedoGUI.Main.C1.(Albedo AF + UA) Alien X.TransformationFlashAlbedoUAF', Line 10
Report Abuse
LuckyAura is not online. LuckyAura
Joined: 25 Jul 2009
Total Posts: 4444
16 Jan 2017 05:12 PM
I don't think that the ParticleEmitter is even being cloned either as I don't see it
Report Abuse
LuckyAura is not online. LuckyAura
Joined: 25 Jul 2009
Total Posts: 4444
16 Jan 2017 05:14 PM
Alright, I think what I said above applies to Studio, as I see it in game but it's not being removed.
Report Abuse
LuckyAura is not online. LuckyAura
Joined: 25 Jul 2009
Total Posts: 4444
16 Jan 2017 06:26 PM
:C
Report Abuse
LuckyAura is not online. LuckyAura
Joined: 25 Jul 2009
Total Posts: 4444
16 Jan 2017 08:38 PM
H E L P.
Report Abuse
LuckyAura is not online. LuckyAura
Joined: 25 Jul 2009
Total Posts: 4444
16 Jan 2017 09:28 PM
bump
Report Abuse
LuckyAura is not online. LuckyAura
Joined: 25 Jul 2009
Total Posts: 4444
17 Jan 2017 11:25 AM
hey look another bump
Report Abuse
UltimateRaheem is not online. UltimateRaheem
Joined: 10 Nov 2012
Total Posts: 1886
17 Jan 2017 11:28 AM
Use the WaitForChild(); function and check if the ParticleEmitter is being cloned.


Want to be supported by developers in a positive atmosphere? Then join Studio BSD: https://www.roblox.com/My/Groups.aspx?gid=1013064
Report Abuse
pketny is not online. pketny
Joined: 27 Dec 2010
Total Posts: 1162
17 Jan 2017 11:28 AM
Aren't you trying to :Destroy() it first and then :Remove() it here:

particle:Destroy()
game.Players.LocalPlayer.Character.Torso.ParticleEmitter:Remove()

?
Report Abuse
UltimateRaheem is not online. UltimateRaheem
Joined: 10 Nov 2012
Total Posts: 1886
17 Jan 2017 11:29 AM
He shouldn't even be using the Remove(); function


Want to be supported by developers in a positive atmosphere? Then join Studio BSD: https://www.roblox.com/My/Groups.aspx?gid=1013064
Report Abuse
LuckyAura is not online. LuckyAura
Joined: 25 Jul 2009
Total Posts: 4444
17 Jan 2017 11:48 AM
It's being cloned, I'm just having the problem with it not always being removed.
When you click the ImageButton multiple times, you can spam it and it just stays unremoved. It removes if you click it once but not always.

I tried the game.Players.LocalPlayer.Character.Torso.ParticleEmitter:Remove() part because particle:Destroy() wasn't really working
Report Abuse
UltimateRaheem is not online. UltimateRaheem
Joined: 10 Nov 2012
Total Posts: 1886
17 Jan 2017 11:50 AM
Then it's something else in your code.


Want to be supported by developers in a positive atmosphere? Then join Studio BSD: https://www.roblox.com/My/Groups.aspx?gid=1013064
Report Abuse
LuckyAura is not online. LuckyAura
Joined: 25 Jul 2009
Total Posts: 4444
17 Jan 2017 12:09 PM
Obviously... if I knew what it was I wouldn't be posting..
Report Abuse
LuckyAura is not online. LuckyAura
Joined: 25 Jul 2009
Total Posts: 4444
17 Jan 2017 12:49 PM
Bumparoo
Report Abuse
pketny is not online. pketny
Joined: 27 Dec 2010
Total Posts: 1162
17 Jan 2017 01:04 PM
local Me = game.Players.LocalPlayer
Character = Me.Character or Me.CharacterAdded:wait()

function onClicked()
local particle = script.ParticleEmitter:Clone()
particle.Parent=Character.Torso
particle.Enabled = true
wait(0.35)
particle:Destroy()

--[[local sound = script.TransformSound:Clone()
sound.Parent = Character
sound:Play()
wait(3)
sound:Destroy()]]

end
script.Parent.MouseButton1Click:connect(onClicked)

this works 100% for me,

Hierarchy:
StarterGui
ScreenGui
TextButton
LocalScript
ParticleEmitter
Report Abuse
LuckyAura is not online. LuckyAura
Joined: 25 Jul 2009
Total Posts: 4444
17 Jan 2017 01:37 PM
@pketny Thanks, but I don't really notice much of a difference. It does work, but I spam the ImageButton and the ParticleEmitter does not get removed like it's supposed to.
Report Abuse
LuckyAura is not online. LuckyAura
Joined: 25 Jul 2009
Total Posts: 4444
17 Jan 2017 01:39 PM
I have a tool open the GUI for the player (that the ImageButton is in) so you can keep opening the tool and pressing the button and it won't remove anymore
Report Abuse
pketny is not online. pketny
Joined: 27 Dec 2010
Total Posts: 1162
17 Jan 2017 01:43 PM
Aah I see, I know what the problem is now,

Try this:

local Me = game.Players.LocalPlayer
Character = Me.Character or Me.CharacterAdded:wait()

function onClicked()
local particle = script.ParticleEmitter:Clone()
game:GetService("Debris"):AddItem(particle, .35)
particle.Parent=Character.Torso
particle.Enabled = true

wait(.35)
local sound = script.TransformSound:Clone()
game:GetService("Debris"):AddItem(sound, 3)
sound.Parent = Character
sound:Play()
wait(3)

end
script.Parent.MouseButton1Click:connect(onClicked)
Report Abuse
LuckyAura is not online. LuckyAura
Joined: 25 Jul 2009
Total Posts: 4444
17 Jan 2017 01:50 PM
That works, thanks so much!

How would making this work for ALL ImageButtons in a GUI work? I'd like to have one main script instead of having to copy and paste it inside of all the ImageButtons.
Report Abuse
pketny is not online. pketny
Joined: 27 Dec 2010
Total Posts: 1162
17 Jan 2017 01:52 PM
Loop trough the buttons using for and getchildren()

then connect on mouse click to the function

that is if they all do the same thing

Else just declare them one by one and connect them one by one
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image