Hello. I am having trouble creating a GUI Text Button that can switch a player team. I know where to put the script, but I don't know what to put in it. Can someone help me?
First, make a button in the corner (or wherever you want) which will open a GUI with an list of teams, add a frame with a button for every team and add this LocalScript
and make it invisible by disabling the Visible
property inside of it.
The LocalScript
inside the button which will show the Team change frame should look like this:
local Frame = Script.Parent.Parent.Frame local Button = script.Parent Button.MouseButton1Click:Connect() Frame.Visible = true end
The buttons' LocalScript
s which will change the team should look like this:
local Player = game.Players.LocalPlayer local Team = --Your Team Here local Button = script.Parent Button.MouseButton1Click:Connect() Player.Team = Team end
If you want to add a cancel button in the frame, its LocalScript
will be very simmilar to the show button script, but it will make the frame invisible, like this:
local Frame = Script.Parent.Parent.Frame local Button = script.Parent Button.MouseButton1Click:Connect() Frame.Visible = true end
If you want more information about GUIs, can go to the Intro to GUIs tutorial.
Closed as Not Constructive by lunatic5, namespace25, Lugical, ee0w, and TheeDeathCaster
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?