Hello. I’m trying to make a hotel for my roblox game. I want to make a script that detects if a player leaves and if the player that left was already checked in a room it checks them out from that respective room. I tried making a script myself and I even tested it with a friend, but when they left the “Owner” value was still their roblox username, and the “taken” value was still set to “True”. This is what I tried so far:
local Players = game.Players
Players.PlayerRemoving:Connect(function(plr)
plr.CharacterRemoving:Connect(function()
if game.Workspace.Room601.Door.Door601.Owner.Value == plr.Name then
game.Workspace.Room601.Door.Door601.Owner.Value = "None"
game.Workspace.Room601.Door.Door601.taken.Value = "False"
game.Workspace.Key601.Transparency = 0
end
end)
end)
This is a server script in ServerScriptService. Any help is appreciated