Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Local does not recognize part. What Do I do?

Asked by 7 years ago
Edited 7 years ago

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?

0
I have a click detector in the button BTW. vinniehat54 18 — 7y

3 answers

Log in to vote
0
Answered by 7 years ago

You might want to change the function to this:

function onClicked(playerWhoClicked)
    CheckIn.SurfaceGui.TextLabel.Text = "Room 201 Taken"
end
Ad
Log in to vote
0
Answered by 7 years ago

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 ~~~~~~~~~~~~~~~~~

Log in to vote
0
Answered by 7 years ago

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
0
I tried that, but the Output says Availability201 is not in the workspace. Even though it is. vinniehat54 18 — 7y

Answer this question