local creatorID = game.Players:GetUserIdFromNameAsync(name) or -1

I want this value to default to -1 if game.Players:GetUserIdFromNameAsync(name) can't fetch a value... I've seen this done before with DataStore examples, just never understood how it works.

function teleportToPlace(plr, name)
	local placeID = getPlaceIdFromName(name)
	local creatorID = game.Players:GetUserIdFromNameAsync(name) or -1
	if creatorID ~= nil then
		print("PlaceID:", placeID, creatorID)
	else
		print("PlaceID:", placeID)
	end

	/** other code is down here, but irrelevant**/
end

1 comment

1

code block