Help making a checkIn system

  1. What do you want to achieve?
    I want to achieve a checkin system that will give the player a room starting from 101 all the way to the last number.

  2. What is the issue?
    I am making a game called Slithers Hotel and when you click on the computer screen the GUI appears and then I click checkin and it brings me to another GUI. I need help with the choosing a player to give the room to. When I give the player the room, they get room 101 and I click it again and instead of giving room 102 it gives an error saying:
    Room101 is not a valid member of ReplicatedStorage.

  3. What solutions have you tried so far?
    I have tried putting it in a while true do but then it crashes the player and studio.

2 Likes

lol wait, what do you mean by trying “while true do” ?
general knowledge, but all loop should have atleast a wait() or it will indeed crash the server because the loop would have played 9999+ times in one second

my immediate question for you is how do the rooms get into ReplicatedStorage?

The keys go into a folder inside of ReplicatedStorage
Then moved into the player backpack whereas the rooms stay inside of the workspace

ok, so why is it looking for key 101 when it should be key 102 as key 101 has already gone.
Have you done some prints in the scripts to see what is happening.
Can we see the scripts?

I am doing it in separate scripts
The first script:
If Room101.Parent = game.ReplicatedStorage.Keycards then
Room101.Parent = game.players.LocalPlayer:WaitForChild(“Backpack”)

The second script:
If Room101.Parent = game.ReplicatedStorage.Keycards then
Room101.Parent = game.players.LocalPlayer:WaitForChild(“Backpack”)
if Room102.Parent = game.ReplicatedStorage.Keycards then
Room102.Parent = game.players.LocalPlayer:WaitForChild(“Backpack”)

I have indented the if statements.

I have just tested it and now the GUI does not appear at all

Perhaps the second script could use FindFirstChild in the key folder.
As the key 101 has moved it should find 102.

2 Likes

FindFirstChild could work. I have run into a problem now the computer does not show the Gui

Looks like you changed something somewhere.
Please go back over what you have done using this topic as a guide.

Can u show us a demo of the game? I don’t really understand ur problem. Would be really helpful.

From what they say I think they get a choice of what room they want and it gives them a keycard with the name of that room “104”, etc. except it only works on 101.

Ah ok thank u now I understand😄

2 Likes

Try to store the used rooms in a table, and when a player leaves, delete the room from the table

Maybe this helps:

if Room101 then
    if Room101.Parent == game.ReplicatedStorage.Keycards then
        Room101.Parent = game.players.LocalPlayer:WaitForChild(“Backpack”)
    end
end

Repeat that for room 102. If the problem is gone, then you can modify the script as a loop.

Indentation is used to make a script more readable, but it does not affect its performance at all.

I still don’t understand how you define variables Room101 and Room102.

Your code is incorrect.
Instead, it should be:

if game.ReplicatedStorage:FindFirstChild("Room101") then
 -- insert keycard giving code here
elseif game.RepkicatedStorage:FindFirstChild("Room102") then
 -- insert keycard giving code here
else
 -- sorry, there is no more rooms GUI or something like that.

Why? (you don’t have to read this, but it’s better if you wanna understand why there’s a mistake)
You are telling ROBLOX "Can you tell me what is nil's parent?
ROBLOX will return "Sorry, I can’t tell you what is nil's parent, cause nil doesn’t have a parent.
FindFirstChild works like that:
Script: Hey ROBLOX! Could you please tell me if Room101 exists?
CASE ONE, the key is still there
ROBLOX: Yes, it exists!
Script: Okay, running if statement!
CASE TWO, the key is not here
ROBLOX: No, no “Room101” in here?
Script: Okay! Next if statement, going to elseif!

I hope this helped, if it does, mark this as the answer! Have a good day!
Edit: Woohoo! I’m a solution! Yay!

2 Likes

Surprised no one has asked yet, but can you show us the scripts that correlate to the making of this system? It would help us debug your script and give you correct information.

1 Like

Wanted to ask, but figured out what he meant.

1 Like