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

Why does my robbable bank not work? Bank GUI not showing up.

Asked by 4 years ago
Edited 4 years ago

I know this code is similar to Alvin_Blox's code on the robbable bank but I need help with it.

function GenerateRegion3(part)
    local Region3FromPart = Region3.new(part.Position-(part.Size/2), part.Position+(part.Size/2))
    return Region3FromPart
end

function FindPlayersInRegion3FromPart(PartToCreate)
    local reg = GenerateRegion3(PartToCreate)
    local playersFoundInRegion = game.Workspace:FindPartsInRegion3(reg, nil, math.huge)
    local PlayersInReg = {}

    for _, part in pairs(playersFoundInRegion) do
        print("Got in for loop for parts in region3")
            local player = game.Players:GetPlayerFromCharacter(part.Parent)
            if player then
                print("Another One!")
                for _, v in pairs(PlayersInReg) do
                    print("Got in loopfor players")
                    if v.Name == player.Name then
                        print("Test2")
                        playerFoundInRegion3 = true
                    end
                end
                if playerFoundInRegion3 == false then
                    table.insert(playersFoundInRegion, player)
                end
                playerFoundInRegion3 = false
            end
    end
    for _, player in pairs(PlayersInReg) do
        print("EnteredForLoop player")
        if player:FindFirstChild("IsRobbing").Value == false then
            print("Firing remote function!")
            game.ReplicatedStorage.RobberyGUIEnable:FireClient(player, true)
        end
        player.IsRobbing.Value = true

Any help or anything is appreciated!

Answer this question