Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Finding first child problem with Local Character?

Asked by 7 years ago
01local player = game.Players.LocalPlayer
02 
03 
04script.Parent.MouseButton1Down:connect(function()
05 
06    if player.ShopItems.Superfast.Value == 'true' and script.Parent.Text == 'Equip' and player.ShopItems.ParticleEquipped.Value ~= 'Superfast' then
07        local Left player.Character.LeftFoot:FindFirstChild('ParticleL')
08        while true do
09        Left:Destroy()
10        end
11        local Right player.Character.RightFoot:FindFirstChild('ParticleR')
12        while true do
13        Right:Destroy()
14        end
15        local Sparkles1 = game.ReplicatedStorage.Superfast
View all 43 lines...

Some stuff no listed is that a sparkle particle emitter is placed into the right and left foot of the local player.

1Players.legoch12.PlayerGui.Shop.Shop1.Superfast.Buy:9: attempt to index local 'Left' (a nil value)

The error I get is above.

What I'm trying to do is make it so it finds the particle emitter in the foot of the player and then destroys it. If possible I would also like to add in a while loop that if it finds one and deletes it it keeps looking to see if there is another one which also stumps me

0
Found the problem! Thanks for viewing legoch12 45 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago
01local player = game.Players.LocalPlayer
02 
03 
04script.Parent.MouseButton1Down:connect(function()
05 
06    if player.ShopItems.Superfast.Value == 'true' and script.Parent.Text == 'Equip' and player.ShopItems.ParticleEquipped.Value ~= 'Superfast' then
07        local Left player.Character.LeftFoot:FindFirstChild('ParticleL'):Destroy()
08        local Right player.Character.RightFoot:FindFirstChild('ParticleR'):Destroy()
09        local Sparkles1 = game.ReplicatedStorage.Superfast
10        local clone1 = Sparkles1:Clone()
11        clone1.Name = 'ParticleL'
12        clone1.Parent = player.Character.LeftFoot
13        local clone2 = Sparkles1:Clone()
14        clone2.Name = 'ParticleR'
15        clone2.Parent = player.Character.RightFoot
View all 37 lines...

Solution for anyone looking

Ad

Answer this question