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

How can I use tables with my scenario?

I'm trying to make a script that gives tools for HRs in my group only. I have a script and a folder that holds my tools in one place.

game.Players.PlayerAdded:connect(function(player)
	if player:GetRankInGroup(1238286) >= 20 then
		for _,tool in pairs(script.tools:GetChildren()) do
			local tools = tool:Clone()
			tools = player.Backpack
		end
	end
end)

Right now, I cannot get it to work. What am I doing wrong?

1 answer

On line 5, you set tools to player.Backpack. I'm assuming you meant to set the tool's Parent:

game.Players.PlayerAdded:connect(function(player)
    if player:GetRankInGroup(1238286) >= 20 then
        for _,tool in pairs(script.tools:GetChildren()) do
            tool:Clone().Parent = player.Backpack
        end
    end
end)

Hope this helped.

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