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

Starter pack tool giver and remove command not working?

local com = ";remove gear"
players = game.Players:GetChildren()

game.Players.PlayerAdded:connect(function(player)
	
	if player:GetRankInGroup(42142) >= 7 then
	player.Chatted:connect(function(message)
		if message == com then
			game.players.StarterGear:ClearAllChildren()
			end
		end)
	end
end)

local com2 = ";add SMG"
players = game.Players:GetChildren()

game.Players.PlayerAdded:connect(function(player)
	
	if player:GetRankInGroup(42142) >= 7 then
	player.Chatted:connect(function(message)
		if message == com2 then
			game.ServerStorage.Tools.SMG:Clone().Parent = game.players.StarterGear
			end
		end)
	end
end)

On the ;remove gear command it removes starter gear. On the ;add SMG gear it adds the SMG gun to the starter gear. These commands don't work. Why is this?

3 comments

0

game.ServerStorage.Tools.SMG:Clone().Parent = player:findFirstChild("Backpack") on Line 23

0

Try parenting to the Backpack, and clearing from the Backpack aswell.

0

Remember :GetChildren() returns a table of the children. Also, using :GetPlayers() is a more definite way to know that you're recieving players in that table.

1 answer

Try to make it where it insert the tool into the backpack. Here's a code:

 game.ServerStorage.Tools.SMG:Clone().Parent = game.Players.LocalPlayer.Backpack

If that doesn't work, then try capitalizing "players". You say game.players, that might not work because it's case-sensitive.

game.players.StarterGear --game.Players.StarterGear

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