Hi, beginner dev here. I am trying to make a script that should sort players into teams, place a tool into one team's inventory, and teleport the players to the map and lobby. The script works perfectly fine, except it won't put the tool into the player's inventory. There are no errors in the script or in output. I have tried dozens (not an exaggeration) of variations of the script but none of them work. I really need somebody to work with me here. Below is part of the script without any of the code that gives the tool to the team. I just need to know what to add to the script to transfer the tool, or if I need to change any other things to make it work.
InRound.Changed:Connect(function()
if InRound.Value == true then
local RandomPlayer = game.Players:GetPlayers()[math.random(1,PlayerCount)]
RandomPlayer.Team = Killer
for _, player in pairs(game.Teams.Lobby:GetPlayers()) do
player.Team = Campers
for _, player in pairs(game.Players:GetChildren()) do
player:LoadCharacter()
end
end
else
for _, player in pairs(game.Players:GetChildren()) do
player.Team = Lobby
local char = player.character
char.HumanoidRootPart.CFrame = Spawn.CFrame
end
end
end)

2 comments
This did not work for me. Also, can I replace 'player' in your script with 'RandomPlayer' in my script without any issues? If not, that may be the issue.
You shouldn't give a tool from a local script. Only from a server script.