Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I clone a sword to all players inventory so they can use them?

I have a minigame and I want all the players to receive a sword for one of the minigames. Here is the code i have but it doesn't seem to work:

game.Players:GetChildren(players)
				local sword = game.ServerStorage.ClassicSword
				local copy = sword:Clone()
				copy.Parent = players.Backpack

3 comments

0

game.Players:GetChildren() returns a table of players. This might be helpful. https://developer.roblox.com/en-us/articles/Table#iterating-over-arrays

0

Its funny how this is called scripting helpers when no one helps (no offense)

0

what do you mean he is , he showed u the article so you should read it. thats how a dev should learn scripting by reading and not request others to script it for u

1 answer

I recommend you to use replicatedstorage instead of serverstorage because most of times for me. The tool or item you want to clone doesnt show in serverstorage.

This is how u plrs

for i, player in pairs(Players:GetPlayers()) do

You would probably find this familiar cause its an i , v loop.

Not sure why but i think u shud use a serverscript (if you are not already using one) Hope this helps.

This discussion is preserved as it was. New answers, comments, and votes are closed.