Hello, today i was making a speedrun/obby. I made a music changer for each level and it doesn't work. So, i was wondering if anyone can help me out a lil'. Take yer time to write and view carefully.

script.Parent.Touched:Connect(function()
	print("1")
	for i,v in pairs (game.Players:GetPlayers()) do
		print("2")
--Problem Occurs here
		if v.Team == "Level 2" then
			print("3")
			v.PlayerGui.L2:Play()
		end
	end
end)

The output printed off these numbers to make sure the script was working correctly.

| 1 | 2

And 3 never showed up, why?

3 comments

0

The problem I could see is, there is no team named "Level 2" or no players are assigned to that team

0

oh...I did 'if tostring(v.Team) == "Level 2' then" and it worked, I think it is because the players team is an object and not just a string

0

That worked, thank you.