<eof> error but when I tried to fix it, it gave me a different error

I’m simply trying to fix a bug to get my door to open and close.

There’s a error in my coding that I can’t figure out (I’m new to coding)

I found one thing and when I tried it (adding the parentheses that the post I found told me to do, it said, “Expected identifier when parsing expression, got ‘)”

Also how do I get rid of selecting a whole letter instead of just the space between?
Any help is appreciated!


local door = script.Parent.Union
local hinge = script.Parent.Hinge
local prompt = script.Parent.Union.ProximityPrompt

local goalOpen = {}
goalOpen.CFrame = hinge.CFrame * CFrame.Angles(0, math.rad(90), 0)

local goalClose = {}
goalClose.CFrame = hinge.CFrame * CFrame.Angles(0, 0, 0)

local tweenInfo = TweenInfo.new(1)
local tweenOpen = TweenService:Create(hinge, tweenInfo, goalOpen)
local tweenClose = TweenService:Create(hinge, tweenInfo, goalClose)

prompt.Triggered:Connect(function())
	if prompt.ActionText == "Close" then
		tweenClose:Play()
		prompt.ActionText = "Open"
	else
		tweenOpen:Play()
		prompt.ActionText = "Close"
	end
end)
1 Like

Next time, please copy the code over in a text box with three backticks (`) (also we can see your face kinda)

The problem is that you didn’t actually close the function in prompt.Triggered:Connect. The correct code is:

prompt.Triggered:Connect(function()
    if prompt.ActionText == "Close" then
    ...
end)

Edit: You have to include the code for people to know how to debug it…

Honestly it still doesn’t work.
It says “expected identifier when parsing expression, got )”

local door = script.Parent.Union
local hinge = script.Parent.Hinge
local prompt = script.Parent.Union.ProximityPrompt

local goalOpen = {}
goalOpen.CFrame = hinge.CFrame * CFrame.Angles(0, math.rad(90), 0)

local goalClose = {}
goalClose.CFrame = hinge.CFrame * CFrame.Angles(0, 0, 0)

local tweenInfo = TweenInfo.new(1)
local tweenOpen = TweenService:Create(hinge, tweenInfo, goalOpen)
local tweenClose = TweenService:Create(hinge, tweenInfo, goalClose)

prompt.Triggered:Connect(function()
	if prompt.ActionText == "Close" then
		tweenClose:Play()
		prompt.ActionText = "Open"
	else
		tweenOpen:Play()
		prompt.ActionText = "Close"
	end
end)

You had an extra parenthesis.

Oh yeah. I accidentally left that there trying to fix it.

Change:

(function())

To:

(function()