I have a Model in workspace named "idcodes"
Workspace
-idcodes
--Value
---Value = "1"
--Value
---Value = "2"
--Value
---Value = "3"
I then have a button inside ScreenGui in StarterGui
StarterGui
-ScreenGui
--TextButton
---LocalScript Code:
script.Parent.MouseButton1Click:connect(function()
for i,v in pairs(game.Workspace.idcodes:GetChildren()) do
print(v.Value);
if script.Parent.ID.Text == v.Value then
print("worked")
end;
end
end)
---ID (TextLabel)
When I click TextButton, if ID's text ='s one of the values in idcodes ("1","2",or "3), the output prints "Worked" |