I can't get my tools when I teleported into a map, why?
Here's how the code works: When Player1 equips a tool named "Wooden Sword", then he gets Wooden Sword when he teleported into the map, same goes to if Player2 equips a tool named "Sword", then he gets Sword when he teleported into the map.
--teleport code
local torso = player.Character:WaitForChild("Torso")
local allspawns = math.random(1, #spawns)
local randomspawn = spawns[allspawns]
if randomspawn and torso then
table.remove(spawns, allspawns)
torso.CFrame = CFrame.new(randomspawn.Position + Vector3.new(0, 2, 0))
-- tool giving code
local inventory = game.Players.LocalPlayer.Inventory:GetChildren()
local chosenitem = inventory(1, #inventory)
chosenitem:Clone().Parent = player.Backpack
The teleport code works, just the tool giving code has a problem to operate, can anyone point out the wrong thing on the tool giving code?

2 comments
Are you using a Local Script in the tool giving script? If so, where is the script located?
I used Script and I put it in ServerScriptService.