I am trying to make a door that can only be activated when the key is picked up. The script in the key works fine, but when it is time to click on the door, the doors position doesn't change
Script in Key
local key = script.Parent
local click = key.ClickDetector
local door = game.Workspace.CabinetDoor
local function onClick(clicked)
key.Transparency = 1
key.Value.Value = true
end
click.MouseClick:connect(onClick)
Script in Door
local door = script.Parent
local click = door.ClickDetector
local value = game.Workspace.Key.Value.Value
local hidden = game.Workspace.door1
local function onClick(Clicked)
if value == true then
door.Position = Vector3.new(33.9, 4.7, 7.6)
wait(1)
hidden:Destroy()
end
end

1 comment
The key isn't a tool, it is a Part in the workspace