Help scripting team choosing buttons at log in

Hello friends, I need some help with this since after seeing several tutorials and posts I got more confused.

For my game, i added the teams service, I have created two teams, their colors and a script. I also built a screengui that shows two buttons when entering the game, one for each team and that is the problem, when clicking on the buttons, only the frame disappears but no the player does not enter the chosen team.
The place of the script or the code may be wrong?, it is difficult for me to see the error

What can I do to make the buttons work correctly? I am new to scripting.
Thanks so much to everyone reading this.

Teams
image

Buttons
image

Remote event
image

Local Script
image

Scripts in each image button
image

Try capitalizing the C in MouseButton1Click in the first local script.

doesn’t work :sob: I tried in other baseplate too and same result

I dont think there is a frame inside the script’s parent. Did you get a warning about the WaitForChild?

Alright, so in the first script on line 2 when you set up the variable frame it seems there isn’t an object named frame at that level in the explorer screenshot you provided. Did you mean to say script.Parent?

Finally, did you get any errors in the output window? Hope I can help you fix this.

I ll check now i have some time

From the Images of your scripts your not setting the players team

An for that i need a normal script inside each team ? or in the buttons? or were ?this things are new for me :smile:

Thank you anyway

Player.Team (roblox.com)
Here is the API Reference page just incase you don’t have it :slight_smile:

Great!! I ll try this… :grin:
thank you so much

1 Like

I forgor, this was the output and the script localscript.txt (459 Bytes)
image

If it says that there is an infinite yield possible on a :WaitForChild function that means that the item that you tried to reference isn’t there or you spelled the name wrong. You could have also just messed up the path slightly. Ex: You said script.Paent:WaitForChild() when you should have said script.Parent.Parent:WaitForChild()

1 Like