Self Check-In Errors

Hello everyone, recently I was coding a self check-in system for my hotel… I was running into some errors, I made it so when you click a part it opens a screen gui and then there is more buttons going to other screen guis… I encountered an error with it based off here:

Rooms1 = game.StarterGui.Rooms1

Bin = script.Parent.Parent.Parent.Parent

function onClicked(pleyer)

Rooms1.Enabled = true

wait(0.1)

Bin.Enabled = false

end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

The reason why this does not seem to work is because I built the system like this:

Please let me know what I did wrong and how to fix it, thanks…

3 Likes

Download the Self Check-In System I have right here and see what my mistakes were…

Self Check-In.rbxm (36.3 KB)

Rather then doing

game.StarterGui

You should be getting the LocalPlayer’s PlayerGui,

1 Like

How would I do that? I am new to roblox coding…

I do not know where to start… So many issues you should probably be learning instead of scripting. Even if we fix your script you won’t understand what we have written, I am pretty sure no one wants to spoon-feed you. I suggest you read the developer wiki.

1 Like

The StarterGui is all of the UI elements that are replicated over to each client,

You need to get the UI that is actually on the client. Inside of the Player there is a class called “PlayerGui”, that is UI’s that the player can view and see.

local Player = game:GetService("Players").LocalPlayer
local PlayerGui = Player.PlayerGui
local Rooms2 = PlayerGui.Rooms
2 Likes

Thanks I will try it out… I will let you know if I run into another problem.

This is actually an extremely common problem that new scripters run in to.

I really hate the advice that people always give…

I learned Lua from experimenting and trying out basic scripts, this script is rather basic from the looks of it.

3 Likes

I am not sure I am doing this right…

It is basic but it seems like he has little to no experience in Lua. He can’t learn FE from writing random code that comes into his mind (just an example many other things in the script which are wrong). As you can see he is trying to access the local player from a server script and trying to enabled a ScreenGui inside a part.

Good skills but that is irrelevant to this topic. Also I am not saying that you are a bad programmer. We all have had 0 experience in a certain stage. I am just suggesting you to read the wiki or PiL. Try learning the basics and when you do so you can try experimenting with code of your own. If you get stuck we will always be here, you are new to Lua and just writing random code that comes in your mind is not a good idea.

1 Like

This is a common misconception. Objects in StarterGui are cloned into the player’s PlayerGui object, which displays the ScreenGui. To enable it, you will have to use a local script, which means you must use a remote event, which when fired will enable the ScreenGui, like so:

--Server
local function clicked(player)
    remoteEvent:FireClient(player)
end

clickDetector.MouseClick:Connect(clicked)

--Client
local player = players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")

local function serverEvent()
    rooms1.Enabled = true
    
    wait(.1)
    
    bin.Enabled = false
end

remoteEvent.OnServerEvent:Connect(serverEvent)

You can see the PlayerGui in test mode in the explorer.

image

Please don’t bump your topics in the future, this is not allowed as per the developer forum rules :slight_smile:

image I don’t understand this, the underlined stuff… AlsoI already made the part open the screen guis on their own but I have a button in the screen guis that wont open another gui… That’s my issue okay?

Also what do you mean by bump topics?

Keep adding posts to the same topic to get it on to the front page.

Bumping a topic is when you post replies just to move the post up the list of recent posts or to ask the same question multiple times, it’s considered spam on these forums!

That’s also a misconception, that a RemoteEvent has to be used in this scenario. It doesn’t. The entire system for displaying the ScreenGui can be done wholly on the client. The server has no business here. The server only needs to get involved with any functionality that should not be entrusted to the client (such as the actual room assignment and granting of the key).

2 Likes