Yo so question; got a basic script here:
local NPC = game.ReplicatedStorage.NPC
local customer = game.ReplicatedStorage.Events.Customer
local username = game.ReplicatedStorage.Events.Username
local green = game.Workspace.Green.Owner.Value
local red = game.Workspace.Red.Owner.Value
local Owner
username.OnServerEvent:Connect(function(player)
if player == green then
Owner = green
elseif player == red then
Owner = red
end
end)
customer.OnServerEvent:Connect(function()
if Owner.Value.."'s customer" == workspace:WaitForChild(Owner.Value.."'s customer") then
print('exisiting')
else
print('new customer')
local newNPC = NPC:Clone()
newNPC.Parent = workspace
newNPC.Name = Owner.Value.."'s customer"
newNPC.Pathfinding.Disabled = false
print('pathfinding enabled')
end
end)
and its popin this error
attempt to index upvalue 'Owner' (a nil value)
The end goal is the create an NPC with a user's name and if an existing customer exists then it doesn't create a new one.

4 comments
Returning with attempt to " concatenate upvalue 'Owner' "
tostring(Owner)
Infinite yield possible on 'Workspace:WaitForChild("nil's customer")'
That's a different problem. That likely doesn't exist in the Workspace.