Finding first child problem with Local Character?
01 | local player = game.Players.LocalPlayer |
04 | script.Parent.MouseButton 1 Down:connect( function () |
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' ) |
11 | local Right player.Character.RightFoot:FindFirstChild( 'ParticleR' ) |
15 | local Sparkles 1 = game.ReplicatedStorage.Superfast |
16 | local clone 1 = Sparkles 1 :Clone() |
17 | clone 1. Name = 'ParticleL' |
18 | clone 1. Parent = player.Character.LeftFoot |
19 | local clone 2 = Sparkles 1 :Clone() |
20 | clone 2. Name = 'ParticleR' |
21 | clone 2. Parent = player.Character.RightFoot |
22 | player.ShopItems.ParticleEquipped.Value = 'Superfast' |
23 | elseif player.Coins.Value > = 100 and player.ShopItems.Superfast.Value = = 'false' then |
24 | script.Parent.Text = 'Purchase successful' |
25 | script.parent.BackgroundColor 3 = Color 3. fromRGB( 69 , 255 , 112 ) |
26 | script.Parent.AutoButtonColor = false |
28 | script.Parent.Text = 'Equip' |
29 | player.ShopItems.Superfast.Value = 'true' |
30 | script.Parent.BackgroundColor 3 = Color 3. fromRGB( 255 , 255 , 255 ) |
31 | script.Parent.AutoButtonColor = true |
33 | script.Parent.Text = 'OOF not enough coins' |
34 | script.Parent.AutoButtonColor = false |
35 | script.Parent.BackgroundColor 3 = Color 3. fromRGB( 254 , 69 , 69 ) |
37 | script.Parent.BackgroundColor 3 = Color 3. fromRGB( 255 , 255 , 255 ) |
38 | script.Parent.Text = 'Buy for 100 Coins' |
39 | script.Parent.AutoButtonColor = true |
Some stuff no listed is that a sparkle particle emitter is placed into the right and left foot of the local player.
1 | Players.legoch 12. PlayerGui.Shop.Shop 1. 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