Returning a value if text is different

Hi! I’m trying to create a way to make sure no one can select multiple things at a time in my self check-in. As you can see in the video below it works just fine for the top one but not anyone else. It is supposed to say false if a class is already selected, and if the class selected is the one you clicked on it will unselect.

The frames have the same script and formatting. The reason I do this is because I have a frame creation system that creates a frame based on a number in a module script.

Local script:

local function stopAtDifferentValue(f) --"f" is a folder of value instances.
	for _, valueInstance in ipairs(f:GetDescendants()) do
		if valueInstance:IsA("TextLabel") and valueInstance.Name == "statusText" then
			if valueInstance.Text == "Selected" or valueInstance.Text == "Unselect" then
				return false
				return true

	local result = stopAtDifferentValue(ClassFrames)
	if script.Parent.Frame.statusText.Text == "Selected" or script.Parent.Frame.statusText.Text == "Unselect" then
		script.Parent.Frame.statusText.Text = "Select"
		script.Parent.Frame.BackgroundColor3 = Color3.fromRGB(114, 152, 98)
		game.ReplicatedStorage.SCIstorage.Functions.SRE:FireServer("unselect", moduleName)
	if result == true then
		if script.Parent.Frame.statusText.Text == "Select" then
			script.Parent.Frame.statusText.Text = "Selected"
			script.Parent.Frame.BackgroundColor3 = Color3.fromRGB(226, 134, 28)
			game.ReplicatedStorage.SCIstorage.Functions.SRE:FireServer("select", moduleName)

Any help would be appreciated.


1)Notice that you’ve fired the server ‘select’ and ‘unselect’ with low caps, and you’re checking for these words with upper caps

2)You should loop for each frame that you have there, if the player hasnt chosen one yet [or unselected a previous one], then he’d be able to choose them

  1. “script.Parent.SelectBtn.MouseButton1Click:Connect(function()” - this would fire only for that specific button you called here, if you want this to work for each of your buttons, make a loop and in that, call the MouseButton1Click for each of the buttons when a player is pressing them

And I would do this how? Lol i’m sorry for being trash

also the event works just fine. It’s how i mentioned it in my server script.

“script.Parent.SelectBtn.MouseButton1Click:Connect(function()” - this would fire only for that specific button you called here, if you want this to work for each of your buttons, make a loop and in that, call the MouseButton1Click for each of the buttons when a player is pressing them

the same script is inside every frame tho? So should I place the script in the classFrames or something and make a loop finding the buttons then if they get clicked they run the same code?

Hold on, I am going to test this on my studio and come back to you, do you mind sharing the gui ? so that I could test this on the same gui as yours

Do you want the ui file? I could send it

Sure, the gui could help me make a code that’ll be useful for you aswell [since we’re using the same ui]

gui_1.rbxm (11.6 KB)

it’s a surface gui because of how I set it up. Just change surface gui to screengui and it should work

Does not work, try to make it as model and upload to roblox and send it here [ you can take it offsale after I took that]

This maybe?

Good, let me test now and I’ll come back to you asap

Also, if you dont mind to send the server code, so we could check if something is wrong there

local sci = require(game.Workspace.AeroSCI.README)

game.ReplicatedStorage.SCIstorage.Functions.SRE.OnServerEvent:Connect(function(plr, event, class)
	if event == "select" then
		if plr.sci.selected.Value == false then
			plr.sci.selected.Value = true
			plr.sci.selectedClass.Value = class
	elseif event == "unselect" then
		if plr.sci.selected.Value == true then
			plr.sci.selected.Value = false
			plr.sci.selectedClass.Value = ""

	local sciFolder ="Folder", plr)
	sciFolder.Name = "sci"
	local selectedValue ="BoolValue", sciFolder)
	selectedValue.Name = "selected"
	local selectedClass ="StringValue", sciFolder)
	selectedClass.Name = "selectedClass"
	local function CloneTemplate(guiName)
		local gui = game.ReplicatedStorage.SCIstorage.Misc.Template:Clone()
		gui.Parent = game.ReplicatedStorage.SCIstorage.SCI.MainFrame.CheckInFrame.AttributeFrame.ClassFrames
		gui.Name = guiName
		return gui
	for k = 1,sci.Classes do

You need this to. It’s the module script.

I dont see this button here, are you sure you named your button correctly?

OH YEAH! You need another one.

Replicated storage

There is a template that gets duplicated for each sci.Classes = 6 then it makes 6 of the template frame.

Alright, there are no instructions on how to use it, where do I put that ui ?

Could I just add you, and you join my studio? It’s way easier for you and me. AviaTeamm

Sure, send me a request and we’ll be there

1 Like