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

>; did you forget to close 'then' at line 7? error, can somebody help?

So I was scripting today when I got this bug, did you forget to close 'then' at line 7? I closed the "then" function with end and it did nothing, can somebody help:?

Code:

    local ProximityPromt = script.Parent.ProximityPrompt
--- Code Made By usmaniusmangamer15
local SelfOrderGUI = game.StarterGui.DeliveringUI.Frame

ProximityPromt.Triggered:Connect(function()
    ProximityPromt.ActionText = "Self-Order"
	if ProximityPromt.ActionText == "Self-order" then
		SelfOrderGUI.visible = true
		ProximityPromt.Enabled = false	
		wait(1)
		ProximityPromt.Enabled = true
	end

3 answers

✓ Accepted answer

When you connect a function you have to use 'end)' to close it.

local ProximityPromt = script.Parent.ProximityPrompt
--- Code Made By usmaniusmangamer15
local SelfOrderGUI = game.StarterGui.DeliveringUI.Frame

ProximityPromt.Triggered:Connect(function() -- here
	ProximityPromt.ActionText = "Self-Order"
	if ProximityPromt.ActionText == "Self-order" then
		SelfOrderGUI.visible = true
		ProximityPromt.Enabled = false
		wait(1)
		ProximityPromt.Enabled = true
	end
end) -- and here

Always end lines like line 5 with "end)"

local ProximityPromt = script.Parent.ProximityPrompt
--- Code Made By usmaniusmangamer15
local SelfOrderGUI = game.StarterGui.DeliveringUI.Frame

ProximityPromt.Triggered:Connect(function()
	ProximityPromt.ActionText = "Self-Order"
	if ProximityPromt.ActionText == "Self-order" then
		SelfOrderGUI.visible = true
		ProximityPromt.Enabled = false  
		wait(1)
		ProximityPromt.Enabled = true
	end
end)

1 comment

0

Thanks, Im gonna try this.

local ProximityPromt = script.Parent.ProximityPrompt local SelfOrderGUI = game.StarterGui.DeliveringUI.Frame

ProximityPromt.Triggered:Connect(function() ProximityPromt.ActionText = "Self-Order" if ProximityPromt.ActionText == "Self-order" then SelfOrderGUI.visible = true ProximityPromt.Enabled = false
wait(1) ProximityPromt.Enabled = true end end)

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