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

Hi Why does the then in my script get underlined??

Hi, then is for some reason underlined in my script what am I doing wrong and how could I fix this?? I just started scripting with Lua and I am still learning it so it could be an easy fix. Code:

script.Parent.ProximityPrompt.Triggered:Connect(function(plr)

	plr.PlayerGui.TPGUI.Enabled = false  if not then 

			plr.PlayerGui.TPGUI.Enabled = true

	end

	end)

What the script is supposed to do is when a player clicks the proximity prompt it will check if the gui which is named TPGUI is disabled if it is it would enable it

Any help would be extraordinary

--Thanks Theking66hayday

2 answers

✓ Accepted answer

You have to first check if the GUI is enabled using an if statement. To use the if statement, it goes like this:

script.Parent.ProximityPrompt.Triggered:Connect(function(plr)
	if plr.PlayerGui.TPGUI.Enabled == false then
		plr.PlayerGui.TPGUI.Enabled = true
	end
end)

The if statement checks if the gui is enabled, if it is not enabled, the GUI is enabled.

1 comment

0

It got rid of the red thanks

im not sure if this works, but try this:

script.Parent.ProximityPrompt.Triggered:Connect(function(plr)

 local	Debounce = false
  plr.PlayerGui.TPGUI.Enabled = false  if Debounce ==true then

	plr.PlayerGui.TPGUI.Enabled = true

   end

end)

1 comment

0

if it doesent work, try changing line 3 whit: local Debounce = true

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