Problem with GUI script

Problem

Hey, I have a problem with a script for my GUI. I’m making a board that links it via numbers, I have 2 tracks in studio, 1.1 and 1.2. I type in 1.4, it says it’s wrong so that’s right, only it scans 2x and I can’t figure out the problem.

Script

local Boards = game.Workspace.Boards:GetChildren()
local BoardSign = script.Parent.Parent.Number
local Cover = script.Parent.Parent.Parent.Parent.Management.Cover

script.Parent.MouseButton1Click:Connect(function()
	for i,v in pairs(Boards) do
		if v.SurfaceGui.TextLabel.Text == BoardSign.Text then
			script.Parent.Text = "Searching..."
			wait(2)
			script.Parent.Text = "Success"
			Cover.Visible = false
			BoardSign.Text = ""
			wait(2)
			script.Parent.Text = "Search"
		else
			script.Parent.Text = "Searching..."
			wait(2)
			script.Parent.Text = "Failed"
			Cover.Visible = true
			BoardSign.Text = ""
			wait(2)
			script.Parent.Text = "Search"
		end
	end
end)

Video

1 Like

I’m assuming all this is in a local script. There is a problem with your script.

  1. When you are trying to find something server sided, you can’t do it through a local script. Local can’t detect changes in a server sided object/value. It would only detect the default value or the value you assigned prior to pre-running the program.

What you can do is fire a remote event when you click the button, and then loop through the workspace children to find the thing.

Thanks for the reply, I’m going to check this as soon as possible and I’ll let you know if it worked.