for i, players in pairs(plr) do
print("Reading Players")
if players then
print("Is A Player")
character = players.Character
print("Found Character")
if character then
print("Character Is Here")
if players.InMenu.Value ~= true then --this is the problem here
print("Teleporting Players")
players.Character:FindFirstChild("HumanoidRootPart").CFrame = CFrame.new(11.5, 28.5, -127.5)
print("Teleport Success")
else
print("Still In Menu")
table.remove(plr, i)
end
else
print("Not Character")
if not players then
table.remove(plr, i)
print("Not Player")
end
end
end
end
My problem is that the script always thinks the player is out of the menu, even when they are in the menu and the InMenu value is ticked SHOWING the script NOT TO TELEPORT THE CHARACTER!
EDIT: I just give up with this game, even the tutorials I watch don’t work.
Okay, try going to the console and checking for errors. You shouldn’t make a post on the developer forums without checking for errors on the output and/or trying to de-bug the code yourself.
for i, player in pairs(plr) do
if player then
local character = player.Character
if character then
if player.InMenu.Value == false then
character.HumanoidRootPart.CFrame = CFrame.new(11.5, 28.5, -127.5)
else
table.remove(plr, i)
end
else
table.remove(plr, i)
end
end
end
This should be an exact replica of your script but with correct indentations. I guess try this, it’s most likely gonna do the same action but without logging the stuff, but who knows.
I think the problem is in how your InMenu value is updated or modified, as far as i know any changes made to it by a LocalScript or within the Properties tab itself is undetected by the server so make sure that it is the server that changes the value before you do your checks.
Yeah. As I mentioned earlier, changes from the console (which the LocalScript is a part of) on server sided properties (ex. Players, workspace, etc.) will only be seen by the client. OP’s script (which I assume is server sided) doesn’t detect the change which is why the player is being teleported.
In order to change a value from the client to the server, you would have to use a RemoteEvent. However since OP is still new to coding, I wouldn’t recommend him to learn it.