#round system thinking players died immidiatly

42 messages · Page 1 of 1 (latest)

coarse sky
#

the first time it runs the playing code it aknoldeges there are 2 players but the second time (2 seconds after the first) it thinks everyone is dead for some reason....

#

here is the whole script

#

although i think the problem is in here:

#
for i, player in pairs(plrs) do
        if player then
            character = player.Character
            
            if character then
                --Teleport them
                character:FindFirstChild("HumanoidRootPart").CFrame = AvailableSpawnPoints[1].CFrame
                table.remove(AvailableSpawnPoints,1)
                
                --give them gun
                
                local gun = ServerStorage.Gun:Clone()
                gun.Parent = player.Backpack
                
                local GameTag = Instance.new("BoolValue")
                GameTag.Name = "GameTag"
                GameTag.Parent = player.Character
                
            else
                --there is no character
                if not player then
                    table.remove(plrs, i)
                end
            end
        end
    end
    Status.Value = "Get ready to play!"

    task.wait(2)

    for i = GameLength,0,-1 do
        
        for x, player in pairs(plrs) do
            if player then
                
                character = player.Character
                
                if not character then
                    --left the game
                else
                    if character:FindFirstChild("GameTag") then
                        print(player.Name.."IS STILL IN THE GAME")
                    else
                        --they dead lol
                        table.remove(plrs,x)
                        print(player.Name.." has been removed")
                    end
                end
            else
                table.remove(plrs,x)
                print(player.Name.." has been removed")
                
            end
        end
        
        Status.Value = " " ..i.." seconds left / "..#plrs.." remaining"
dusk tapir
#

I think the same players get re-added in the plrs table and generally the whole variable gets messed up.

coarse sky
#

I’m not sure what I did but it works now

coarse sky
#

At the bottom of the script it’s supposed to destroy the player

#

Which it doesn’t

dusk tapir
#

Yeah

#

Cause

#

U didnt tell it to destroy em

coarse sky
#

Wym

#

I’m pretty sure I did

dusk tapir
#

no

coarse sky
#

Right here

dusk tapir
#

that destroys abool value bro

#

not the player

coarse sky
#

Oh wait

#

Ur right lmao

dusk tapir
#

do u know ur own script 😭

coarse sky
#

Then how do I destroy the player

coarse sky
#

I’m not good at scripting

#

I just keep trying things until it works

#

Wait

dusk tapir
#

i think its a good time to just get a tutorial for scripting

coarse sky
#

I’m dumb I can just do character:destroy right

dusk tapir
coarse sky
#

Character:destroy()

#

@dusk tapir

#

Stay with me now

dusk tapir
#

how else

coarse sky
#

I guess I’ll try it and see if it works