I am making a Minigame like thing, and I am quickly making a test so I can adapt with it. So, I went and made a function that gave all players a sword, and I was going to reverse enginner it to make it removed (im gonna have to figure that out my self), But it wont work.
This is the code I did.
function givesword()
local player = game.Players:GetPlayers()
local tool = script.ClassicSword:Clone()
tool.Parent = player.Backpack
end
If anyone knows what I am doing wrong, that will be grateful. Thanks. :P
Details: The gear is inside the script which runs the main game. The location of the script is inside ServerScriptService. Everything else works, except for giving all players the gear.
Update: So, I got the adding the sword part done, I am just having issue with removing the sword from the players.
function removesword()
local players = game.Players:GetPlayers()
for i, player in pairs(players) do
player.Backpack.ClassicSword:Destroy()
end
end
This was my attempt. Ended up breaking the entire cycle. oof.

7 comments
Instead of using Backpack,try using StarterPack
It doesn't work sadly. I think it may have to do with the local 'player', but I am not sure. :P
Do not use StarterPack... the issue is that player is a table.
Iterate table 'player' and give each index a new copy of 'tool'.
if he places the tools in StarterPack people spectating the game will have the tool as well
uhh, i'm an ok scripter, but i dont really understand scripter talk yet. is it alright if someone can explain what is being talked about in a simpler way? thanks. :P
Sorry,my mistake