A but in studio then make they dont find somethings in game

For some reason my studio start be blind and dont find somethings in the game

this error apears about a code, and i will check what is the problem but

dont have any problem (the second warning its about call the function) like a literaly some minutes before this code are working like cheese, but for no reason the studio start dont find somethings and happend with anothers things, in scripts or workspace or saver storage or whatever the studio just dont find some thing then exist and are in the same local, i see another guy teling about that bug and i realy dont know how to fix it, someone has this problem too? and have any way to solve it?

1 Like

Can you send the full code in the text? That way I can get a better look at it.
Also, is this in a LocalScript or Script? And what is its context?

Its a script for mach making like fotboll machs, but only the last 2 machs

local GameInfo	= game.ReplicatedStorage.GameInfo
local Players = game.Players:GetPlayers()
local Teams = game.Teams
local placar = GameInfo.Placar
local PointsTeam1 = GameInfo.PointsTeam1
local PointsTeam2 = GameInfo.PointsTeam2
local victoryui = GameInfo.VictoryUi
local ActualPlayer01
local ActualPlayer02

local ActualPlacarUi = nil

local FirstMachMade = false
local WoWinFirst = nil
local SecondMachMade = false
local WoWinSecond = nil
local ThirdMachMade = false
local WoWinThird = nil

local InMach = false

local WoInTeam1 = nil
local WoInTeam2 = nil

local function Countdown(Duration)
	for t = Duration,0,-1 do
		task.wait(1)
		GameInfo:SetAttribute("Duration", t)
		
	end
end

function StartGame(plr)

	if #game.Players:GetPlayers() >= 1 then		
		InMach = true
		if FirstMachMade == false then
				GameInfo:SetAttribute("Status", "Em jogo")
				for _, Player in pairs(game.Players:GetPlayers()) do
					if Player.Team == game:GetService("Teams").Alemanha then
					Player.Character:WaitForChild("HumanoidRootPart").CFrame.Position = Vector3.new(35, 4.796, -99.491)
					ActualPlayer01 = Player
					end
					if Player.Team == game:GetService("Teams").Argentina then
					Player.Character:WaitForChild("HumanoidRootPart").CFrame.Position = Vector3.new(35, 4.796, -99.491)
					ActualPlayer02 = Player
				end
			end

				WoInTeam1 = game.Teams.Alemanha
			WoInTeam2 = game.Teams.Argentina
			
			GameInfo.Team1.Value = game.Teams.Alemanha
			GameInfo.Team2.Value = game.Teams.Argentina
			

				local CloneP = placar:Clone()
				CloneP.Parent = plr.PlayerGui
				ActualPlacarUi = CloneP

				Countdown(60)

				if PointsTeam1.Value >= PointsTeam2.Value then
					victoryui.Frame.TextLabel.Text = "Vitória da Alemanha"
					WoWinFirst = game.Teams.Alemanha
					task.wait()
				else
					victoryui.Frame.TextLabel.Text = "Vitória da Argentina"
					WoWinSecond = game.Teams.Argentina
					task.wait()
				end 

				local CloneV = victoryui:Clone()
				CloneV.Parent = plr.PlayerGui
			
			InMach = false
			FirstMachMade = true
			ActualPlayer01.Character.Humanoid.Health = 0
			ActualPlayer02.Character.Humanoid.Health = 0
				GameInfo:SetAttribute("Status", "Intervensão")
				Countdown(15)

				CloneP:Destroy()
				CloneV:Destroy()
				ActualPlacarUi = nil

				WoInTeam1 = nil
				WoInTeam2 = nil

				PointsTeam1 = 0
				PointsTeam2 = 0

				StartGame()

				if SecondMachMade == false  then
					InMach = true
					GameInfo:SetAttribute("Status", "Em jogo")
					for _, Player in pairs(game.Players:GetPlayers()) do
						if Player.Team == game:GetService("Teams").Brasil then
						Player.Character.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(35, 4.796, -99.491))
						ActualPlayer01 = Player
						end
						if Player.Team == game:GetService("Teams").Portugal then
						Player.Character.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(35, 4.319, 144.509))
						ActualPlayer02 = Player
						end
					end

					WoInTeam1 = game.Teams.Brasil
				WoInTeam2 = game.Teams.Portugal
				
				GameInfo.Team1.Value = game.Teams.Brasil
				GameInfo.Team2.Value = game.Teams.Portugal

					local CloneP = placar:Clone()
					CloneP.Parent = plr.PlayerGui
					ActualPlacarUi = CloneP

					Countdown(60)

					if PointsTeam1.Value >= PointsTeam2.Value then
						victoryui.Frame.TextLabel.Text = "Vitória do Brasil"
						WoWinSecond = game.Teams.Brasil
						task.wait()
					else
						victoryui.Frame.TextLabel.Text = "Vitória de Portugal"
						WoWinSecond = game.Teams.Portugal
						task.wait()
					end 

					local CloneV = victoryui:Clone()
					CloneV.Parent = plr.PlayerGui

					SecondMachMade = true
				InMach = false
				
				ActualPlayer01.Character.Humanoid.Health = 0
				ActualPlayer02.Character.Humanoid.Health = 0

				GameInfo:SetAttribute("Status", "Intervensão")
					Countdown(15)

					CloneP:Destroy()
					CloneV:Destroy()
					ActualPlacarUi = nil

					WoInTeam1 = nil
					WoInTeam2 = nil

					PointsTeam1 = 0
					PointsTeam2 = 0

					StartGame()

				elseif ThirdMachMade == false then
					
					InMach = false
					GameInfo:SetAttribute("Status", "Em jogo")
					for _, Player in pairs(game.Players:GetPlayers()) do
						if Player.Team == WoWinFirst then
						Player.Character.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(35, 4.796, -99.491))
						ActualPlayer01 = Player
						end
						if Player.Team == WoWinSecond then
						Player.Character.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(35, 4.319, 144.509))
						ActualPlayer02 = Player
						end
					end

					WoInTeam1 = WoWinFirst
					WoInTeam2 = WoWinSecond

					local WoWinFirstName = WoWinFirst.Name
				local WoWinSecondName = WoWinSecond.Name
				
				GameInfo.Team1.Value = game.Teams.WoInTeam1
				GameInfo.Team2.Value = game.Teams.WoInTeam2
				
				
					if WoWinFirstName == "Alemanha" then
						placar.Frame.Frame.Sigla1.Text = "GER"
						placar.Frame.Frame.Time1.Image = "http://www.roblox.com/asset/?id=6399522594"
					else
						placar.Frame.Frame.Sigla2.Text = "ARG"
						placar.Frame.Frame.Time2.Image = "http://www.roblox.com/asset/?id=6473879287"
					end
					if WoWinSecondName == "Brasil" then
						placar.Frame.Frame.Sigla1.Text = "BRA"
						placar.Frame.Frame.Time1.Image = "http://www.roblox.com/asset/?id=4893889069"
					else
						placar.Frame.Frame.Sigla2.Text = "POR"
						placar.Frame.Frame.Time2.Image = "http://www.roblox.com/asset/?id=136163957"
					end

					local CloneP = placar:Clone()
					CloneP.Parent = plr.PlayerGui
					ActualPlacarUi = CloneP

					Countdown(60)

					if PointsTeam1.Value >= PointsTeam2.Value then
						victoryui.Frame.TextLabel.Text = WoWinFirstName.. "GANHOU A COPA"
						for _, Player in pairs(game.Players:GetPlayers()) do
							if Player.Team == WoWinFirst then
								Player.leaderstats["Copas Vencidas"].Value += 1
							end
						end
						task.wait()
					else
						victoryui.Frame.TextLabel.Text = WoWinSecondName.. "GANHOU A COPA"
						for _, Player in pairs(game.Players:GetPlayers()) do
							if Player.Team == WoWinSecond then
								Player.leaderstats["Copas Vencidas"].Value += 1
							end
						end
						task.wait()
					end 

					local CloneV = victoryui:Clone()
					CloneV.Parent = plr.PlayerGui

					ThirdMachMade = true
				InMach = false
				
				ActualPlayer01.Character.Humanoid.Health = 0
				ActualPlayer02.Character.Humanoid.Health = 0

				GameInfo:SetAttribute("Status", "Intervensão")
					Countdown(15)

					CloneP:Destroy()
					CloneV:Destroy()
					ActualPlacarUi = nil

					WoInTeam1 = nil
					WoInTeam2 = nil

					FirstMachMade = false
					SecondMachMade = false
					ThirdMachMade = false

					PointsTeam1 = 0
					PointsTeam2 = 0

					StartGame()

			end
		end
	else
		GameInfo:SetAttribute("Status", "Esperando por jogadores")
	end
