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

How can I use tables with my scenario?

Asked by 7 years ago

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

Log in to vote
0
Answered by
Pyrondon 2089 Game Jam Winner Moderation Voter Community Moderator
7 years ago

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.

Ad

Answer this question