Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why doesn't this Gui script work, is something wrong with these 'if' statements?

So, this script first needs to wait until 'results' is visible, then open a GUI. Then, it should check the text of two textlabels. If they are 'Action & Adventure" and "Easy" then it needs two open one of two GUIs. If the text is different, it needs to print something. It works up to where it needs to open that GUI, then stops. It doesn't print anything, no other GUI appears. Can you please help?

-- Here is my LocalScript
wait(1)
player = game.Players.LocalPlayer
gui = player.PlayerGui.ScreenGui
results = gui.results
stepone = results.step1choice
steptwo = results.step2choice
TMM = results.TMM.Visible
LD = results.TMM.Visible

results.Changed:connect(function()
	local value = results.Visible
	wait(1)
	results.Loading.Visible = true
	if stepone.Text== "Action & Adventure" then
		if steptwo.Text== "Easy" then
			local num = math.random(1,2)
			if num== 1 then 
				TMM = true
				
			else
				LD = true
				
			end
		else
			print("It isn't action and adventure!")
		end
	else
		print("it isn't easy!")
	end
end)

2 comments

0

Can you upload the output?

0

It doesn't say anything. Neither does the Script Analysis.

1 answer

✓ Accepted answer

Changing TMM and LD just changes the value of the variable.

When you assigned it earlier, all you did was say

TMM = false
LD = false

It doesn't care how it got that false.


Instead, say

TMM = result.TMM

-------- etc


			TMM.Visible = true

It also looks like you have a typo in defining LD, since it's the same as TMM.

1 comment

0

Thank you!

This discussion is preserved as it was. New answers, comments, and votes are closed.