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

Whats wrong with this?

Asked by
iLegitus 130
9 years ago

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?

0
is it in localscript? NinjoOnline 1146 — 9y
0
No its a script in workspace. iLegitus 130 — 9y
0
I believe it needs to be in a LocalScript in StartGui so you can set the Parent to Game.Players.LocalPlayer.Backpack NinjoOnline 1146 — 9y
0
Oh and after .StarterRod theres :clone() iLegitus 130 — 9y
View all comments (2 more)
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. iLegitus 130 — 9y
0
oh ok NinjoOnline 1146 — 9y

1 answer

Log in to vote
0
Answered by
Nifer2 174
9 years ago
--[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.

0
Thanks iLegitus 130 — 9y
0
Your welcome! :) Nifer2 174 — 9y
Ad

Answer this question