Hotel Clickdetector Check-in Event

I recently started lua.

I am trying to make my part in workspace which has a click detector. When clicked, it should bring up a GUI for a check in. The Checkin frame is not visible, but should be visible when the part is clicked.

Here’s my Local Script in StarterGUI:

    >  local clickdetector = game.Workspace.Part.ClickDetector

clickdetector.MouseClick:Connect(function()
game.Workspace.CheckInEvent:FireServer()
end)

My RemoteEvent called “CheckInEvent” is in workspace. It’s Script is:

game.Workspace.CheckInEvent.OnServerEvent:Connect(function()
game.StarterGui.CheckInGUI.Frame.Visible = true
end)

Not sure what I did wrong. Might be the Event is in the wrong place. But if you could help me, I would appreciate it.

Regards,
JustOneOfTheKind

1 Like

It won’t be visible if you change it through the StarterGui. You need to change it for the player through their PlayerGui.

It should look like this:

game.Workspace.CheckInEvent.OnServerEvent:Connect(function(player) -- player is default parameter for OnServerEvent
game.Players[player].PlayerGui.CheckInGUI.Frame.Visible = true
end)
1 Like

Would that be for the LocalScript or Script inside the RemoteEvent?

Script. The LocalScript firing the event is fine.