Ad
Log in to vote
0

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

Asked by 3 months ago

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

Log in to vote
1
Answered by 2 months ago

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.

0
It got rid of the red thanks theking66hayday 501 — 2mo
Ad
Log in to vote
1
Answered by 2 months ago
Edited 2 months ago

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)
0
if it doesent work, try changing line 3 whit: local Debounce = true Gigaset39 89 — 2mo

Answer this question