Roblox tool isn't working due to a nil value?
Error I get is
(9) Players.supershadnew.Backpack.Power.Use:10: attempt to index local 'player' (a nil value)
So basically the issue is this is supposed to be a consumable item that creates particles inside the player's character, (attempted to move to torso same outcome) as well as change the characters health and max health, walkspeed, and play music as well as start fog. The item works in studio but not in the actual servers.
(supershadnew is my name obv)
01 | local tool = script.Parent |
02 | local player = game.Players.LocalPlayer |
04 | tool.Equipped:connect( function (mouse) |
05 | print ( "Tool equipped!" ) |
06 | tool.Activated:connect( function () |
07 | local so = game.Soundscape.Meow |
09 | local blue = Instance.new( "ParticleEmitter" , player.Character) |
10 | blue.VelocitySpread = 360 |
11 | blue.Size = NumberSequence.new( { NumberSequenceKeypoint.new( 0 , 0.2 ), NumberSequenceKeypoint.new( 1 , 0.2 ) } ) |
13 | blue.LightEmission = 0.4 |
15 | blue.Color = ColorSequence.new(Color 3. new( 0.709804 , 0.85098 , 1 ), Color 3. new( 0.941177 , 0.109804 , 1 )) |
16 | local purple = Instance.new( "ParticleEmitter" , player.Character) |
17 | purple.VelocitySpread = 360 |
18 | purple.Size = NumberSequence.new( { NumberSequenceKeypoint.new( 0 , 0.2 ), NumberSequenceKeypoint.new( 1 , 0.2 ) } ) |
21 | purple.LightEmission = 0.4 |
23 | purple.Color = ColorSequence.new(Color 3. new( 0.709804 , 0.85098 , 1 ), Color 3. new( 0.941177 , 0.109804 , 1 )) |
24 | local music 1 = game.Soundscape.Dub |
25 | local check = player.Character.Humanoid |
29 | local lighting = game.Lighting |
39 | lighting.FogEnd = 100000.000 |