What do I want to achieve? Basically the script is supposed to work so if you walk onto the basketball court while a game is going on and your not on either team, you get teleported outside of the court.
What is the issue? The script is not working with checking if whether or not the player is on a team. It teleports you outside of the court regardless of whether or not you’re on a team.
What solutions have you tried so far?
Here are the two methods I’ve tried so far for checking if a player is on a team when they hit the basketball court.
local OnAteam = false if game.Teams.Red:FindFirstChild(hit.Parent.Name) then print("it worked")-- checking if player is on red team (not working) OnAteam = true -- if player is on a team, this comes back true end print(OnAteam) -- comes back false again
local OnAteam = false for i, v in pairs (game.Teams:WaitForChild("Red"):GetChildren()) do print(v.Name) if v.Name == hit.Parent.Name then OnAteam = true end end print(OnAteam) -- comes back false
I was on the red team when I went into court and each time it came back false.