Here is the script but the error says: 'Workspace.House1.Trigger.Script:6: attempt to index upvalue 'player' (a nil value)'
local player = game.Players.LocalPlayer enabled = true workspace:FindFirstChild("House1"):FindFirstChild("Trigger").Touched:connect(function(hit) if (enabled == true) then workspace:FindFirstChild("House1"):FindFirstChild("userId").Value = player.UserId end end)
Alright so there's a few things you should be doing differently. You can adjust this script, but it is a normal script that goes under workspace right now:
workspace:FindFirstChild("House1"):FindFirstChild("Trigger").Touched:connect(function(hit) local Player = game.Players:FindFirstChild(hit.Parent.Name) if Player ~= nil then workspace:FindFirstChild("House1"):FindFirstChild("userId").Value = Player.UserId end end)
You shouldn't be using a local script to adjust server items, which won't work if you use Fe btw. If you absolutely have to make it client sided for a odd circumstance, then use a remote function and call it from the client.