i have 2 seperate scripts which destroy the GUI after clicking and one which Kills you on click after 2 seconds
and if possible idk how to make it so when you are in this group it works but when you are not it doesn't work it would need group id right? and is it possible to have a Bool value in each button that says the group id.
function Click() wait(.5) script.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new("Bright violet") end script.Parent.MouseButton1Click:connect(Click)
pleas help me with this script.
Providing the directory of where the script is would be helpful. Apart from that I have one other thing you could try. On Line 6 you are using MouseButton1Click, I always use MouseButton1Down for these type of button script's and I would recommend you try to use it on this one.
Directory Fix:
Additionally, since I don't have the directory of the script here's a picture of the directory of a ScreenGUI: Picture Each object there you would add a .Parent too, so for example if the button was in a frame add in another .Parent. If it wasn't remove a .Parent.
Help on Group Restricting:
To group restrict one of your buttons we are going to use :IsInGroup. You are going to use the same directory you used with the team color changing part of the script but you are going to Make it:
script.Parent.Parent.Parent.Parent:IsInGroup()
You will also need to then make it an if statement and put your team color changing part of the script into your if statement. To make a value you can change for the GroupID, we will use a Number Value. Just insert into the Text Button where this script is a Number Value. Then inside the parentheses of :IsInGroup you will just put: script.Parent.Value.Value
function Click() if script.Parent.Parent.Parent.Parent:IsInGroup(script.Parent.Value.Value) then script.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new("Bright violet") end end script.Parent.MouseButton1Down:connect(Click)
That's about that for the final script, I would also recommend you put your kill script and gui removing script inside of the if statement so it wont kill them and remove there gui if they aren't in the group.
If you thought this was helpful make sure to give me a thumbs up and accept the answer :)