ok so basically it works when i set it to true when the players join but when they key the key and the value is set to true then it doesnt work when I touch the base ``` local key = script.Parent
local door = workspace.Door
local base = door.Base
game.Players.PlayerAdded:Connect(function(player)
player:SetAttribute("HasKey", false)
end)
key.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
player:SetAttribute("HasKey", true)
print(player.Name .. " got the key!")
key:Destroy()
end
end)
base.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
if player:GetAttributeChangedSignal("HasKey") == true then
print(player.Name .. " has the key. Destroying base...")
base:Destroy()
else
print(player.Name .. " doesn't have the key.")
end
end
end)