This helps you understand:
i want to make a bunch of Parts but with the same name i want the script to pick every object named Part1 i don't wana rename the Parts.
This is the problem: the code i made is very easy and short but the point is it does not pick up the objects Named Part1.
(Keep in mind this i can not just make local part1,part2... , that is just going to take a long time to do. there are 50+ parts)
Code:
local Part1 = game.Workspace.All.Part1
local text_Button = game.StarterGui.ScreenGui.TextButton
function onTouched(Part1)
local h = Part1.Parent:findFirstChild("Humanoid")
if h~=nil then
print("Touched")
text_Button.Visible = true
end
end
Part1.Touched:Connect(onTouched)

1 comment
Just a fix for ur script: change if h~=nil then to if h then