What's wrong with this? The second function in line 4 is marked in red (in Roblox Studio) and it says: expected identifier, got 'function'?
local Door = script.Parent
local Owner = Door.Parent.OwnerName
function onTouched:connect(function(Hit)
local Character = Hit.Parent
local Player = game.Players:GetPlayerFromCharacter(Character)
if Player and Player.Name ~= Owner.Value then
Character:BreakJoints()
end
end
Door.Touched:connect(OnTouched)

2 comments
You do not need the :connect(function(Hit) on line 4, just the function onTouched(Hit)
Thanks alot!