Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can i fix the problems on this audio change script? [SOLVED: C]

Asked by 5 years ago
Edited 5 years ago

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?

0
The problem I could see is, there is no team named "Level 2" or no players are assigned to that team ForeverBrown 356 — 5y
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 ForeverBrown 356 — 5y
0
That worked, thank you. User#22722 20 — 5y

Answer this question