Locking & Unlocking Door Script Doesn't Work

I have no idea why my script doesn’t work, here it is:

    local currentOwner = script.Parent.Parent.Parent.Parent.Parent.currentOwner.Value

local bought = script.Parent.Parent.Parent.Parent.Parent.bought.Value

local lock = script.Parent.Parent.Parent.locked

local unlock = script.Parent.Parent.Parent.unlocked

local function open()

script.Parent.Parent.CanCollide = false

script.Parent.Parent.Transparency = 0.7

script.Parent.Parent.Parent.door.CanCollide = false

script.Parent.Parent.Parent.door.Transparency = 0.7

end

local function close()

script.Parent.Parent.CanCollide = true

script.Parent.Parent.Transparency = 0

script.Parent.Parent.Parent.door.CanCollide = true

script.Parent.Parent.Parent.door.Transparency = 0

end

script.Parent.MouseClick:Connect(function(player)

if player.UserId == currentOwner and script.Parent.Parent.CanCollide == true then

close()

unlock:Play()

elseif player.UserId == currentOwner and script.Parent.Parent.CanCollide == false then

open()

lock:Play()

end

end)

This is a serverscript in the workspace in the clickdetector so I’m not sure why it doesn’t work. No errors print to the console so

Have it print out curentOwner, bought, lock and unlock and see what the values are. Have it print when the door knob or whatever is clicked.

I’ve done that, I’ve also checked in the explorer & the values are my ID.

if u put a print(“test”) after this does it print?

if player.UserId == currentOwner and script.Parent.Parent.CanCollide == true then
print(“test”)

and after
elseif player.UserId == currentOwner and script.Parent.Parent.CanCollide == false then
print(“test2”)