Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago
Edited 4 years ago

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
0
game.Players:GetChildren() returns a table of players. This might be helpful. https://developer.roblox.com/en-us/articles/Table#iterating-over-arrays k3du53 162 — 4y
0
Its funny how this is called scripting helpers when no one helps (no offense) true_200ping 2 — 4y
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 RebornedSnoop 175 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

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.

Ad

Answer this question