I wrote this script that when you click a button, it says you own the room, and nobody else can take it until you check out. When you click check out, it says nobody owns the room anymore and other people can claim it. This works in studio, however it doesn't work in game or local server test. What happens is you can check in once and then check out once, but after that when you try to check in again a second time, it says you own it for a split second, before it says nobody owns it again. This happens every time you try to claim it after the second try. Here are my scripts:
-- client side
taken = false
local function OnClick()
if taken == false then
script.Parent.TakenBy.Text = "Taken by "..game.Players.LocalPlayer.Name.."!"
game.StarterGui.Rooms.Frame.Room1.TakenBy.Text = "Taken by "..game.Players.LocalPlayer.Name.."!"
game.Workspace.Room1:FireServer("CheckIn")
taken = true
end
end
script.Parent.MouseButton1Click:Connect(OnClick)
game.StarterGui.Room1.OnClientEvent:Connect(function(plr,thing)
if thing == "CheckIn" then
print("Client received")
script.Parent.TakenBy.Text = "Taken by "..plr.Name.."!"
game.StarterGui.Rooms.Frame.Room1.TakenBy.Text = "Taken by "..plr.Name.."!"
taken = true
elseif thing == "CheckOut" then
script.Parent.TakenBy.Text = "Taken by nobody!"
game.StarterGui.Rooms.Frame.Room1.TakenBy.Text = "Taken by nobody!"
game.Workspace.Room1:FireServer "CheckOut"
taken = false
end
end)
script.Parent.Parent.Checkout.MouseButton1Click:Connect(function()
script.Parent.TakenBy.Text = "Taken by nobody!"
game.StarterGui.Rooms.Frame.Room1.TakenBy.Text = "Taken by nobody!"
game.Workspace.Room1:FireServer"CheckOut"
taken = false
end)
.
-- server side
game.Workspace.Room1.OnServerEvent:Connect(function(player,thing)
if thing == "CheckIn" then
game.StarterGui.Room1:FireAllClients(player,"CheckIn")
print("server received")
elseif thing == "CheckOut" then
game.StarterGui.Room1:FireAllClients(player,"CheckOut")
end
end)
In the output it says: 20:23:27.678 - Maximum event re-entrancy depth exceeded for RemoteEvent.OnServerEvent and 20:23:27.679 - While entering function defined in script 'ServerScriptService.Room1', line 1 I don't even understand what that means. The game is FE btw. Help is appreciated.

1 comment
Maybe you need to turn off FE so your game may not glitch, also is the scripts that you scripted are FE or not because FE may glitch the game.