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

Roblox tool isn't working due to a nil value?

Asked by 7 years ago

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)

local tool = script.Parent
local player = game.Players.LocalPlayer

tool.Equipped:connect(function(mouse)
    print("Tool equipped!")
    tool.Activated:connect(function()
        local so = game.Soundscape.Meow
so:Play()
local blue = Instance.new("ParticleEmitter", player.Character)
blue.VelocitySpread = 360
blue.Size = NumberSequence.new({NumberSequenceKeypoint.new(0, 0.2), NumberSequenceKeypoint.new(1, 0.2)})
blue.Name = "blue"
blue.LightEmission = 0.4
blue.Texture = "http://www.roblox.com/asset/?id=275290830"
blue.Color = ColorSequence.new(Color3.new(0.709804, 0.85098, 1), Color3.new(0.941177, 0.109804, 1))
local purple = Instance.new("ParticleEmitter", player.Character)
purple.VelocitySpread = 360
purple.Size = NumberSequence.new({NumberSequenceKeypoint.new(0, 0.2), NumberSequenceKeypoint.new(1, 0.2)})
purple.Rate = 50
purple.Name = "purple"
purple.LightEmission = 0.4
purple.Texture = "http://www.roblox.com/asset/?id=274915234"
purple.Color = ColorSequence.new(Color3.new(0.709804, 0.85098, 1), Color3.new(0.941177, 0.109804, 1))
local music1 = game.Soundscape.Dub
local check = player.Character.Humanoid
check.WalkSpeed=60
check.MaxHealth= 2000
check.Health = 2000
local lighting = game.Lighting
lighting.FogEnd = 800


    local now = os.time()
    tool:Destroy()
music1:Play()
wait(60)

music1:Stop()
lighting.FogEnd = 100000.000



    end
    )
end
)

Answer this question