Issues with Code script (larger issue)

Hello, I am having issues with this script:

local t = script.Parent.Parent.Parent.Parent.Text

script.Parent.MouseClick:Connect(function()
	if t.SurfaceGui.TextLabel.Text == workspace.ObjectiveFolder.IMPORTANTCode.Value then
		print("e")
		script.Parent.Parent.Correct:Play()
		t.BrickColor = BrickColor.new("Lime green")
		wait(0.1)
		t.BrickColor = BrickColor.new("Institutional white")
		wait(0.1)
		t.BrickColor = BrickColor.new("Lime green")
		wait(0.1)
		t.BrickColor = BrickColor.new("Institutional white")
	else
		script.Parent.Parent.Wrong:Play() -- this always plays
	end
end)

If more information is needed, please ask.

Edit: The game didn’t save the script or keypad.

why the script.Parent.Parent.Paren.Parent
show pic

A screenshot of your explorer window showing the surface gui’s organisation would be helpful.

1 Like

Where did you put the script on?, Maybe you put it in the SurfaceGui.

I put it in a part not the SurfaceGui

Can you show the issue that you facing on :slightly_smiling_face:?

Hello, I do not know what you mean but the issue is that it keeps playing the sound effect that shows its wrong, but I put in the right code.

try setting else to

elseif t.SurfaceGui.TextLabel.Text ~= workspace.ObjectiveFolder.IMPORTANTCode.Value then

I’m sorry but the game didn’t save the script or model so I can’t really work on it anymore.