There’s a folder of parts and each part has a ClickDetector. When an individual part is clicked, I need to change certain properties of the part that was clicked. I’m not sure if this is the most efficient way of setting this up, but I can’t seem to figure out how to pass on the name of the part as a parameter through MouseClick:Connect.
function Scan_Part(Player)
local Player = game.Workspace[Player.Name]
if Player:FindFirstChild("Specific_Tool") then
Part.Transparency = 1
print("Property of " .. Part .. " has been successfully changed!")
end
end
for Each, Part in pairs(game.Workspace.PartFolder:GetChildren()) do
Part.ClickDetector.MouseClick:Connect(Scan_Part)
end
How do I make sure that ‘Part.Transparency = 1’ changes the properties of the specific part that the player clicked on in MouseClick:Connect?