Hi, I am making a hotel, but I want it so when you get into your room you click a button to change a block's text It is so Reception see what rooms are checked in. But when I do local CheckIn = game.Workspace.Availability201 it does not come in the menu to autofill and it does not work when I do the function and make it so CheckIn.SurfaceGui.TextLabel.Text = Room 201 Taken, it does not work.
Here is my code:
local CheckIn = game.Workspace.Availability201 function onClicked(playerWhoClicked) CheckIn.SurfaceGui.TextLabel.Text = Room 201 Taken end script.Parent.ClickDetector.MouseClick:connect(onClicked)
What do I do?
You might want to change the function to this:
function onClicked(playerWhoClicked) CheckIn.SurfaceGui.TextLabel.Text = "Room 201 Taken" end
Try defining "201" as a variable something similar happend to me and it fixed it for me so maybe it will for you for example ~~~~~~~~~~~~~~~~~ local 201 = room201 ~~~~~~~~~~~~~~~~~
Check that you haven't mispelled it and that it isn't inside a model in the workspace as "game.Workspace.Availability201" is looking for a part that is a child of workspace, not of a model inside the workspace.
If the above is done and it is still erroring try adding this:
game.Workspace:WaitForChild('Availability201')
Also
function onClicked(playerWhoClicked) CheckIn.SurfaceGui.TextLabel.Text = "Room 201 Taken"-- You forgot the speech marks. end