I want to clone the Click Detector into every players torso when they are in the game! Please help! Im still learning for loops and I cant find a good explanation so I tried some youtube videos and this doesnt work Please Help!
for i,v in pairs(game.Players:GetPlayers()) do
name = v.Name
check = game.Workspace:FindFirstChild(name)
if check then
c = game.ServerStorage.ClickDetector:Clone()
c.Parent = v.Character.Torso
end
end

1 comment
Your use of
checkis long-winded. You could condense that all into one line:if workspace:FindFirstChild(v.Name) thenOf course, it would make more sense to actually checkv.Character. Additionally, you forget to check that the Torso exists!