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

Script Doesnt Work? Why?

Asked by 8 years ago
if player.Name == "Player" then
    for i,v in pairs(player:findFirstChild("BackPack"):GetChildren()) do
        if v.ClassName == "Tool" then
        v:destroy()
        end
    end
    wait(1)
    game.ReplicatedStorage.Red_Phone:Clone().Parent = player:findFirstChild("BackPack")
    player:findFirstChild("leaderstats").Ping.Value = 999999999
elseif player.Name == "supermanswaqq" then
    for i,v in pairs(player:findFirstChild("BackPack"):GetChildren()) do
        if v.ClassName == "Tool" then
        v:destroy()
        end
    end
    wait(1)
    game.ReplicatedStorage.Superman_Phone:Clone().Parent = player:findFirstChild("BackPack")
    player:findFirstChild("leaderstats").Ping.Value = 999999999
elseif player.Name == "PluginFactory" then
    for i,v in pairs(player:findFirstChild("BackPack"):GetChildren()) do
        if v.ClassName == "Tool" then
        v:destroy()
        end
    end
    wait(1)
    game.ReplicatedStorage.Blue_Phone:Clone().Parent = player:findFirstChild("BackPack")
        player:findFirstChild("leaderstats").Ping.Value = 999999999
elseif player.Name == "darkhero149" then 
    for i,v in pairs(player:findFirstChild("BackPack"):GetChildren()) do
        if v.ClassName == "Tool" then
        v:destroy()
        end
    end
    wait(1)
    game.ReplicatedStorage.Gamestud_Phone:Clone().Parent = player:findFirstChild("BackPack")
        player:findFirstChild("leaderstats").Ping.Value = 999999999
end


 end)
0
can you tell what's your error in the output and what it does if you've no error? XToonLinkX123 580 — 8y
0
Workspace.Script:3: attempt to index a nil value supermanswaqq 65 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

Not sure if this will solve your error but you can use if v:IsA("Tool") then on line 3

Ad

Answer this question