end




game.Players.PlayerAdded:Connect(function(plr)
	if Teams.Alemanha.TeamPlayers.Value < Teams.Alemanha.MaxPlayers.Value then
		plr.Team = Teams.Alemanha
		Teams.Alemanha.TeamPlayers.Value = Teams.Alemanha.TeamPlayers.Value + 1
		
	elseif Teams.Argentina.TeamPlayers.Value < Teams.Argentina.MaxPlayers.Value then
		plr.Team = Teams.Argentina
		Teams.Argentina.TeamPlayers.Value = Teams.Argentina.TeamPlayers.Value + 1
		
	elseif Teams.Brasil.TeamPlayers.Value < Teams.Brasil.MaxPlayers.Value then
		plr.Team = Teams.Brasil
		Teams.Brasil.TeamPlayers.Value = Teams.Brasil.TeamPlayers.Value + 1
		
	elseif Teams.Portugal.TeamPlayers.Value < Teams.Portugal.MaxPlayers.Value then
		plr.Team = Teams.Portugal
		Teams.Portugal.TeamPlayers.Value = Teams.Portugal.TeamPlayers.Value + 1
		
	end
	
	StartGame(plr)
	
end)

sorry for the long script, if you have any ways to make more legible

Where is this script located? Also, I think you need to redefine the Player to get its humanoidrootpart.

The script is locate in ServerScriptService, and what you mean with “redifine”?

By that I mean, you will need to find another way to define the HumanoidRootPart.
I have not tried this myself but this may be another way for you to define it.

local character = player.Character or player.CharacterAdded:Wait()

as seen here:

2 Likes

should be easy but i need to take the players of a specifc team and take your’s humanoids, fr i’m thinking in restard from 0 this script but i spend like 9 to 12 ours in this thing :confused:

Although, is the player’s team already set? Because if it can not find in either, what should happen?

yes, they are set before the function been called and executed to start mach

yes, they are set before the function been called and executed to start mach