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