script.Parent.MouseButton1Click:connect(function()
local players = game.Players:GetChildren()
local weapon = game.Lighting:FindFirstChild(script.Parent.Name)
if weapon then
for i = 1, #players do
game.Lighting.weapon:Clone().Parent = players[i].Backpack
game.Lighting.weapon:Clone().Parent = players[i].StarterGear
end
end
end)
Generic For Loop Isn't Working ? I want weapon to be the script.Parent's name
1 answer
You already got the weapon
Please, please, do not come here with stupid code like this ever again.
script.Parent.MouseButton1Click:connect(function()
local players = game.Players:GetChildren()
local weapon = game.Lighting:FindFirstChild(script.Parent.Name)
if weapon then
for i = 1, #players do
-- weapon is already the thing from game.Lighting
weapon:Clone().Parent = players[i].Backpack
weapon:Clone().Parent = players[i].StarterGear
end
end
end)
5 comments
Are you dumb? It's not, did you even read my question? Instead of doing "game.Lighting.WeaponNameHere:Clone().Parent = player[1].Backpack I want it to be the script parent's name. You clearly haven't worked with war clans.
@Willie that's not nice dude, your question was vague and he answered the best he can, gonna put a moderation on your question...
@GreekGodOfMLG and this isn't rude? "Please, please, do not come here with stupid code like this ever again."
I thought this was Scripting Helpers, not don't give us dumb codes please, I'm not going to bother to help. Maybe he could have just commented, "Could you be more clear please?"
Oh my god. Look. You clearly need to be anywhere but here right now because you have so many issues with that. Guess what bright-eyes, I DID EXACTLY WHAT YOU ASKED.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Nice question description in the question body. It's super helpful.