code:
local teams = game:GetService("Teams"):GetTeams() local playerss = game.Teams local function touched (hit) local player = game.Players:GetPlayerFromCharacter(hit.Parent) if #playerss.Playing:GetPlayers() ~= 0 then for i, v in pairs(game.Teams["Specating"]:GetPlayers()) do v.TeamColor = BrickColor.new('Navy blue') -- Change it with the color you set the team with(ex. BrickColor.new("Really Black") v.Character.Head:Destroy() print('k') end end end script.Parent.Touched:Connect(touched)
When you touch this brick it is supposed to run the code in the if statements but the player doesn't die, the teams don't change, and it wont even print 'k'.
Edit: somebody pointed out my code had a wrong team name. I fixed it but it still doesn't work.
Hello, FlappyCowWMI!
The only error I see here is (probally) the team name, try checking it...
local teams = game:GetService("Teams"):GetTeams() local playerss = game.Teams local function touched (hit) local player = game.Players:GetPlayerFromCharacter(hit.Parent) if #playerss.Playing:GetPlayers() ~= 0 then for i, v in pairs(game.Teams["Insert Team Name Here"]:GetPlayers()) do --The error is here, plase place the correct team name... v.TeamColor = BrickColor.new('Navy blue') -- Change it with the color you set the team with(ex. BrickColor.new("Really Black") v.Character.Head:Destroy() print('k') end end end script.Parent.Touched:Connect(touched)
Good Luck with your games
your code is disabled.