Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Need Help With my Hotel Managment System (?)

Asked by 4 years ago

I have a Hotel with a Room Management System.So what this does it when a player has a Room Card in his inventory or has it equipped.There is a part in the game which changes it colour to RED.This system works but I have a Tool Giver GUI which gives customer tools from the Receptionist.This also work but when a receptionist gives a Room Card to another Player by using the GUI the part doesn't change it colour

HERE is the CODE to check whether the Room is Occupied or not i know its huge and there are ways of making it smaller but i dont know

local function CheckIfTaken(room, keycardName)
    for index, plr in pairs(game.Players:GetPlayers()) do
        if plr:FindFirstChild("Backpack") and plr.Character and (plr.Backpack:FindFirstChild(keycardName) or plr.Character:FindFirstChild(keycardName)) then

 room.Color = Color3.fromRGB(255, 0, 0)

        else

       room.Color = Color3.fromRGB(13, 255, 1)
        end
    end
end

while true do
    CheckIfTaken(workspace.ROOMAVAILABLITYCHECKING.Room1, "Room 01")
    CheckIfTaken(workspace.ROOMAVAILABLITYCHECKING.Room2, "Room 02")
    CheckIfTaken(workspace.ROOMAVAILABLITYCHECKING.Room3, "Room 03")
    CheckIfTaken(workspace.ROOMAVAILABLITYCHECKING.Room4, "Room 04")
    CheckIfTaken(workspace.ROOMAVAILABLITYCHECKING.Room5, "Room 05")
    CheckIfTaken(workspace.ROOMAVAILABLITYCHECKING.Room6, "Room 06")
    CheckIfTaken(workspace.ROOMAVAILABLITYCHECKING.Room7, "Room 07")
    CheckIfTaken(workspace.ROOMAVAILABLITYCHECKING.Room8, "Room 08")
    CheckIfTaken(workspace.ROOMAVAILABLITYCHECKING.Room9, "Room 09")
    CheckIfTaken(workspace.ROOMAVAILABLITYCHECKING.Room10, "Room 10")
    CheckIfTaken(workspace.ROOMAVAILABLITYCHECKING.Room11, "Room 11")
    CheckIfTaken(workspace.ROOMAVAILABLITYCHECKING.Room12, "Room 12")
    CheckIfTaken(workspace.ROOMAVAILABLITYCHECKING.Room13, "Room 13")
    CheckIfTaken(workspace.ROOMAVAILABLITYCHECKING.Room14, "Room 14")
    CheckIfTaken(workspace.ROOMAVAILABLITYCHECKING.Room15, "Room 15")
    CheckIfTaken(workspace.ROOMAVAILABLITYCHECKING.Room16, "Room 16")
    CheckIfTaken(workspace.ROOMAVAILABLITYCHECKING.Room17, "Room 17")
    CheckIfTaken(workspace.ROOMAVAILABLITYCHECKING.Room18, "Room 18")
    CheckIfTaken(workspace.ROOMAVAILABLITYCHECKING.Room19, "Room 19")
    CheckIfTaken(workspace.ROOMAVAILABLITYCHECKING.Room20, "Room 20")

    -- etc...
    wait(1)
end

I got the Tool Giving GUI as a model from a Youtuber https://web.roblox.com/library/5095381461/Hand-to-Gui

If you can contact me on Discord to talk about this (Agentgilspy Gaming#8624)

0
why not run a for loop through all the CheckIfTaken functions? zadobyte 692 — 4y

Answer this question