Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why is this ignoring the Boolean Value?

So I have a Boolean Value (Playing) that is in the player's character and I can't seem to figure out why it ignores it even if it's set to false. Shouldn't it not teleport the player or am I doing something wrong?

if map == 1 then    
game.Lighting.SampleMap:Clone().Parent = game.Workspace   
status.Value = "ROBLOXIAN FOREST!"    
wait(5)   
target = CFrame.new(20.531, -47.377, 53.969)
for i, player in ipairs(game.Players:GetChildren()) do    
if player.Character.Playing.Value == true then    
player.Character.UpperTorso.CFrame = target + Vector3.new(0, i * 0, 0)   
player.Character.IsAlive.Value = true

end

end

end

2 answers

Did you confirm that the boolean is being changed by the server side? If the boolean is not being changed by the server side, try setting up remote events and remote functions. That should be the main cause of this problem, but if that doesn't resolve it, try this:

   if map == 1 then
    game.Lighting.SampleMap:Clone().Parent = game.Workspace   
    status.Value = "ROBLOXIAN FOREST!"    
    wait(5)   
    target = CFrame.new(20.531, -47.377, 53.969)
    for i, player in ipairs(game.Players:GetChildren()) do    
    print("Okay, it's set to ".. tostring(player.Character.Playing.Value).. " on the server side.")
    if player.Character:FindFirstChild("Playing").Value == false then   
    print("This player is being ignored..")
    else 
    player.Character.UpperTorso.CFrame = target + Vector3.new(0, i * 0, 0)   
    player.Character.IsAlive.Value = true
    
    end   
    end
    end

That's correct, that will only teleport the player if the value of Playing is equal to true, which means that it's equal to true; it isn't ignoring it. Click on the BoolValue in the explorer, and assuming nothing altered it since then, it should be set to true. You can also do

print(Playing.Value)

which should print out true.

This discussion is preserved as it was. New answers, comments, and votes are closed.