I want to make a script that only lets people that don't have a bool value (called "IsHunter" which is inside their Character) teleport inside the room, I've tried using If statements but that just lets people with the bool value teleport inside, same for people that don't have the bool value.
Let's think about how we could do this logically. What we need to do is go through all the players, and check if they have an IsHunter value inside of their character.
To loop through all the players, you can use a for loop, like this:
local players = game:GetService('Players') for _,v in ipairs(players:GetPlayers()) do print(v.Name) end
The code above will print all the player's names. Cool! We now know how to loop through all players. Now, to check if they have an IsHunter object in their Character, we can simply do the following:
local players = game:GetService('Players') for _,v in ipairs(players:GetPlayers()) do if v.Character:FindFirstChild('IsHunter') then v.Character:SetPrimaryPartCFrame(yourCframeHere) end end
Now all you need to do is replace yourCframeHere with the destination and it should work.
Hope this helped