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
game.Players.PlayerAdded:connect(function(p) -- triggers when a player joins the server. Also gives me the player (p). p.CharacterAdded:connect(function(c) -- triggers when the character is created or respawned. gives me the character(char) local cloned = game.ServerStorage.ClickDetector:Clone() cloned.Parent = char.Torso end) -- there is a ) at the end because the function and connector line is tied together. This is a cool trick to learn. end)