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

Why is this ignoring the Boolean Value?

Asked by 5 years ago

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

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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
Ad
Log in to vote
0
Answered by 5 years ago

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.

Answer this question