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

Confused on why it says this, "Expected 'end' (to close 'function' at line 3), got <eof>"?

I am fairly new to scripting but I am confused on why it is asking for me to close the function on line 3. | Also I want these actions to happen server wide so it is why this is running a regular script.

local Door = game.Workspace.Door

Door.Touched:Connect(function(touched)
	if touched.Parent:FindFirstChild("Humanoid") then
		if player.ID == 560637180 then
			Door.CanCollide = false
			Door.Transparency = 0.8
			wait(2.5)
			Door.CanCollide = true
			Door.Transparency = 0
		end
	end

1 comment

0

I edited my answer.

1 answer

✓ Accepted answer
local Door = game.Workspace.Door

Door.Touched:Connect(function(touched)
	local pname = touched.Parent.Name
	local player = game.Players[pname]
    if touched.Parent:FindFirstChild("Humanoid") then
        if player.UserId == 560637180 then
            Door.CanCollide = false
            Door.Transparency = 0.8
            wait(2.5)
            Door.CanCollide = true
            Door.Transparency = 0
        end
    end
end)

2 comments

0

It errors at line 5, attempt to index nil with 'ID'.

0

Thank you!

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