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

Generic For Loop Isn't Working ? I want weapon to be the script.Parent's name

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)

1 comment

1

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

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

0

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.

0

@Willie that's not nice dude, your question was vague and he answered the best he can, gonna put a moderation on your question...

0

@GreekGodOfMLG and this isn't rude? "Please, please, do not come here with stupid code like this ever again."

0

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?"

1

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.