When I run the script below I get this error
- 20:13:07.784 - Players.Player1.PlayerGui.Menu.Home_Frame.Lock/Unlock.ButtonScript:10: attempt to index upvalue 'dor' (a nil value)
20:13:07.784 - Stack Begin
20:13:07.785 - Script 'Players.Player1.PlayerGui.Menu.Home_Frame.Lock/Unlock.ButtonScript', Line 10
20:13:07.785 - Stack End *
local player = game.Players.LocalPlayer
local playerpref = game.Workspace.PlayerProfiles:FindFirstChild(player.Name)
local lockval = playerpref:FindFirstChild("Locked")
local house = game.Workspace.PlayerProfiles:FindFirstChild(player.Name):FindFirstChild("HouseOwned"):FindFirstChild("HouseNumber").Value
local dor = game.Workspace:FindFirstChild(house):FindFirstChild("Door")
script.Parent.MouseButton1Down:connect(function(clicked)
if lockval.Value == false then
lockval.Value = true
dor.CanCollide = true
script.Parent.Text = "unlock"
else
lockval.Value = false
script.Parent.Text = "lock"
dor.CanCollide = false
end
end)
