I want to make it so it prints something when the player is on red team
It dosent print anything doe Which is the problem
i tried changing it into a string anything and didnt work and i didnt look in the devhub
i dont know what else to type here but i really need it for my game
local player = game.Players.PlayerAdded:Connect(function()
local Team = game:GetService("Teams")
wait(1)
if player.Team == "Spys" then
print("Player is on spy team")
end
end)
player.Team is an object value, not a string value. If you want to verify the team name, do âplayer.Team.Name == âthe teamâs nameââ. Otherwise it will be âplayer.Team == game.Teams.TeamObjectâ.
game.Players.PlayerAdded:Connect(function(plr)
local Team = game:GetService("Teams")
wait(1)
if plr.Team == Teams.Spys then
print("Player is on spy team")
end
end)
local plr = game.Players.LocalPlayer
local Team = game:GetService(âTeamsâ)
wait(1)
if plr.Team == Teams.Spys then
print(âPlayer is on spy teamâ)
end
end)
local plr = game.Players.LocalPlayer
local Team = game:GetService(âTeamsâ)
wait(1)
if plr.Team == Teams.Spys then
print(âPlayer is on spy teamâ)
end
local plr = game.Players.LocalPlayer
local Team = game:GetService("Teams")
wait(1)
if plr.Team == Teams.Spys then
print("Player is on spy team")
end
end)
To get syntax highlighting (âlua textâ, as you put it)
```
before and after the code, on lines before and after the code, not the same line
Itâs the character near the top left of your keyboard
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local Teams = game:GetService("Teams")
task.wait(1)
-- What do you need the wait for?
if LocalPlayer.Team == Teams.Spys then
print("Player is on spy team")
end
I already posted and sent you to the correct one multiple times, but here it is again:
local plr = game.Players.LocalPlayer
local Team = game:GetService(âTeamsâ)
wait(1)
if plr.Teams == Teams.Spys then
print(âPlayer is on spy teamâ)
end