Inround.Changed function

inround.Changed:Connect(function()
		for _, plr in pairs(players:GetPlayers()) do
			if inround.Value == true then
				
				if forestmapworkspace.Value == true then
					local character = plr.Character or plr.CharacterAdded:Wait()
					local tpparts = maps:FindFirstChild("Forest"):FindFirstChild("TPParts")
					local randomtppart = math.random(1, 12)
					if randomtppart <= 12 then
						character:SetPrimaryPartCFrame(tpparts:FindFirstChild("TPpart")..randomtppart)

					else
						print("Doesnt work")
					end
				elseif mountainsmapworkspace.Value == true then
					local character = plr.Character or plr.CharacterAdded:Wait()
					local tpparts = maps:FindFirstChild("Mountains"):FindFirstChild("SpawnParts")
					local randomtppart = math.random(1, 12)
					if randomtppart <= 12 then
						character:SetPrimaryPartCFrame(tpparts:FindFirstChild("TPpart")..randomtppart)
					end
					
				else
					print("Inround.Value == true doesnt work")
				end

			elseif inround.Value == false then
				local character = plr.Character or plr.CharacterAdded:Wait()
				local tpparts = game.Workspace:FindFirstChild("Lobby"):FindFirstChild("Spawns")
				local randomtppart = math.random(1, 5)	
				if randomtppart <= 5 then
					character:SetPrimaryPartCFrame(tpparts:FindFirstChild("SpawnLocation"..randomtppart))
				end
			else
				print("Inround.Changed doesnt work")
			end
			
			

		end
	end)

While True Do script

while wait() do
	inround.Changed:Connect(function()
		for _, plr in pairs(players:GetPlayers()) do
			if inround.Value == true then
				
				if forestmapworkspace.Value == true then
					local character = plr.Character or plr.CharacterAdded:Wait()
					local tpparts = maps:FindFirstChild("Forest"):FindFirstChild("TPParts")
					local randomtppart = math.random(1, 12)
					if randomtppart <= 12 then
						character:SetPrimaryPartCFrame(tpparts:FindFirstChild("TPpart")..randomtppart)

					else
						print("Doesnt work")
					end
				elseif mountainsmapworkspace.Value == true then
					local character = plr.Character or plr.CharacterAdded:Wait()
					local tpparts = maps:FindFirstChild("Mountains"):FindFirstChild("SpawnParts")
					local randomtppart = math.random(1, 12)
					if randomtppart <= 12 then
						character:SetPrimaryPartCFrame(tpparts:FindFirstChild("TPpart")..randomtppart)
					end
					
				else
					print("Inround.Value == true doesnt work")
				end

			elseif inround.Value == false then
				local character = plr.Character or plr.CharacterAdded:Wait()
				local tpparts = game.Workspace:FindFirstChild("Lobby"):FindFirstChild("Spawns")
				local randomtppart = math.random(1, 5)	
				if randomtppart <= 5 then
					character:SetPrimaryPartCFrame(tpparts:FindFirstChild("SpawnLocation"..randomtppart))
				end
			else
				print("Inround.Changed doesnt work")
			end
			
			

		end
	end)
	remoteevent.OnServerEvent:Connect(function(plr, Map)
		if Map == "Forest" then
			map1 = map1 + 1
		elseif Map == "Mountains" then
			map2 = map2 + 1
		else
			print("Error in main script(Function deciding map)")
		end	
	end)
	inround.Value = false
	for i = lobbytime, 0, -1 do
		print("Game Starts in ".. i .." Seconds!")
		wait(1)
		roundstatus.Value = "Game Starts in ".. i .." Seconds!"
	end


	spawn(decided)
	

	spawn(spawnmap)



	inround.Value = true 
	for i = roundtime, 0, -1 do
		print("Time left: ".. i)
		wait(1)
		roundstatus.Value = "Time left: ".. i
	end
	spawn(destroymap)
	mappicked.Value = ""
	map1 = 0
	map2 = 0
end

2 comments

0

What's the issue?

0

It keeps erroring at print("Inround.Value == true doesnt work") even though Inround.Value does equal to true