Okay, so this script is seemingly long. But I just have a problem with a couple lines. I'll comment out the portion I need help with. But before you read, here's the problem:
I'm trying to make the Player receive a tool titled "Sword" upon position movement. Everything works well, it loops successfully, the tool is added and removed, but it doesn't show in the Player's inventory. It just shows it in StarterPack temporarily but the player has is in no way capable of reaching it through each round. If someone can please help, as mentioned before, the assumed main problem area is commented out. Thanks a lot, here's the full script:
minigames = game.Lighting.minigame:GetChildren() h = Instance.new("Hint", game.Workspace) while true do if game.Players.NumPlayers > 1 then h.Text = "Starting new round.." RandomGame = math.random(1, #minigames) ChosenGame = minigames[RandomGame] wait(4) h.Text = "Game Chosen:" .. ChosenGame.Name GameChosenClone = ChosenGame:Clone() GameChosenClone.Parent = game.Workspace wait(3) spawns = GameChosenClone.Spawns:GetChildren() --tool = game.Lighting.Sword:Clone() --for i,v in pairs(game.Players:GetPlayers()) do --name = v.Name --check = game.Workspace:FindFirstChild(name) --if check then --checkHumanoid = check:FindFirstChild("Humanoid") --if checkHumanoid then --check:MoveTo(spawns[i].Position) --wait(3) --tool.Parent = game.StarterPack end end end for i = 3,1,-1 do h.Text = "Game will start in" .. i end for i = 10,1, -1 do h.Text = "Game ends in.." .. i wait(1) end h.Text = "Game has ended!" GameChosenClone:Destroy() tool:Destroy() wait(2) else h.Text = "Game cannot start unless there are 2+ players" end wait(1) end
player.Character:MoveTo(Position) game.Lighting.Tool:Clone().Parent = player.Backpack
You have one clone of the tool,
tool, and you are trying to parent that to all the players. To fix this, you just Clone the tool when you're going to parent it.
tool:Clone().Parent = v.Backpack