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

Whats wrong with this?

So im trying to give ALL the players in this :

--[iLegimate]--

-- NotesToDo --
-- Make fishing rods,Follow giveTools function --

--[Shortcuts]--
Players = game.Players:GetChildren()






--[Functions]--

function giveTools()
	sr = game.ReplicatedStorage["TOOL_Drive"].StarterRod:clone()
	sr.Parent = Players.Backpack
end


wait(5)
giveTools()

But its not working? Help out?

6 comments

0

is it in localscript?

0

No its a script in workspace.

0

I believe it needs to be in a LocalScript in StartGui so you can set the Parent to Game.Players.LocalPlayer.Backpack

0

Oh and after .StarterRod theres :clone()

0

Nono,That will only work for that player,So if i put it in your starterGUI as local script,It works fine for you but if someone joins late their script is local.

0

oh ok

1 answer

✓ Accepted answer
--[iLegimate]--

-- NotesToDo --
-- Make fishing rods,Follow giveTools function --

--[Shortcuts]
Players = game.Players:GetChildren() -- Putting dashes around your Shortcuts comment screwed this part up. Try not to put double dashes after every comment as it will turn your script into comments.






--[Functions]--

function giveTools()
    sr = game.ReplicatedStorage["TOOL_Drive"].StarterRod:clone()
    for i = 1, #Players do -- Gives sr to every single player.
        sr.Parent = Players[i].Backpack
    end
end


wait(5)
giveTools()

So the script gets all the players, and the for loop gives it to every player, since giving the tool to Players.Backpack would not work. If you have any problems, just comment.

2 comments

0

Thanks

0

Your welcome! :)

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