If Value is different, And you click a button, a GUI opens

Hello,

I have been struggeling for an hour with this and i need some help.

I have a part, when you click it, a stringvalue’s value changes text. And when the stringvalue’s text is the text that has been changed and not, the text before the part was clicked, then a gui opens (wich i have a script for)

Anyone that can please help me??

1 Like

You may want to post the script so people can read it and try to help.

Copy the script text from your game, paste it here, and put 3 backticks (```) before and after it so that it formats correctly in the post.

1 Like

Yes, please post the script and we will try our best to assist you!

1 Like

Don’t reply to me. Please reply to OP.

@TomPlays63 @Scottifly


if script.Parent.StringValue.Value == "Login" then
	script.Parent.ClickDetector.MouseClick:Connect(function()
	local guiClone = script.Parent.ScreenGUI:Clone()
		guiClone.Parent = player.PlayerGui
	end)
end

-- the stringvalue changes, when you click a button it will say "Login"
-- i also changed name of everything to the original name so its easier for you

Call the function before the if statement.

script.Parent.ClickDetector.MouseClick:Connect(function()
if script.Parent.StringValue.Value == "Login" then
	local guiClone = script.Parent.ScreenGUI:Clone()
		guiClone.Parent = player.PlayerGui
	end
end)