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
|
  |
| 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
|
  |
| Joined: 25 Jul 2009 |
| Total Posts: 4444 |
|
| |
|
LuckyAura
|
  |
| Joined: 25 Jul 2009 |
| Total Posts: 4444 |
|
| |
|
| |
|
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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 25 Jul 2009 |
| Total Posts: 4444 |
|
| |
|
LuckyAura
|
  |
| Joined: 25 Jul 2009 |
| Total Posts: 4444 |
|
| |
|
LuckyAura
|
  |
| Joined: 25 Jul 2009 |
| Total Posts: 4444 |
|
| |
|
LuckyAura
|
  |
| Joined: 25 Jul 2009 |
| Total Posts: 4444 |
|
| |
|
|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| Joined: 25 Jul 2009 |
| Total Posts: 4444 |
|
| |
|
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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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 |
|
|