Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Script Doesnt Work? Why?

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)

2 comments

0

can you tell what's your error in the output and what it does if you've no error?

0

Workspace.Script:3: attempt to index a nil value

1 answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.