Hi,
i make a Script that checks if a Hotel Room is in use or not. There is a TextBox with the name "roomnumberhere" and a button. And there is a Model with the name "freiezimmer", in this model are boolvalues (true = in use, false = not in use). In the TextBox you enter the Number of the Room. That's my code:
script.Parent.MouseButton1Down:connect(function() local roomnumber = script.Parent.Parent.roomnumberhere.Text local checkvalue = game.Workspace.freiezimmer.roomnumber print("working") end)
If i press the Button nothing happens, it just say: roomnumber is not a valid Member of Model. It says the Problem is in Line 3.
You're looking for an object/item named 'roomnumber' when you should be looking for an object that matches the variable. You can use FindFirstChild to find an object which matches the text:
script.Parent.MouseButton1Down:connect(function() local roomnumber = script.Parent.Parent.roomnumberhere.Text local checkvalue = game.Workspace.freiezimmer:FindFirstChild(roomnumber) print("working") end)