You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Inform people about this issue
What is the issue? Variables sending false and random information
game.Players.PlayerAdded:Connect(function(plr)
local rank = plr:GetRankInGroup(11229664) >= 1
local team = plr.TeamColor == BrickColor.new("Black")
if rank and team then
local tp = game:GetService("TeleportService")
wait(2)
print(rank)
tp:Teleport(7607409307, plr)
print(team)
else
print("2")
end
end)
Sometimes it’s sending true and sometimes false not sure why even though I’m testing this in the valid way on the person that answers on all of the requirements in the statement.
Rank is defined as a bool of whether the player is in your group or not ( you can use IsInGroup for this)
Team is defined as a bool of whether the player is on the team with the BrickColor ‘Black’
If rank & team are true, i.e. the player is in the group and in the team with the black BrickColor:
They are teleported to the place you specified, and their team and rank are printed
If either they are not in the group or not on the ‘black’ team:
The script will print ‘2’.
Please tell us which part of this is non functional. What is being printed when it is not working correctly?
Assumption wise, this code looks like it should function for teleporting players if they are in a group and on a team. If that’s what you’re trying to do and it’s not working, these are my guesses as to what you’re doing wrong:
Not setting the player’s team before the check is done, which seems very likely as the check for them being on the team is done immediately when they join the game.
The whole if statement it’s supposed to teleport those who do but it doesn’t even though it’s supposed to be true the statement is ain’t working properly they are in the right team along in the right group rank but still it says false